Class RandomOffsetModifier
java.lang.Object
com.github.darksoulq.abyssallib.world.gen.placement.PlacementModifier
com.github.darksoulq.abyssallib.world.gen.placement.modifier.RandomOffsetModifier
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<RandomOffsetModifier> The codec used for serializing and deserializing the random offset modifier.static final PlacementModifierType<RandomOffsetModifier> The registered type definition for the random offset placement modifier. -
Constructor Summary
ConstructorsConstructorDescriptionRandomOffsetModifier(int xzSpread, int ySpread) Constructs a new RandomOffsetModifier. -
Method Summary
Modifier and TypeMethodDescriptionStream<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.getType()Retrieves the specific type definition for this modifier.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the random offset modifier. -
TYPE
The registered type definition for the random offset placement modifier.
-
-
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:
getPositionsin classPlacementModifier- 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
Retrieves the specific type definition for this modifier.- Specified by:
getTypein classPlacementModifier- Returns:
- The placement modifier type associated with this random offset modifier.
-