Package redempt.redlib.multiblock
Class Structure
java.lang.Object
redempt.redlib.multiblock.Structure
Represents an instance of a multi-block structure in the world
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a block in a Structure instance -
Constructor Summary
ModifierConstructorDescriptionprotected
Structure
(MultiBlockStructure type, org.bukkit.Location loc, Rotator rotator) -
Method Summary
Modifier and TypeMethodDescriptiongetBlock
(org.bukkit.block.Block block) Gets a relative block in this Structure from an absolute block in the worldGet all blocks in this StructuregetByType
(org.bukkit.Material type) Gets all blocks of the given type in this Structureorg.bukkit.Location
Gets the location of this structure (will be a corner)Gets the region this Structure occupiesgetRelative
(int x, int y, int z) Gets a relative block in this StructureGets the rotation of this structure.getType()
Gets the type of this structureboolean
isIntact()
Checks whether this Structure is intact (in the same rotation and has all the correct blocks)
-
Constructor Details
-
Structure
-
-
Method Details
-
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
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
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
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
Gets the region this Structure occupies- Returns:
- The region this Structure occupies
-
getRelative
Gets a relative block in this Structure- Parameters:
x
- The relative X of the blocky
- The relative Y of the blockz
- 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
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
-