Interface StructureManager


public interface StructureManager
Entry point to the datapack structures of the server.
Since:
0.1.0
  • Method Details

    • datapacks

      List<Datapack> datapacks()
      Returns:
      the loaded packs, in load order (later packs override earlier ones)
    • templates

      Set<Key> templates()
      Returns:
      every template identifier available
    • template

      Optional<StructureTemplate> template(Key key)
      Loads (or returns the cached) template.
      Parameters:
      key - the template identifier
      Returns:
      the template, empty when unknown or unreadable
    • structures

      Set<Key> structures()
      Returns:
      every jigsaw structure identifier available (worldgen/structure)
    • placeTemplate

      CompletableFuture<Integer> placeTemplate(World world, BlockPos origin, Key template, StructureRotation rotation)
      Pastes a template into a world.
      Parameters:
      world - the target world
      origin - the lowest corner before rotation
      template - the template identifier
      rotation - the rotation to apply around origin
      Returns:
      the number of blocks written, completed once every chunk has been updated
    • placeStructure

      CompletableFuture<Integer> placeStructure(World world, BlockPos position, Key structure)
      Assembles and places a jigsaw structure. The biome filter of the structure is ignored.
      Parameters:
      world - the target world
      position - the block whose chunk hosts the structure start
      structure - the structure identifier
      Returns:
      the number of pieces placed, 0 when the structure could not be assembled
    • locate

      CompletableFuture<Optional<BlockPos>> locate(World world, BlockPos origin, Key structure, int radiusCells)
      Searches the nearest start of a structure that world generation would place.
      Parameters:
      world - the world to search
      origin - the search centre
      structure - the structure identifier
      radiusCells - how many placement cells to scan around the origin
      Returns:
      the start position, or empty when none was found in range
    • reload

      Reads the datapacks again. Chunks generated from now on use the new content; chunks already generated keep what they have.
      Returns:
      completed once the new content is live