Package com.ryandw11.structure.structure
Class Structure
java.lang.Object
com.ryandw11.structure.structure.Structure
Represents a complete Structure for the plugin.
This class is read-only and cannot be edited.
The class is organized like the structure configuration files. Everything is sorted into properties.
Use StructureBuilder
to create a new Structure.
Consider using the StructureSection
API to add custom configuration sections to your structures.
You can detect when a structure spawns using StructureSpawnEvent
.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Structure(StructureBuilder builder)
Create a structure from theStructureBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSpawn(@Nullable org.bukkit.block.Block block, @NotNull org.bukkit.Chunk chunk)
Checks to see if the structure can spawn.Get the advanced schematics.double
Get the base rotation of a structure.Get the bottom space fill configuration section.@Nullable String
Get the name of the compiled schematic.Get the map of loot tables containing all types.getLootTables(LootTableType type)
Get the collection of loot tables for a certain loot table type.getName()
Get the name of the structure.int
Get the priority of the structure.int
Get the chance out of number.int
Get the chance number.Get the name of the schematic.Get the source mask properties.Get the structure limitations.Get the structure location properties.Get the structure properties.Get the unmodifiable list of structure sections.Get the (simple) sub schematics.double
Get the rotation of the current sub schematic.Get the target mask properties.boolean
If the schematic is compiled.void
setSubSchemRotation(double rot)
The rotation of the current sub schematic.boolean
spawn(org.bukkit.Location location)
Spawn the schematic at the given location.
-
Constructor Details
-
Structure
Create a structure from theStructureBuilder
.- Parameters:
builder
- The structure builder to use.
-
-
Method Details
-
getName
Get the name of the structure.- Returns:
- The name.
-
getSchematic
Get the name of the schematic.The .schem is included.
- Returns:
- The name of the schematic.
-
getProbabilityNumerator
public int getProbabilityNumerator()Get the chance number.- Returns:
- The chance number.
-
getProbabilityDenominator
public int getProbabilityDenominator()Get the chance out of number.- Returns:
- The chance out of number.
-
getPriority
public int getPriority()Get the priority of the structure.The lower the number, the greater the priority for the structure to spawn when compared to others.
- Returns:
- The priority.
-
isCompiled
public boolean isCompiled()If the schematic is compiled.- Returns:
- If the schematic is compiled.
-
getCompiledSchematic
Get the name of the compiled schematic.Includes the .cschem
- Returns:
- The name of the compiled schematic (null if it is not compiled).
-
getStructureLocation
Get the structure location properties.- Returns:
- The structure location properties.
-
getStructureProperties
Get the structure properties.- Returns:
- The structure properties.
-
getStructureLimitations
Get the structure limitations.- Returns:
- The structure limitations.
-
getSourceMaskProperties
Get the source mask properties.- Returns:
- The source mask properties.
-
getTargetMaskProperties
Get the target mask properties.- Returns:
- The target mask properties.
-
getSubSchematics
Get the (simple) sub schematics.- Returns:
- The sub schematics.
-
getAdvancedSubSchematics
Get the advanced schematics.- Returns:
- The advanced schematics.
-
getBottomSpaceFill
Get the bottom space fill configuration section.- Returns:
- The bottom space fill section.
-
getLootTables
Get the map of loot tables containing all types.- Returns:
- The map of loot tables containing all types.
-
getLootTables
Get the collection of loot tables for a certain loot table type.- Parameters:
type
- The type of loot table to get.- Returns:
- The loot table type.
-
getStructureSections
Get the unmodifiable list of structure sections.- Returns:
- The unmodifiable list of structure sections.
-
getBaseRotation
public double getBaseRotation()Get the base rotation of a structure.- Returns:
- The base rotation. (In Radians).
-
canSpawn
public boolean canSpawn(@Nullable @Nullable org.bukkit.block.Block block, @NotNull @NotNull org.bukkit.Chunk chunk)Checks to see if the structure can spawn.This also checks structure locations.
- Parameters:
block
- The block (Null means it is spawning in the void.)chunk
- The chunk- Returns:
- If the structure can spawn
-
setSubSchemRotation
public void setSubSchemRotation(double rot)The rotation of the current sub schematic.This is for internal use only.
- Parameters:
rot
- The rotation of the sub schematic in radians.
-
getSubSchemRotation
public double getSubSchemRotation()Get the rotation of the current sub schematic.For internal use only.
- Returns:
- The rotation of the current sub schematic in radians.
-
spawn
public boolean spawn(org.bukkit.Location location)Spawn the schematic at the given location.This will not add the structure to the structure database. Call
StructureHandler.putSpawnedStructure(Location, Structure)
to add it after spawning.- Parameters:
location
- The location to spawn it at.- Returns:
- If the structure was spawned successfully.
-