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 structural marker holding a serialized entity and its exact relative spatial location. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProcessor(StructureProcessor processor) Appends aStructureProcessorto the placement pipeline.static Structuredeserialize(com.fasterxml.jackson.databind.JsonNode root) Deserializes a completeStructuredefinition from a JSON node tree.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 in a live Bukkit world.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 to prevent server lag.com.fasterxml.jackson.databind.node.ObjectNodeSerializes this entire structure into an optimized JSON node tree.
-
Constructor Details
-
Structure
public Structure()
-
-
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.- 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 to prevent server lag.- Parameters:
plugin- ThePluginutilized for scheduling the Bukkit 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 server tick.- 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 in a live Bukkit world.- 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 the main thread if strictly required.- 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.
-
serialize
public com.fasterxml.jackson.databind.node.ObjectNode serialize()Serializes this entire structure into an optimized JSON node tree.- Returns:
- The serialized Jackson
ObjectNode.
-
deserialize
-