public abstract class FoliagePlacer extends Object implements DynamicSerializable
Modifier and Type | Field and Description |
---|---|
protected int |
offset |
protected int |
radius |
protected int |
randomOffset |
protected int |
randomRadius |
protected FoliagePlacerType<?> |
type |
Constructor and Description |
---|
FoliagePlacer(int radius,
int randomRadius,
int offset,
int randomOffset,
FoliagePlacerType<?> type) |
Modifier and Type | Method and Description |
---|---|
protected void |
generate(ModifiableTestableWorld world,
Random random,
BranchedTreeFeatureConfig config,
BlockPos pos,
int baseHeight,
int y,
int radius,
Set<BlockPos> leaves) |
abstract void |
generate(ModifiableTestableWorld world,
Random random,
BranchedTreeFeatureConfig config,
int trunkHeight,
BlockPos pos,
int foliageHeight,
int radius,
Set<BlockPos> leaves)
This is the main method used to generate foliage.
|
abstract int |
getHeight(Random random,
int trunkHeight) |
abstract int |
getRadius(Random random,
int baseHeight,
BranchedTreeFeatureConfig config) |
abstract int |
getRadiusForPlacement(int trunkHeight,
int baseHeight,
int radius)
This method is used to ensure that a tree can place foliage when it generates.
|
protected abstract boolean |
isInvalidForLeaves(Random random,
int baseHeight,
int dx,
int dy,
int dz,
int radius) |
protected void |
placeLeaves(ModifiableTestableWorld world,
Random random,
BlockPos pos,
BranchedTreeFeatureConfig config,
Set<BlockPos> leaves) |
<T> T |
serialize(com.mojang.datafixers.types.DynamicOps<T> ops) |
protected final int radius
protected final int randomRadius
protected final int offset
protected final int randomOffset
protected final FoliagePlacerType<?> type
public FoliagePlacer(int radius, int randomRadius, int offset, int randomOffset, FoliagePlacerType<?> type)
public abstract void generate(ModifiableTestableWorld world, Random random, BranchedTreeFeatureConfig config, int trunkHeight, BlockPos pos, int foliageHeight, int radius, Set<BlockPos> leaves)
public abstract int getHeight(Random random, int trunkHeight)
public abstract int getRadius(Random random, int baseHeight, BranchedTreeFeatureConfig config)
protected abstract boolean isInvalidForLeaves(Random random, int baseHeight, int dx, int dy, int dz, int radius)
public abstract int getRadiusForPlacement(int trunkHeight, int baseHeight, int radius)
It runs for every y-level of the tree being generated.
trunkHeight
- the height of the trunkbaseHeight
- the height of the full treeradius
- the radius of the foliageprotected void generate(ModifiableTestableWorld world, Random random, BranchedTreeFeatureConfig config, BlockPos pos, int baseHeight, int y, int radius, Set<BlockPos> leaves)
protected void placeLeaves(ModifiableTestableWorld world, Random random, BlockPos pos, BranchedTreeFeatureConfig config, Set<BlockPos> leaves)
public <T> T serialize(com.mojang.datafixers.types.DynamicOps<T> ops)
serialize
in interface DynamicSerializable