Record Class PlacementContext

java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.world.gen.placement.PlacementContext
Record Components:
level - The world generation access wrapper providing safe world modification.
chunkX - The X coordinate of the chunk being processed.
chunkZ - The Z coordinate of the chunk being processed.
random - The seeded random source for deterministic placement.

public record PlacementContext(WorldGenAccess level, int chunkX, int chunkZ, Random random) extends Record
A record containing context information required during the placement phase.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlacementContext(WorldGenAccess level, int chunkX, int chunkZ, Random random)
    Creates an instance of a PlacementContext record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the chunkX record component.
    int
    Returns the value of the chunkZ record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Retrieves the maximum build height of the current world context.
    int
    Retrieves the minimum build height of the current world context.
    final int
    Returns a hash code value for this object.
    Returns the value of the level record component.
    Returns the value of the random record component.
    org.bukkit.Location
    toLocation(org.bukkit.util.Vector pos)
    Converts a vector position into a Bukkit Location using the world context.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PlacementContext

      public PlacementContext(WorldGenAccess level, int chunkX, int chunkZ, Random random)
      Creates an instance of a PlacementContext record class.
      Parameters:
      level - the value for the level record component
      chunkX - the value for the chunkX record component
      chunkZ - the value for the chunkZ record component
      random - the value for the random record component
  • Method Details

    • getMinBuildHeight

      public int getMinBuildHeight()
      Retrieves the minimum build height of the current world context.
      Returns:
      The minimum build height.
    • getHeight

      public int getHeight()
      Retrieves the maximum build height of the current world context.
      Returns:
      The maximum build height.
    • toLocation

      public org.bukkit.Location toLocation(org.bukkit.util.Vector pos)
      Converts a vector position into a Bukkit Location using the world context.
      Parameters:
      pos - The vector position.
      Returns:
      A standard Bukkit Location.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • level

      public WorldGenAccess level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • chunkX

      public int chunkX()
      Returns the value of the chunkX record component.
      Returns:
      the value of the chunkX record component
    • chunkZ

      public int chunkZ()
      Returns the value of the chunkZ record component.
      Returns:
      the value of the chunkZ record component
    • random

      public Random random()
      Returns the value of the random record component.
      Returns:
      the value of the random record component