Record Class MultifaceGrowthFeature

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

public record MultifaceGrowthFeature(Block placeBlock, int searchRange, boolean canPlaceOnFloor, boolean canPlaceOnCeiling, boolean canPlaceOnWall, float chanceOfSpreading, HolderSet<Block> canBePlacedOn) extends Record implements Feature
  • Field Details

    • placeBlock

      private final Block placeBlock
      The field for the placeBlock record component.
    • searchRange

      private final int searchRange
      The field for the searchRange record component.
    • canPlaceOnFloor

      private final boolean canPlaceOnFloor
      The field for the canPlaceOnFloor record component.
    • canPlaceOnCeiling

      private final boolean canPlaceOnCeiling
      The field for the canPlaceOnCeiling record component.
    • canPlaceOnWall

      private final boolean canPlaceOnWall
      The field for the canPlaceOnWall record component.
    • chanceOfSpreading

      private final float chanceOfSpreading
      The field for the chanceOfSpreading record component.
    • canBePlacedOn

      private final HolderSet<Block> canBePlacedOn
      The field for the canBePlacedOn record component.
    • CODEC

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

    • MultifaceGrowthFeature

      public MultifaceGrowthFeature(Block placeBlock, int searchRange, boolean canPlaceOnFloor, boolean canPlaceOnCeiling, boolean canPlaceOnWall, float chanceOfSpreading, HolderSet<Block> canBePlacedOn)
      Creates an instance of a MultifaceGrowthFeature record class.
      Parameters:
      placeBlock - the value for the placeBlock record component
      searchRange - the value for the searchRange record component
      canPlaceOnFloor - the value for the canPlaceOnFloor record component
      canPlaceOnCeiling - the value for the canPlaceOnCeiling record component
      canPlaceOnWall - the value for the canPlaceOnWall record component
      chanceOfSpreading - the value for the chanceOfSpreading record component
      canBePlacedOn - the value for the canBePlacedOn record component
  • Method Details

    • validateBlock

      private static com.mojang.serialization.DataResult<Block> validateBlock(Block block)
    • codec

      public com.mojang.serialization.MapCodec<MultifaceGrowthFeature> 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
    • placeGrowthIfPossible

      public boolean placeGrowthIfPossible(MultifaceSpreadeableBlock placerBlock, WorldGenLevel level, BlockPos pos, BlockState oldState, RandomSource random, List<Direction> placementDirections)
    • validDirections

      private it.unimi.dsi.fastutil.objects.ObjectArrayList<Direction> validDirections()
    • getShuffledDirectionsExcept

      private List<Direction> getShuffledDirectionsExcept(RandomSource random, Direction excludeDirection)
    • getShuffledDirections

      private List<Direction> getShuffledDirections(RandomSource random)
    • isAirOrWater

      private static boolean isAirOrWater(BlockState state)
    • 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.
    • placeBlock

      public Block placeBlock()
      Returns the value of the placeBlock record component.
      Returns:
      the value of the placeBlock record component
    • searchRange

      public int searchRange()
      Returns the value of the searchRange record component.
      Returns:
      the value of the searchRange record component
    • canPlaceOnFloor

      public boolean canPlaceOnFloor()
      Returns the value of the canPlaceOnFloor record component.
      Returns:
      the value of the canPlaceOnFloor record component
    • canPlaceOnCeiling

      public boolean canPlaceOnCeiling()
      Returns the value of the canPlaceOnCeiling record component.
      Returns:
      the value of the canPlaceOnCeiling record component
    • canPlaceOnWall

      public boolean canPlaceOnWall()
      Returns the value of the canPlaceOnWall record component.
      Returns:
      the value of the canPlaceOnWall record component
    • chanceOfSpreading

      public float chanceOfSpreading()
      Returns the value of the chanceOfSpreading record component.
      Returns:
      the value of the chanceOfSpreading record component
    • canBePlacedOn

      public HolderSet<Block> canBePlacedOn()
      Returns the value of the canBePlacedOn record component.
      Returns:
      the value of the canBePlacedOn record component