Class EnvironmentScanModifier

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

public class EnvironmentScanModifier extends PlacementModifier
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 Details

  • 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:
      getPositions in class PlacementModifier
      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

      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 environment scan modifier.