Class RandomSpreadFoliagePlacer
java.lang.Object
com.github.darksoulq.abyssallib.world.gen.feature.tree.foliage.FoliagePlacer
com.github.darksoulq.abyssallib.world.gen.feature.tree.foliage.RandomSpreadFoliagePlacer
A foliage placer that scatters individual leaf blocks randomly within a bounding area.
Instead of creating solid blobs, this algorithm attempts a configured number of placements within the defined radius and height. This is highly effective for creating sparse, wispy trees, dead trees covered in cobwebs, or irregular swamp canopies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<RandomSpreadFoliagePlacer> The codec used for serializing and deserializing the random spread foliage placer.static final FoliagePlacerType<RandomSpreadFoliagePlacer> The registered type definition for the random spread foliage placer. -
Constructor Summary
ConstructorsConstructorDescriptionRandomSpreadFoliagePlacer(int height, int attempts) Constructs a new RandomSpreadFoliagePlacer. -
Method Summary
Modifier and TypeMethodDescriptiongetType()Retrieves the specific type definition for this foliage placer.voidplaceFoliage(WorldGenAccess level, Random random, org.bukkit.Location attachmentPoint, BlockStateProvider foliageProvider, int radius) Scatters leaf blocks randomly within the horizontal radius and vertical height bounds.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the random spread foliage placer. -
TYPE
The registered type definition for the random spread foliage placer.
-
-
Constructor Details
-
RandomSpreadFoliagePlacer
public RandomSpreadFoliagePlacer(int height, int attempts) Constructs a new RandomSpreadFoliagePlacer.- Parameters:
height- The maximum depth below the attachment point.attempts- The total number of blocks to attempt to place in the radius.
-
-
Method Details
-
placeFoliage
public void placeFoliage(WorldGenAccess level, Random random, org.bukkit.Location attachmentPoint, BlockStateProvider foliageProvider, int radius) Scatters leaf blocks randomly within the horizontal radius and vertical height bounds.- Specified by:
placeFoliagein classFoliagePlacer- Parameters:
level- The world generation accessor.random- The deterministic random source.attachmentPoint- The central origin of the scatter operation.foliageProvider- The block state provider for the leaf material.radius- The maximum horizontal boundary on the X and Z axes.
-
getType
Retrieves the specific type definition for this foliage placer.- Specified by:
getTypein classFoliagePlacer- Returns:
- The foliage placer type associated with this instance.
-