Class RandomOffsetModifier

java.lang.Object
com.github.darksoulq.abyssallib.world.gen.placement.PlacementModifier
com.github.darksoulq.abyssallib.world.gen.placement.modifier.RandomOffsetModifier

public class RandomOffsetModifier extends PlacementModifier
A placement modifier that slightly shifts the incoming position randomly along all three axes based on the defined spread values.

This is commonly used in conjunction with the InSquareModifier to add vertical or localized horizontal scattering to features.

  • Field Details

  • Constructor Details

    • RandomOffsetModifier

      public RandomOffsetModifier(int xzSpread, int ySpread)
      Constructs a new RandomOffsetModifier.
      Parameters:
      xzSpread - The bounds for X and Z coordinate randomization.
      ySpread - The bounds for Y coordinate randomization.
  • Method Details

    • getPositions

      public Stream<org.bukkit.util.Vector> getPositions(PlacementContext context, Stream<org.bukkit.util.Vector> positions)
      Shifts each incoming position by a random amount within the configured spread bounds.
      Specified by:
      getPositions in class PlacementModifier
      Parameters:
      context - The current placement context.
      positions - The incoming stream of potential placement vectors.
      Returns:
      A stream of vectors shifted by the random offsets.
    • getType

      public PlacementModifierType<?> getType()
      Retrieves the specific type definition for this modifier.
      Specified by:
      getType in class PlacementModifier
      Returns:
      The placement modifier type associated with this random offset modifier.