Class StructureYSpawning

java.lang.Object
com.ryandw11.structure.structure.properties.StructureYSpawning

public class StructureYSpawning extends Object
This handles the SpawnY of a structure.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StructureYSpawning​(String value, org.bukkit.HeightMap heightMap, boolean calculateSpawnYFirst)
    Set the StructureYSpawning with a value.
    StructureYSpawning​(org.bukkit.configuration.file.FileConfiguration fc)
    Get SpawnY from a configuration file.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getHeight​(@Nullable org.bukkit.Location location)
    Get the height from SpawnY value.
    org.bukkit.HeightMap
    Get the SpawnY Height Map.
    org.bukkit.block.Block
    getHighestBlock​(org.bukkit.Location loc)
    Get the highest block at a location according the structure rules.
    Get the raw value of SpawnY.
    boolean
    Get if the structure should calculate SpawnY first.
    boolean
    Get if the HeightMap is set to the Ocean Floor.
    boolean
    Get if the structure should spawn on the top.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StructureYSpawning

      public StructureYSpawning(org.bukkit.configuration.file.FileConfiguration fc)
      Get SpawnY from a configuration file.
      Parameters:
      fc - The file configuration.
    • StructureYSpawning

      public StructureYSpawning(String value, org.bukkit.HeightMap heightMap, boolean calculateSpawnYFirst)
      Set the StructureYSpawning with a value.
      Parameters:
      value - The value of SpawnY.
      heightMap - The height map for the Structure to use to spawn.
      calculateSpawnYFirst - If you want the SpawnY to be calculated before the other checks are completed (ex: block whitelist).
  • Method Details

    • getValue

      public String getValue()
      Get the raw value of SpawnY.
      Returns:
      The raw value of SpawnY.
    • getHeightMap

      public org.bukkit.HeightMap getHeightMap()
      Get the SpawnY Height Map.
      Returns:
      The SpawnY Height Map.
    • isTop

      public boolean isTop()
      Get if the structure should spawn on the top.

      As of 1.6.0, This will be true when spawning on the ocean floor too.

      Returns:
      If the structure should spawn on the top.
    • isOceanFloor

      public boolean isOceanFloor()
      Get if the HeightMap is set to the Ocean Floor.

      isTop() will also be true if set to spawn directly on the ocean floor.

      Returns:
      If the structure picks a Y value from the Ocean Floor.
    • isCalculateSpawnYFirst

      public boolean isCalculateSpawnYFirst()
      Get if the structure should calculate SpawnY first.
      Returns:
      If the structure should calculate SpawnY first.
    • getHighestBlock

      public org.bukkit.block.Block getHighestBlock(org.bukkit.Location loc)
      Get the highest block at a location according the structure rules.
      Parameters:
      loc - The initial location (Y does not matter).
      Returns:
      The Highest block according to the structure rules for Height Maps.
    • getHeight

      public int getHeight(@Nullable @Nullable org.bukkit.Location location)
      Get the height from SpawnY value.
      Parameters:
      location - The location of the block for the height calculation (This is usually the location of the top block).

      AKA: What Y value top should return.

      If Null is passed in that means it will spawn in the void.

      Returns:
      The height according to the rules of SpawnY.