Record Class CanyonWorldCarver

java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.carver.CanyonWorldCarver
All Implemented Interfaces:
WorldCarver

public record CanyonWorldCarver(float probability, HeightProvider y, FloatProvider verticalRotation, CanyonWorldCarver.Shape shape) extends Record implements WorldCarver
  • Field Details

    • probability

      private final float probability
      The field for the probability record component.
    • y

      private final HeightProvider y
      The field for the y record component.
    • verticalRotation

      private final FloatProvider verticalRotation
      The field for the verticalRotation record component.
    • shape

      private final CanyonWorldCarver.Shape shape
      The field for the shape record component.
    • MAP_CODEC

      public static final com.mojang.serialization.MapCodec<CanyonWorldCarver> MAP_CODEC
  • Constructor Details

    • CanyonWorldCarver

      public CanyonWorldCarver(float probability, HeightProvider y, FloatProvider verticalRotation, CanyonWorldCarver.Shape shape)
      Creates an instance of a CanyonWorldCarver record class.
      Parameters:
      probability - the value for the probability record component
      y - the value for the y record component
      verticalRotation - the value for the verticalRotation record component
      shape - the value for the shape record component
  • Method Details

    • isStartChunk

      public boolean isStartChunk(RandomSource random)
      Specified by:
      isStartChunk in interface WorldCarver
    • carve

      public boolean carve(WorldGenerationContext context, RandomSource random, ChunkPos chunkPos, ChunkPos sourceChunkPos, CarverOutput output)
      Specified by:
      carve in interface WorldCarver
    • doCarve

      private void doCarve(WorldGenerationContext context, ChunkPos chunkPos, long tunnelSeed, double x, double y, double z, float thickness, float horizontalRotation, float verticalRotation, int step, int distance, double yScale, CarverOutput output)
    • initWidthFactors

      private float[] initWidthFactors(WorldGenerationContext context, RandomSource random)
    • updateVerticalRadius

      private double updateVerticalRadius(RandomSource random, double verticalRadius, float distance, float currentStep)
    • shouldSkip

      private boolean shouldSkip(WorldGenerationContext context, float[] widthFactorPerHeight, double xd, double yd, double zd, int y)
    • codec

      public com.mojang.serialization.MapCodec<CanyonWorldCarver> codec()
      Specified by:
      codec in interface WorldCarver
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • probability

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

      public HeightProvider y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • verticalRotation

      public FloatProvider verticalRotation()
      Returns the value of the verticalRotation record component.
      Returns:
      the value of the verticalRotation record component
    • shape

      public CanyonWorldCarver.Shape shape()
      Returns the value of the shape record component.
      Returns:
      the value of the shape record component