Record Class TreeFeature
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.feature.TreeFeature
- All Implemented Interfaces:
Feature
public record TreeFeature(Holder<BlockStateProvider> trunkProvider, TrunkPlacer trunkPlacer, Holder<BlockStateProvider> foliageProvider, FoliagePlacer foliagePlacer, Optional<RootPlacer> rootPlacer, FeatureSize minimumSize, List<TreeDecorator> decorators, boolean ignoreVines, Holder<BlockStateProvider> belowTrunkProvider)
extends Record
implements Feature
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Holder<BlockStateProvider> The field for thebelowTrunkProviderrecord component.private static final intstatic final com.mojang.serialization.MapCodec<TreeFeature> private final List<TreeDecorator> The field for thedecoratorsrecord component.private final FoliagePlacerThe field for thefoliagePlacerrecord component.private final Holder<BlockStateProvider> The field for thefoliageProviderrecord component.private final booleanThe field for theignoreVinesrecord component.private final FeatureSizeThe field for theminimumSizerecord component.private final Optional<RootPlacer> The field for therootPlacerrecord component.private final TrunkPlacerThe field for thetrunkPlacerrecord component.private final Holder<BlockStateProvider> The field for thetrunkProviderrecord component.Fields inherited from interface Feature
DIRECT_CODEC, LIST_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionTreeFeature(Holder<BlockStateProvider> trunkProvider, TrunkPlacer trunkPlacer, Holder<BlockStateProvider> foliageProvider, FoliagePlacer foliagePlacer, Optional<RootPlacer> rootPlacer, FeatureSize minimumSize, List<TreeDecorator> decorators, boolean ignoreVines, Holder<BlockStateProvider> belowTrunkProvider) Creates an instance of aTreeFeaturerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebelowTrunkProviderrecord component.com.mojang.serialization.MapCodec<TreeFeature> codec()Returns the value of thedecoratorsrecord component.private booleandoPlace(WorldGenLevel level, RandomSource random, BlockPos origin, BiConsumer<BlockPos, BlockState> rootSetter, BiConsumer<BlockPos, BlockState> trunkSetter, FoliagePlacer.FoliageSetter foliageSetter) final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefoliagePlacerrecord component.Returns the value of thefoliageProviderrecord component.private intgetMaxFreeTreeHeight(WorldGenLevel level, int maxTreeHeight, BlockPos treePos) final inthashCode()Returns a hash code value for this object.booleanReturns the value of theignoreVinesrecord component.static booleanisAirOrLeaves(LevelSimulatedReader level, BlockPos pos) static booleanisVine(LevelSimulatedReader level, BlockPos pos) Returns the value of theminimumSizerecord component.booleanplace(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) Returns the value of therootPlacerrecord component.voidsetBlock(LevelWriter level, BlockPos pos, BlockState blockState) private static voidsetBlockKnownShape(LevelWriter level, BlockPos pos, BlockState blockState) final StringtoString()Returns a string representation of this record class.Returns the value of thetrunkPlacerrecord component.Returns the value of thetrunkProviderrecord component.private static DiscreteVoxelShapeupdateLeaves(LevelAccessor level, BoundingBox bounds, Set<BlockPos> logs, Set<BlockPos> decorationSet, Set<BlockPos> rootPositions) static booleanvalidTreePos(LevelSimulatedReader level, BlockPos pos) Methods inherited from interface Feature
getSubFeatures, markAboveForPostProcessing, safeSetBlock
-
Field Details
-
trunkProvider
The field for thetrunkProviderrecord component. -
trunkPlacer
The field for thetrunkPlacerrecord component. -
foliageProvider
The field for thefoliageProviderrecord component. -
foliagePlacer
The field for thefoliagePlacerrecord component. -
rootPlacer
The field for therootPlacerrecord component. -
minimumSize
The field for theminimumSizerecord component. -
decorators
The field for thedecoratorsrecord component. -
ignoreVines
private final boolean ignoreVinesThe field for theignoreVinesrecord component. -
belowTrunkProvider
The field for thebelowTrunkProviderrecord component. -
CODEC
-
BLOCK_UPDATE_FLAGS
private static final int BLOCK_UPDATE_FLAGS- See Also:
-
-
Constructor Details
-
TreeFeature
public TreeFeature(Holder<BlockStateProvider> trunkProvider, TrunkPlacer trunkPlacer, Holder<BlockStateProvider> foliageProvider, FoliagePlacer foliagePlacer, Optional<RootPlacer> rootPlacer, FeatureSize minimumSize, List<TreeDecorator> decorators, boolean ignoreVines, Holder<BlockStateProvider> belowTrunkProvider) Creates an instance of aTreeFeaturerecord class.- Parameters:
trunkProvider- the value for thetrunkProviderrecord componenttrunkPlacer- the value for thetrunkPlacerrecord componentfoliageProvider- the value for thefoliageProviderrecord componentfoliagePlacer- the value for thefoliagePlacerrecord componentrootPlacer- the value for therootPlacerrecord componentminimumSize- the value for theminimumSizerecord componentdecorators- the value for thedecoratorsrecord componentignoreVines- the value for theignoreVinesrecord componentbelowTrunkProvider- the value for thebelowTrunkProviderrecord component
-
-
Method Details
-
codec
-
isVine
-
isAirOrLeaves
-
setBlockKnownShape
-
validTreePos
-
doPlace
private boolean doPlace(WorldGenLevel level, RandomSource random, BlockPos origin, BiConsumer<BlockPos, BlockState> rootSetter, BiConsumer<BlockPos, BlockState> trunkSetter, FoliagePlacer.FoliageSetter foliageSetter) -
getMaxFreeTreeHeight
-
setBlock
-
place
public boolean place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) -
updateLeaves
private static DiscreteVoxelShape updateLeaves(LevelAccessor level, BoundingBox bounds, Set<BlockPos> logs, Set<BlockPos> decorationSet, Set<BlockPos> rootPositions) -
getLowestTrunkOrRootOfTree
-
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. -
trunkProvider
Returns the value of thetrunkProviderrecord component.- Returns:
- the value of the
trunkProviderrecord component
-
trunkPlacer
Returns the value of thetrunkPlacerrecord component.- Returns:
- the value of the
trunkPlacerrecord component
-
foliageProvider
Returns the value of thefoliageProviderrecord component.- Returns:
- the value of the
foliageProviderrecord component
-
foliagePlacer
Returns the value of thefoliagePlacerrecord component.- Returns:
- the value of the
foliagePlacerrecord component
-
rootPlacer
Returns the value of therootPlacerrecord component.- Returns:
- the value of the
rootPlacerrecord component
-
minimumSize
Returns the value of theminimumSizerecord component.- Returns:
- the value of the
minimumSizerecord component
-
decorators
Returns the value of thedecoratorsrecord component.- Returns:
- the value of the
decoratorsrecord component
-
ignoreVines
public boolean ignoreVines()Returns the value of theignoreVinesrecord component.- Returns:
- the value of the
ignoreVinesrecord component
-
belowTrunkProvider
Returns the value of thebelowTrunkProviderrecord component.- Returns:
- the value of the
belowTrunkProviderrecord component
-