Class Structure
java.lang.Object
com.github.darksoulq.abyssallib.world.structure.Structure
Represents a fully captured, transformable, and replayable structure definition.
This implementation supports palette-based block storage for deduplication,
relative positioning for blocks and entities, transformation via rotations and
mirrors, and both synchronous and asynchronous placement routines.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA lightweight data record describing a unique combination of block type and properties.static final recordA structural marker indicating the position and index configuration of a discrete block.static final recordA structural marker holding a serialized entity and its exact relative spatial location. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<Structure.PaletteEntry> static final Codec<Structure.StructureBlock> static final Codec<Structure.StructureEntity> -
Constructor Summary
ConstructorsConstructorDescriptionStructure(org.bukkit.util.Vector size, List<Structure.PaletteEntry> palette, List<Structure.StructureBlock> blocks, List<Structure.StructureEntity> entities) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProcessor(StructureProcessor processor) Appends aStructureProcessorto the placement pipeline.voidfill(@NotNull org.bukkit.Location corner1, @NotNull org.bukkit.Location corner2, @NotNull org.bukkit.Location origin) Captures all blocks within the defined region, excluding entities.voidfill(@NotNull org.bukkit.Location corner1, @NotNull org.bukkit.Location corner2, @NotNull org.bukkit.Location origin, boolean includeEntities) Captures blocks and optionally entities within the defined physical region.voidplace(@NotNull WorldGenAccess level, @NotNull org.bukkit.Location origin, @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull org.bukkit.block.structure.Mirror mirror, float integrity) Places this structure inside an asynchronous or virtualWorldGenAccesscontext.voidplace(@NotNull org.bukkit.Location origin, @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull org.bukkit.block.structure.Mirror mirror, float integrity) Places this structure synchronously targeting regional thread execution requirements seamlessly.placeAsync(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.Location origin, @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull org.bukkit.block.structure.Mirror mirror, float integrity, int blocksPerTick) Places this structure asynchronously using a scheduled repeating task securely evaluating regional boundaries.
-
Field Details
-
PALETTE_ENTRY_CODEC
-
STRUCTURE_BLOCK_CODEC
-
STRUCTURE_ENTITY_CODEC
-
CODEC
-
-
Constructor Details
-
Structure
public Structure() -
Structure
public Structure(org.bukkit.util.Vector size, List<Structure.PaletteEntry> palette, List<Structure.StructureBlock> blocks, List<Structure.StructureEntity> entities)
-
-
Method Details
-
fill
public void fill(@NotNull @NotNull org.bukkit.Location corner1, @NotNull @NotNull org.bukkit.Location corner2, @NotNull @NotNull org.bukkit.Location origin) Captures all blocks within the defined region, excluding entities.- Parameters:
corner1- The first cornerLocationbounding the region.corner2- The opposite cornerLocationbounding the region.origin- The designated originLocationutilized for relative positioning.
-
fill
public void fill(@NotNull @NotNull org.bukkit.Location corner1, @NotNull @NotNull org.bukkit.Location corner2, @NotNull @NotNull org.bukkit.Location origin, boolean includeEntities) Captures blocks and optionally entities within the defined physical region. Regional processor dynamically executes chunk-safe block mapping on Folia or Bukkit.- Parameters:
corner1- The first cornerLocationbounding the region.corner2- The opposite cornerLocationbounding the region.origin- The originLocationused for zero-point relative alignment.includeEntities- True if entities within the bounding box should be captured and serialized.
-
placeAsync
public CompletableFuture<Void> placeAsync(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.Location origin, @NotNull @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull @NotNull org.bukkit.block.structure.Mirror mirror, float integrity, int blocksPerTick) Places this structure asynchronously using a scheduled repeating task securely evaluating regional boundaries.- Parameters:
plugin- ThePluginutilized for scheduling the task.origin- The target placement originLocation.rotation- TheStructureRotationto apply.mirror- TheMirrortransformation to apply.integrity- The survival chance [0.0 - 1.0] for each individual block.blocksPerTick- The maximum number of blocks to process per execution slice.- Returns:
- A
CompletableFuturethat resolves when the entire placement operation completes.
-
place
public void place(@NotNull @NotNull org.bukkit.Location origin, @NotNull @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull @NotNull org.bukkit.block.structure.Mirror mirror, float integrity) Places this structure synchronously targeting regional thread execution requirements seamlessly.- Parameters:
origin- The target placement originLocation.rotation- TheStructureRotationto apply.mirror- TheMirrortransformation to apply.integrity- The survival chance [0.0 - 1.0] for each individual block.
-
place
public void place(@NotNull @NotNull WorldGenAccess level, @NotNull @NotNull org.bukkit.Location origin, @NotNull @NotNull org.bukkit.block.structure.StructureRotation rotation, @NotNull @NotNull org.bukkit.block.structure.Mirror mirror, float integrity) Places this structure inside an asynchronous or virtualWorldGenAccesscontext. Handles deferring out-of-bounds placements back to regional scheduled executions explicitly ensuring safe completion.- Parameters:
level- TheWorldGenAccessbridging chunk generation.origin- The target placement originLocation.rotation- TheStructureRotationto apply.mirror- TheMirrortransformation to apply.integrity- The survival chance [0.0 - 1.0] for each individual block.
-
addProcessor
Appends aStructureProcessorto the placement pipeline.- Parameters:
processor- TheStructureProcessorto add.
-