Class Structure

java.lang.Object
redempt.redlib.multiblock.Structure

public class Structure extends Object
Represents an instance of a multi-block structure in the world
  • Constructor Details

  • Method Details

    • getType

      public MultiBlockStructure getType()
      Gets the type of this structure
      Returns:
      The type of this structure
    • getLocation

      public org.bukkit.Location getLocation()
      Gets the location of this structure (will be a corner)
      Returns:
      The location of this structure
    • getRotator

      public Rotator getRotator()
      Gets the rotation of this structure. Will be a number between 0 and 3. Represents how many 90-degree clockwise rotations would be needed to rotate the original multi-block structure this structure is based on to get to its current rotation.
      Returns:
      The rotation of this structure
    • getByType

      public List<Structure.StructureBlock> getByType(org.bukkit.Material type)
      Gets all blocks of the given type in this Structure
      Parameters:
      type - The type to check for
      Returns:
      The list of blocks in this Structure of that type
    • getBlocks

      public List<Structure.StructureBlock> getBlocks()
      Get all blocks in this Structure
      Returns:
      The list of blocks in this Structure
    • isIntact

      public boolean isIntact()
      Checks whether this Structure is intact (in the same rotation and has all the correct blocks)
      Returns:
      Whether this Structure is intact
    • getRegion

      public CuboidRegion getRegion()
      Gets the region this Structure occupies
      Returns:
      The region this Structure occupies
    • getRelative

      public Structure.StructureBlock getRelative(int x, int y, int z)
      Gets a relative block in this Structure
      Parameters:
      x - The relative X of the block
      y - The relative Y of the block
      z - The relative Z of the block
      Returns:
      The relative block
      Throws:
      IndexOutOfBoundsException - if the specified coordinates are not within the bounds of this Structure
    • getBlock

      public Structure.StructureBlock getBlock(org.bukkit.block.Block block)
      Gets a relative block in this Structure from an absolute block in the world
      Parameters:
      block - The absolute block which is part of this Structure
      Returns:
      The relative block
      Throws:
      IllegalArgumentException - if the specified block is not within the bounds of this Structure