java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.structure.processor.rule.OverhauledRule
Record Components:
inputPredicates - List of RuleTest predicates tested against the template's original input block state (any match passes).
locationPredicates - List of RuleTest predicates tested against the current block state at the target location (any match passes).
positionPredicate - A PosRuleTest evaluated against the local, absolute, and pivot positions.
probability - The probability (0.0 to 1.0) that this rule applies when all predicates match.
copyProperties - Whether shared block state properties should be copied from the existing state onto the output state.
output - The RuleOutput provider that produces the replacement BlockState.

public record OverhauledRule(List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> inputPredicates, List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> locationPredicates, net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTest positionPredicate, float probability, boolean copyProperties, RuleOutput output) extends Record
A data-driven rule evaluated by RuleProcessor.

Supports either single or array-based input_predicate and location_predicate definitions (evaluated via logical OR within each list), an optional PosRuleTest, a rule-level trigger probability, a copyProperties flag for preserving block state properties (such as stair orientation or slab half), and a polymorphic RuleOutput.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<OverhauledRule>
    The codec responsible for serializing and deserializing OverhauledRule instances from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OverhauledRule(List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> inputPredicates, List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> locationPredicates, net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTest positionPredicate, float probability, boolean copyProperties, RuleOutput output)
    Creates an instance of a OverhauledRule record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the copyProperties record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest>
    Returns the value of the inputPredicates record component.
    List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest>
    Returns the value of the locationPredicates record component.
    Returns the value of the output record component.
    net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTest
    Returns the value of the positionPredicate record component.
    float
    Returns the value of the probability record component.
    boolean
    test(net.minecraft.world.level.block.state.BlockState inputState, net.minecraft.world.level.block.state.BlockState locationState, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.core.BlockPos pivot, net.minecraft.util.RandomSource random)
    Evaluates whether the input state, location state, and block positions satisfy this rule's predicates.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<OverhauledRule> CODEC
      The codec responsible for serializing and deserializing OverhauledRule instances from JSON.
  • Constructor Details

    • OverhauledRule

      public OverhauledRule(List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> inputPredicates, List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> locationPredicates, net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTest positionPredicate, float probability, boolean copyProperties, RuleOutput output)
      Creates an instance of a OverhauledRule record class.
      Parameters:
      inputPredicates - the value for the inputPredicates record component
      locationPredicates - the value for the locationPredicates record component
      positionPredicate - the value for the positionPredicate record component
      probability - the value for the probability record component
      copyProperties - the value for the copyProperties record component
      output - the value for the output record component
  • Method Details

    • test

      public boolean test(net.minecraft.world.level.block.state.BlockState inputState, net.minecraft.world.level.block.state.BlockState locationState, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.core.BlockPos pivot, net.minecraft.util.RandomSource random)
      Evaluates whether the input state, location state, and block positions satisfy this rule's predicates.
      Parameters:
      inputState - The original block state from the template.
      locationState - The current block state at the target placement position.
      localPos - The unrotated template-local block position.
      absolutePos - The transformed world-space block position.
      pivot - The structure pivot position.
      random - The per-block deterministic random source.
      Returns:
      true if at least one input predicate, at least one location predicate, and the position predicate all match; false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • inputPredicates

      public List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> inputPredicates()
      Returns the value of the inputPredicates record component.
      Returns:
      the value of the inputPredicates record component
    • locationPredicates

      public List<net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest> locationPredicates()
      Returns the value of the locationPredicates record component.
      Returns:
      the value of the locationPredicates record component
    • positionPredicate

      public net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTest positionPredicate()
      Returns the value of the positionPredicate record component.
      Returns:
      the value of the positionPredicate record component
    • probability

      public float probability()
      Returns the value of the probability record component.
      Returns:
      the value of the probability record component
    • copyProperties

      public boolean copyProperties()
      Returns the value of the copyProperties record component.
      Returns:
      the value of the copyProperties record component
    • output

      public RuleOutput output()
      Returns the value of the output record component.
      Returns:
      the value of the output record component