Record Class FallenTreeFeature
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.feature.FallenTreeFeature
- All Implemented Interfaces:
Feature
public record FallenTreeFeature(Holder<BlockStateProvider> trunkProvider, IntProvider logLength, List<TreeDecorator> stumpDecorators, List<TreeDecorator> logDecorators)
extends Record
implements Feature
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<FallenTreeFeature> private static final intprivate static final intprivate static final intprivate final List<TreeDecorator> The field for thelogDecoratorsrecord component.private final IntProviderThe field for thelogLengthrecord component.private static final intprivate static final intprivate final List<TreeDecorator> The field for thestumpDecoratorsrecord component.private final Holder<BlockStateProvider> The field for thetrunkProviderrecord component.Fields inherited from interface Feature
DIRECT_CODEC, LIST_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionFallenTreeFeature(Holder<BlockStateProvider> trunkProvider, IntProvider logLength, List<TreeDecorator> stumpDecorators, List<TreeDecorator> logDecorators) Creates an instance of aFallenTreeFeaturerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic FallenTreeFeature.Builderbuilder(BlockStateProvider trunkProvider, IntProvider logLength) private booleancanPlaceEntireFallenLog(WorldGenLevel level, int logLength, BlockPos.MutableBlockPos logStartPos, Direction direction) com.mojang.serialization.MapCodec<FallenTreeFeature> codec()private voiddecorateLogs(WorldGenLevel level, RandomSource random, Set<BlockPos> logs, List<TreeDecorator> decorators) final booleanIndicates whether some other object is "equal to" this one.private BiConsumer<BlockPos, BlockState> getDecorationSetter(WorldGenLevel level) private static Function<BlockState, BlockState> getSidewaysStateModifier(Direction direction) final inthashCode()Returns a hash code value for this object.private booleanisOverSolidGround(LevelAccessor level, BlockPos blockPos) Returns the value of thelogDecoratorsrecord component.Returns the value of thelogLengthrecord component.private booleanmayPlaceOn(LevelAccessor level, BlockPos blockPos) booleanplace(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) private voidplaceFallenLog(WorldGenLevel level, RandomSource random, int logLength, BlockPos.MutableBlockPos logStartPos, Direction direction) private voidplaceFallenTree(BlockPos origin, WorldGenLevel level, RandomSource random) private BlockPosplaceLogBlock(WorldGenLevel level, RandomSource random, BlockPos.MutableBlockPos blockPos, Function<BlockState, BlockState> sidewaysStateModifier) private voidplaceStump(WorldGenLevel level, RandomSource random, BlockPos.MutableBlockPos stumpPos) private voidsetGroundHeightForFallenLogStartPos(WorldGenLevel level, BlockPos.MutableBlockPos logStartPos) Returns the value of thestumpDecoratorsrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetrunkProviderrecord component.Methods inherited from interface Feature
getSubFeatures, markAboveForPostProcessing, safeSetBlock, setBlock
-
Field Details
-
trunkProvider
The field for thetrunkProviderrecord component. -
logLength
The field for thelogLengthrecord component. -
stumpDecorators
The field for thestumpDecoratorsrecord component. -
logDecorators
The field for thelogDecoratorsrecord component. -
STUMP_HEIGHT
private static final int STUMP_HEIGHT- See Also:
-
STUMP_HEIGHT_PLUS_EMPTY_SPACE
private static final int STUMP_HEIGHT_PLUS_EMPTY_SPACE- See Also:
-
FALLEN_LOG_MAX_FALL_HEIGHT_TO_GROUND
private static final int FALLEN_LOG_MAX_FALL_HEIGHT_TO_GROUND- See Also:
-
FALLEN_LOG_MAX_GROUND_GAP
private static final int FALLEN_LOG_MAX_GROUND_GAP- See Also:
-
FALLEN_LOG_MAX_SPACE_FROM_STUMP
private static final int FALLEN_LOG_MAX_SPACE_FROM_STUMP- See Also:
-
CODEC
-
-
Constructor Details
-
FallenTreeFeature
public FallenTreeFeature(Holder<BlockStateProvider> trunkProvider, IntProvider logLength, List<TreeDecorator> stumpDecorators, List<TreeDecorator> logDecorators) Creates an instance of aFallenTreeFeaturerecord class.- Parameters:
trunkProvider- the value for thetrunkProviderrecord componentlogLength- the value for thelogLengthrecord componentstumpDecorators- the value for thestumpDecoratorsrecord componentlogDecorators- the value for thelogDecoratorsrecord component
-
-
Method Details
-
codec
-
place
public boolean place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) -
placeFallenTree
-
setGroundHeightForFallenLogStartPos
private void setGroundHeightForFallenLogStartPos(WorldGenLevel level, BlockPos.MutableBlockPos logStartPos) -
placeStump
private void placeStump(WorldGenLevel level, RandomSource random, BlockPos.MutableBlockPos stumpPos) -
canPlaceEntireFallenLog
private boolean canPlaceEntireFallenLog(WorldGenLevel level, int logLength, BlockPos.MutableBlockPos logStartPos, Direction direction) -
placeFallenLog
private void placeFallenLog(WorldGenLevel level, RandomSource random, int logLength, BlockPos.MutableBlockPos logStartPos, Direction direction) -
mayPlaceOn
-
isOverSolidGround
-
placeLogBlock
private BlockPos placeLogBlock(WorldGenLevel level, RandomSource random, BlockPos.MutableBlockPos blockPos, Function<BlockState, BlockState> sidewaysStateModifier) -
decorateLogs
private void decorateLogs(WorldGenLevel level, RandomSource random, Set<BlockPos> logs, List<TreeDecorator> decorators) -
getDecorationSetter
-
getSidewaysStateModifier
-
builder
public static FallenTreeFeature.Builder builder(BlockStateProvider trunkProvider, IntProvider logLength) -
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. All components in this record class are compared withObjects::equals(Object,Object). -
trunkProvider
Returns the value of thetrunkProviderrecord component.- Returns:
- the value of the
trunkProviderrecord component
-
logLength
Returns the value of thelogLengthrecord component.- Returns:
- the value of the
logLengthrecord component
-
stumpDecorators
Returns the value of thestumpDecoratorsrecord component.- Returns:
- the value of the
stumpDecoratorsrecord component
-
logDecorators
Returns the value of thelogDecoratorsrecord component.- Returns:
- the value of the
logDecoratorsrecord component
-