Record Class MultifaceGrowthFeature
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.feature.MultifaceGrowthFeature
- All Implemented Interfaces:
Feature
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for thecanBePlacedOnrecord component.private final booleanThe field for thecanPlaceOnCeilingrecord component.private final booleanThe field for thecanPlaceOnFloorrecord component.private final booleanThe field for thecanPlaceOnWallrecord component.private final floatThe field for thechanceOfSpreadingrecord component.static final com.mojang.serialization.MapCodec<MultifaceGrowthFeature> private final BlockThe field for theplaceBlockrecord component.private final intThe field for thesearchRangerecord component.Fields inherited from interface Feature
DIRECT_CODEC, LIST_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionMultifaceGrowthFeature(Block placeBlock, int searchRange, boolean canPlaceOnFloor, boolean canPlaceOnCeiling, boolean canPlaceOnWall, float chanceOfSpreading, HolderSet<Block> canBePlacedOn) Creates an instance of aMultifaceGrowthFeaturerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecanBePlacedOnrecord component.booleanReturns the value of thecanPlaceOnCeilingrecord component.booleanReturns the value of thecanPlaceOnFloorrecord component.booleanReturns the value of thecanPlaceOnWallrecord component.floatReturns the value of thechanceOfSpreadingrecord component.com.mojang.serialization.MapCodec<MultifaceGrowthFeature> codec()final booleanIndicates whether some other object is "equal to" this one.getShuffledDirections(RandomSource random) getShuffledDirectionsExcept(RandomSource random, Direction excludeDirection) final inthashCode()Returns a hash code value for this object.private static booleanisAirOrWater(BlockState state) booleanplace(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) Returns the value of theplaceBlockrecord component.booleanplaceGrowthIfPossible(MultifaceSpreadeableBlock placerBlock, WorldGenLevel level, BlockPos pos, BlockState oldState, RandomSource random, List<Direction> placementDirections) intReturns the value of thesearchRangerecord component.final StringtoString()Returns a string representation of this record class.private static com.mojang.serialization.DataResult<Block> validateBlock(Block block) private it.unimi.dsi.fastutil.objects.ObjectArrayList<Direction> Methods inherited from interface Feature
getSubFeatures, markAboveForPostProcessing, safeSetBlock, setBlock
-
Field Details
-
placeBlock
The field for theplaceBlockrecord component. -
searchRange
private final int searchRangeThe field for thesearchRangerecord component. -
canPlaceOnFloor
private final boolean canPlaceOnFloorThe field for thecanPlaceOnFloorrecord component. -
canPlaceOnCeiling
private final boolean canPlaceOnCeilingThe field for thecanPlaceOnCeilingrecord component. -
canPlaceOnWall
private final boolean canPlaceOnWallThe field for thecanPlaceOnWallrecord component. -
chanceOfSpreading
private final float chanceOfSpreadingThe field for thechanceOfSpreadingrecord component. -
canBePlacedOn
-
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 aMultifaceGrowthFeaturerecord class.- Parameters:
placeBlock- the value for theplaceBlockrecord componentsearchRange- the value for thesearchRangerecord componentcanPlaceOnFloor- the value for thecanPlaceOnFloorrecord componentcanPlaceOnCeiling- the value for thecanPlaceOnCeilingrecord componentcanPlaceOnWall- the value for thecanPlaceOnWallrecord componentchanceOfSpreading- the value for thechanceOfSpreadingrecord componentcanBePlacedOn- the value for thecanBePlacedOnrecord component
-
-
Method Details
-
validateBlock
-
codec
-
place
public boolean place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) -
placeGrowthIfPossible
public boolean placeGrowthIfPossible(MultifaceSpreadeableBlock placerBlock, WorldGenLevel level, BlockPos pos, BlockState oldState, RandomSource random, List<Direction> placementDirections) -
validDirections
-
getShuffledDirectionsExcept
private List<Direction> getShuffledDirectionsExcept(RandomSource random, Direction excludeDirection) -
getShuffledDirections
-
isAirOrWater
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
placeBlock
Returns the value of theplaceBlockrecord component.- Returns:
- the value of the
placeBlockrecord component
-
searchRange
public int searchRange()Returns the value of thesearchRangerecord component.- Returns:
- the value of the
searchRangerecord component
-
canPlaceOnFloor
public boolean canPlaceOnFloor()Returns the value of thecanPlaceOnFloorrecord component.- Returns:
- the value of the
canPlaceOnFloorrecord component
-
canPlaceOnCeiling
public boolean canPlaceOnCeiling()Returns the value of thecanPlaceOnCeilingrecord component.- Returns:
- the value of the
canPlaceOnCeilingrecord component
-
canPlaceOnWall
public boolean canPlaceOnWall()Returns the value of thecanPlaceOnWallrecord component.- Returns:
- the value of the
canPlaceOnWallrecord component
-
chanceOfSpreading
public float chanceOfSpreading()Returns the value of thechanceOfSpreadingrecord component.- Returns:
- the value of the
chanceOfSpreadingrecord component
-
canBePlacedOn
-