Class Structure

java.lang.Object
com.github.darksoulq.abyssallib.world.structure.Structure

public class Structure extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static final record 
    A structural marker holding a serialized entity and its exact relative spatial location.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends a StructureProcessor to the placement pipeline.
    static Structure
    deserialize(com.fasterxml.jackson.databind.JsonNode root)
    Deserializes a complete Structure definition from a JSON node tree.
    void
    fill(@NotNull org.bukkit.Location corner1, @NotNull org.bukkit.Location corner2, @NotNull org.bukkit.Location origin)
    Captures all blocks within the defined region, excluding entities.
    void
    fill(@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.
    void
    place(@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 virtual WorldGenAccess context.
    void
    place(@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.ObjectNode
    Serializes this entire structure into an optimized JSON node tree.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 corner Location bounding the region.
      corner2 - The opposite corner Location bounding the region.
      origin - The designated origin Location utilized 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 corner Location bounding the region.
      corner2 - The opposite corner Location bounding the region.
      origin - The origin Location used 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 - The Plugin utilized for scheduling the Bukkit task.
      origin - The target placement origin Location.
      rotation - The StructureRotation to apply.
      mirror - The Mirror transformation 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 CompletableFuture that 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 origin Location.
      rotation - The StructureRotation to apply.
      mirror - The Mirror transformation 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 virtual WorldGenAccess context. Handles deferring out-of-bounds placements back to the main thread if strictly required.
      Parameters:
      level - The WorldGenAccess bridging chunk generation.
      origin - The target placement origin Location.
      rotation - The StructureRotation to apply.
      mirror - The Mirror transformation to apply.
      integrity - The survival chance [0.0 - 1.0] for each individual block.
    • addProcessor

      public void addProcessor(StructureProcessor processor)
      Appends a StructureProcessor to the placement pipeline.
      Parameters:
      processor - The StructureProcessor to 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

      public static Structure deserialize(com.fasterxml.jackson.databind.JsonNode root)
      Deserializes a complete Structure definition from a JSON node tree.
      Parameters:
      root - The parsed root JsonNode generated by Jackson.
      Returns:
      The reconstructed Structure instance.