Class IntegrityProcessor

java.lang.Object
com.github.darksoulq.abyssallib.world.structure.processor.StructureProcessor
com.github.darksoulq.abyssallib.world.structure.processor.impl.IntegrityProcessor

public class IntegrityProcessor extends StructureProcessor
A structure processor that applies a chance-based filter to block placement.

This processor mimics the "Integrity" setting found in vanilla Minecraft structure blocks. For each block in the structure, a random roll is performed; if the roll exceeds the integrity value, the block is skipped (returned as null), creating a decayed or eroded effect.

  • Field Details

    • CODEC

      public static final Codec<IntegrityProcessor> CODEC
      The codec used for serializing and deserializing the integrity processor.

      It handles the "integrity" float field, which represents the placement probability between 0.0 and 1.0.

    • TYPE

      public static final StructureProcessorType<IntegrityProcessor> TYPE
      The registered type definition for the integrity structure processor.
  • Constructor Details

    • IntegrityProcessor

      public IntegrityProcessor(float integrity)
      Constructs a new IntegrityProcessor.
      Parameters:
      integrity - The placement chance. 1.0 means all blocks place; 0.5 means half are skipped.
  • Method Details

    • process

      public BlockInfo process(org.bukkit.World world, org.bukkit.Location origin, BlockInfo current, BlockInfo original)
      Processes a block placement in a standard world context.

      Performs a random float check against the integrity threshold.

      Specified by:
      process in class StructureProcessor
      Parameters:
      world - The Bukkit world.
      origin - The structure origin.
      current - The current BlockInfo.
      original - The original BlockInfo.
      Returns:
      The current block info if the check passes, or null to skip placement.
    • process

      public BlockInfo process(WorldGenAccess level, org.bukkit.Location origin, BlockInfo current, BlockInfo original)
      Processes a block placement in a world generation context.

      Performs a random float check against the integrity threshold.

      Specified by:
      process in class StructureProcessor
      Parameters:
      level - The generation accessor.
      origin - The structure origin.
      current - The current BlockInfo.
      original - The original BlockInfo.
      Returns:
      The current block info if the check passes, or null to skip placement.
    • getType

      public StructureProcessorType<?> getType()
      Retrieves the specific type definition for this processor.
      Specified by:
      getType in class StructureProcessor
      Returns:
      The StructureProcessorType associated with IntegrityProcessor.