Class PoplarFoliagePlacer
java.lang.Object
net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer
net.minecraft.world.level.levelgen.feature.foliageplacers.PoplarFoliagePlacer
-
Nested Class Summary
Nested classes/interfaces inherited from class FoliagePlacer
FoliagePlacer.FoliageAttachment, FoliagePlacer.FoliageSetter -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PoplarFoliagePlacer> private final IntProviderprivate final floatFields inherited from class FoliagePlacer
offset, radius -
Constructor Summary
ConstructorsConstructorDescriptionPoplarFoliagePlacer(IntProvider radius, IntProvider offset, IntProvider height, float sideHoleChance) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateFoliage(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, int treeHeight, FoliagePlacer.FoliageAttachment foliageAttachment, int foliageHeight, int leafRadius, int offset) intfoliageHeight(RandomSource random, int treeHeight, TreeFeature tree) private intgetCornerBlocksToCutForRhombusShape(int dx, int dz, int currentRadius, boolean shouldRowBePartialRhombusShape, boolean flipRhombusShape) private static Function<BlockState, BlockState> getSidewaysStateModifier(Direction branchDirection) private static booleanisLeftLowerCornerOrRightTopCorner(int dx, int dz) private static booleanisLeftTopCornerOrRightLowerCorner(int dx, int dz) private static booleanisWithinRhombusShape(int currentRadius, int absDx, int absDz, int cornerBlocksToCutForRhombusShape, int additionalSideRemoval) private voidplaceLeavesRow(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, BlockPos origin, int currentRadius, int y, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) private voidreplaceLeavesWithLog(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, TreeFeature tree, RandomSource random, BlockPos origin, int currentRadius, int y, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) private booleanshouldRowBePartialRhombusShape(int foliageHeight, int y) protected booleanshouldSkipLocation(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk) private booleanshouldSkipLocation(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) protected booleanshouldSkipLocationSigned(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk) private static voidtryPlaceLog(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, BlockPos pos, Function<BlockState, BlockState> stateModifier) protected FoliagePlacerType<?> type()Methods inherited from class FoliagePlacer
createFoliage, foliagePlacerParts, foliageRadius, placeLeavesRow, placeLeavesRowWithHangingLeavesBelow, tryPlaceLeaf
-
Field Details
-
CODEC
-
height
-
sideHoleChance
private final float sideHoleChance
-
-
Constructor Details
-
PoplarFoliagePlacer
public PoplarFoliagePlacer(IntProvider radius, IntProvider offset, IntProvider height, float sideHoleChance)
-
-
Method Details
-
type
- Specified by:
typein classFoliagePlacer
-
createFoliage
protected void createFoliage(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, int treeHeight, FoliagePlacer.FoliageAttachment foliageAttachment, int foliageHeight, int leafRadius, int offset) - Specified by:
createFoliagein classFoliagePlacer
-
replaceLeavesWithLog
private void replaceLeavesWithLog(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, TreeFeature tree, RandomSource random, BlockPos origin, int currentRadius, int y, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) -
tryPlaceLog
private static void tryPlaceLog(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, BlockPos pos, Function<BlockState, BlockState> stateModifier) -
getSidewaysStateModifier
-
foliageHeight
- Specified by:
foliageHeightin classFoliagePlacer
-
placeLeavesRow
private void placeLeavesRow(WorldGenLevel level, FoliagePlacer.FoliageSetter foliageSetter, RandomSource random, TreeFeature tree, BlockPos origin, int currentRadius, int y, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) -
shouldSkipLocation
private boolean shouldSkipLocation(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk, int foliageHeight, boolean flipRhombusShape) -
shouldSkipLocationSigned
protected boolean shouldSkipLocationSigned(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk) - Overrides:
shouldSkipLocationSignedin classFoliagePlacer
-
shouldSkipLocation
protected boolean shouldSkipLocation(RandomSource random, int dx, int y, int dz, int currentRadius, boolean doubleTrunk) - Specified by:
shouldSkipLocationin classFoliagePlacer
-
getCornerBlocksToCutForRhombusShape
private int getCornerBlocksToCutForRhombusShape(int dx, int dz, int currentRadius, boolean shouldRowBePartialRhombusShape, boolean flipRhombusShape) -
isWithinRhombusShape
private static boolean isWithinRhombusShape(int currentRadius, int absDx, int absDz, int cornerBlocksToCutForRhombusShape, int additionalSideRemoval) -
isLeftLowerCornerOrRightTopCorner
private static boolean isLeftLowerCornerOrRightTopCorner(int dx, int dz) -
isLeftTopCornerOrRightLowerCorner
private static boolean isLeftTopCornerOrRightLowerCorner(int dx, int dz) -
shouldRowBePartialRhombusShape
private boolean shouldRowBePartialRhombusShape(int foliageHeight, int y)
-