Class Structure

java.lang.Object
com.ryandw11.structure.structure.Structure

public class Structure extends Object
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 Details

    • Structure

      protected Structure(StructureBuilder builder)
      Create a structure from the StructureBuilder.
      Parameters:
      builder - The structure builder to use.
  • Method Details

    • getName

      public String getName()
      Get the name of the structure.
      Returns:
      The name.
    • getSchematic

      public String 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

      @Nullable public @Nullable String 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

      public StructureLocation getStructureLocation()
      Get the structure location properties.
      Returns:
      The structure location properties.
    • getStructureProperties

      public StructureProperties getStructureProperties()
      Get the structure properties.
      Returns:
      The structure properties.
    • getStructureLimitations

      public StructureLimitations getStructureLimitations()
      Get the structure limitations.
      Returns:
      The structure limitations.
    • getSourceMaskProperties

      public MaskProperty getSourceMaskProperties()
      Get the source mask properties.
      Returns:
      The source mask properties.
    • getTargetMaskProperties

      public MaskProperty getTargetMaskProperties()
      Get the target mask properties.
      Returns:
      The target mask properties.
    • getSubSchematics

      public SubSchematics getSubSchematics()
      Get the (simple) sub schematics.
      Returns:
      The sub schematics.
    • getAdvancedSubSchematics

      public AdvancedSubSchematics getAdvancedSubSchematics()
      Get the advanced schematics.
      Returns:
      The advanced schematics.
    • getBottomSpaceFill

      public BottomSpaceFill getBottomSpaceFill()
      Get the bottom space fill configuration section.
      Returns:
      The bottom space fill section.
    • getLootTables

      public Map<LootTableType,​RandomCollection<LootTable>> getLootTables()
      Get the map of loot tables containing all types.
      Returns:
      The map of loot tables containing all types.
    • getLootTables

      public RandomCollection<LootTable> getLootTables(LootTableType type)
      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

      public List<StructureSection> 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.