java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.structure.processor.rule.GradientOutput
Record Components:
states - The ordered list of BlockStates from start (0.0) to end (1.0) of the gradient.
axis - The SpatialVector defining the local and/or global direction of the gradient (default: SpatialVector.UP).
minDistance - The scalar projection distance corresponding to the start of the gradient (t = 0.0).
maxDistance - The scalar projection distance corresponding to the end of the gradient (t = 1.0).
reverse - Whether to invert the normalized gradient fraction (t = 1.0 - t) after curve evaluation.
noise - The amplitude of uniform random jitter added to t for organic dithering between palette slices.
curve - The GradientCurve used to warp the normalized distance fraction t.
All Implemented Interfaces:
RuleOutput

public record GradientOutput(List<net.minecraft.world.level.block.state.BlockState> states, SpatialVector axis, float minDistance, float maxDistance, boolean reverse, float noise, GradientCurve curve) extends Record implements RuleOutput
A RuleOutput implementation that selects a BlockState from an ordered palette of states based on the block's projected distance along a SpatialVector axis, shaped by a GradientCurve and perturbed by random noise.

Used extensively in structure processor lists (such as mossifying lower walls or weathering upper roofs) to create natural vertical or directional block transitions.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<GradientOutput>
    The MapCodec for serializing and deserializing a GradientOutput from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GradientOutput(List<net.minecraft.world.level.block.state.BlockState> states, SpatialVector axis, float minDistance, float maxDistance, boolean reverse, float noise, GradientCurve curve)
    Creates an instance of a GradientOutput record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the axis record component.
    Returns the value of the curve record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.level.block.state.BlockState
    getOutput(net.minecraft.util.RandomSource random, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings)
    Evaluates the spatial projection, curve transformation, optional reversal, and dithering noise for the given block coordinates, mapping the resulting fraction in [0.0, 1.0] to an equal-width slice of states.
    Retrieves the unique string identifier for this output type.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the maxDistance record component.
    float
    Returns the value of the minDistance record component.
    float
    Returns the value of the noise record component.
    boolean
    Returns the value of the reverse record component.
    List<net.minecraft.world.level.block.state.BlockState>
    Returns the value of the states record component.
    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.MapCodec<GradientOutput> CODEC
      The MapCodec for serializing and deserializing a GradientOutput from JSON.
  • Constructor Details

    • GradientOutput

      public GradientOutput(List<net.minecraft.world.level.block.state.BlockState> states, SpatialVector axis, float minDistance, float maxDistance, boolean reverse, float noise, GradientCurve curve)
      Creates an instance of a GradientOutput record class.
      Parameters:
      states - the value for the states record component
      axis - the value for the axis record component
      minDistance - the value for the minDistance record component
      maxDistance - the value for the maxDistance record component
      reverse - the value for the reverse record component
      noise - the value for the noise record component
      curve - the value for the curve record component
  • Method Details

    • getTypeId

      public String getTypeId()
      Retrieves the unique string identifier for this output type.
      Specified by:
      getTypeId in interface RuleOutput
      Returns:
      The type identifier "gradient".
    • getOutput

      public net.minecraft.world.level.block.state.BlockState getOutput(net.minecraft.util.RandomSource random, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings)
      Evaluates the spatial projection, curve transformation, optional reversal, and dithering noise for the given block coordinates, mapping the resulting fraction in [0.0, 1.0] to an equal-width slice of states.
      Specified by:
      getOutput in interface RuleOutput
      Parameters:
      random - The per-block deterministic random source.
      localPos - The unrotated template-local block position.
      absolutePos - The transformed world-space block position.
      settings - The structure placement settings.
      Returns:
      The selected BlockState from states, or Blocks.AIR if the palette is empty.
    • 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.
    • states

      public List<net.minecraft.world.level.block.state.BlockState> states()
      Returns the value of the states record component.
      Returns:
      the value of the states record component
    • axis

      public SpatialVector axis()
      Returns the value of the axis record component.
      Returns:
      the value of the axis record component
    • minDistance

      public float minDistance()
      Returns the value of the minDistance record component.
      Returns:
      the value of the minDistance record component
    • maxDistance

      public float maxDistance()
      Returns the value of the maxDistance record component.
      Returns:
      the value of the maxDistance record component
    • reverse

      public boolean reverse()
      Returns the value of the reverse record component.
      Returns:
      the value of the reverse record component
    • noise

      public float noise()
      Returns the value of the noise record component.
      Returns:
      the value of the noise record component
    • curve

      public GradientCurve curve()
      Returns the value of the curve record component.
      Returns:
      the value of the curve record component