Record Class SingleBlockPillarFeature

java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.feature.SingleBlockPillarFeature
All Implemented Interfaces:
Feature

public record SingleBlockPillarFeature(Holder<BlockStateProvider> block, BlockPredicate canReplace, Direction direction, float chanceToContinue, Optional<Holder<PlacedFeature>> capFeature) extends Record implements Feature
  • Field Details

    • block

      private final Holder<BlockStateProvider> block
      The field for the block record component.
    • canReplace

      private final BlockPredicate canReplace
      The field for the canReplace record component.
    • direction

      private final Direction direction
      The field for the direction record component.
    • chanceToContinue

      private final float chanceToContinue
      The field for the chanceToContinue record component.
    • capFeature

      private final Optional<Holder<PlacedFeature>> capFeature
      The field for the capFeature record component.
    • CODEC

      public static final com.mojang.serialization.MapCodec<SingleBlockPillarFeature> CODEC
  • Constructor Details

    • SingleBlockPillarFeature

      public SingleBlockPillarFeature(Holder<BlockStateProvider> block, BlockPredicate mayReplace, Direction direction, float chanceToContinue)
    • SingleBlockPillarFeature

      public SingleBlockPillarFeature(Holder<BlockStateProvider> block, BlockPredicate canReplace, Direction direction, float chanceToContinue, Optional<Holder<PlacedFeature>> capFeature)
      Creates an instance of a SingleBlockPillarFeature record class.
      Parameters:
      block - the value for the block record component
      canReplace - the value for the canReplace record component
      direction - the value for the direction record component
      chanceToContinue - the value for the chanceToContinue record component
      capFeature - the value for the capFeature record component
  • Method Details

    • codec

      public com.mojang.serialization.MapCodec<SingleBlockPillarFeature> codec()
      Specified by:
      codec in interface Feature
    • place

      public boolean place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin)
      Specified by:
      place in interface Feature
    • 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.
    • block

      public Holder<BlockStateProvider> block()
      Returns the value of the block record component.
      Returns:
      the value of the block record component
    • canReplace

      public BlockPredicate canReplace()
      Returns the value of the canReplace record component.
      Returns:
      the value of the canReplace record component
    • direction

      public Direction direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • chanceToContinue

      public float chanceToContinue()
      Returns the value of the chanceToContinue record component.
      Returns:
      the value of the chanceToContinue record component
    • capFeature

      public Optional<Holder<PlacedFeature>> capFeature()
      Returns the value of the capFeature record component.
      Returns:
      the value of the capFeature record component