Class EnvironmentScanModifier
java.lang.Object
com.github.darksoulq.abyssallib.world.gen.placement.PlacementModifier
com.github.darksoulq.abyssallib.world.gen.placement.modifier.EnvironmentScanModifier
A placement modifier that performs a vertical scan to find the nearest solid surface.
This modifier iterates vertically from the input position, searching for a solid block. Depending on the configuration, it can scan upwards to find a ceiling or downwards to find a floor, adjusting the final placement vector to sit perfectly on or under that discovered surface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<EnvironmentScanModifier> The codec used for serializing and deserializing the environment scan modifier.static final PlacementModifierType<EnvironmentScanModifier> The registered type definition for the environment scan placement modifier. -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentScanModifier(int maxSteps, boolean up) Constructs a new EnvironmentScanModifier. -
Method Summary
Modifier and TypeMethodDescriptionStream<org.bukkit.util.Vector> getPositions(PlacementContext context, Stream<org.bukkit.util.Vector> positions) Maps each input position to the nearest empty space adjacent to a solid surface.getType()Retrieves the specific type definition for this modifier.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the environment scan modifier. -
TYPE
The registered type definition for the environment scan placement modifier.
-
-
Constructor Details
-
EnvironmentScanModifier
public EnvironmentScanModifier(int maxSteps, boolean up) Constructs a new EnvironmentScanModifier.- Parameters:
maxSteps- The maximum range of the vertical scan.up- True to find a ceiling, false to find a floor.
-
-
Method Details
-
getPositions
public Stream<org.bukkit.util.Vector> getPositions(PlacementContext context, Stream<org.bukkit.util.Vector> positions) Maps each input position to the nearest empty space adjacent to a solid surface.The method iterates through the Y-axis starting at the input coordinate. If a solid block is encountered within the scanning range, the position is updated. If the scan is upward, it returns the position of the air block immediately below the ceiling. If downward, it returns the position immediately above the floor.
- Specified by:
getPositionsin classPlacementModifier- Parameters:
context- The current placement context providing world bounds and data.positions- The incoming stream of potential placement vectors.- Returns:
- A stream of vectors adjusted to the discovered surfaces.
-
getType
Retrieves the specific type definition for this modifier.- Specified by:
getTypein classPlacementModifier- Returns:
- The placement modifier type associated with this environment scan modifier.
-