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

public class RandomSpreadFoliagePlacer extends FoliagePlacer
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 Details

  • 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:
      placeFoliage in class FoliagePlacer
      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

      public FoliagePlacerType<?> getType()
      Retrieves the specific type definition for this foliage placer.
      Specified by:
      getType in class FoliagePlacer
      Returns:
      The foliage placer type associated with this instance.