Record Class MazeBounds

java.lang.Object
java.lang.Record
dev.despical.mazeengine.api.model.MazeBounds
Record Components:
origin - the minimum corner and world identity
width - the positive block count along X
height - the positive block count along Y
depth - the positive block count along Z

public record MazeBounds(MazeLocation origin, int width, int height, int depth) extends Record
Describes an immutable inclusive volume of world blocks.

The origin is the minimum block corner. Each dimension is a block count, so the maximum X coordinate is origin.x() + width - 1; the same rule applies to Y and Z. Maze bounds include the floor and any generated roof.

Construction validates positive dimensions, maximum-coordinate overflow, and a volume representable as a long. It does not require a loaded world or check the world border, build-height limits, or the server's maze-size limits.

  • Constructor Summary

    Constructors
    Constructor
    Description
    MazeBounds(MazeLocation origin, int width, int height, int depth)
    Constructs a block volume with representable coordinates and size.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Tests whether a world block position lies inside this inclusive volume.
    int
    Returns the value of the depth record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    Returns the value of the origin record component.
    final String
    Returns a string representation of this record class.
    long
    Returns the number of blocks contained in this volume.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

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

    • MazeBounds

      public MazeBounds(MazeLocation origin, int width, int height, int depth)
      Constructs a block volume with representable coordinates and size.

      All dimensions must be positive. Inclusive maximum coordinates are checked with exact arithmetic before the volume can be used for containment queries.

      Parameters:
      origin - the minimum world block corner
      width - the block count along X
      height - the block count along Y
      depth - the block count along Z
      Throws:
      NullPointerException - if origin is null
      IllegalArgumentException - if any dimension is nonpositive
      ArithmeticException - if a maximum coordinate or the volume overflows
  • Method Details

    • volume

      public long volume()
      Returns the number of blocks contained in this volume.

      This includes air positions as well as solid blocks. It is the full bounded volume, not the count of structure blocks in a generation plan.

      Returns:
      the product of width, height, and depth
    • contains

      public boolean contains(MazeLocation point)
      Tests whether a world block position lies inside this inclusive volume.

      The point must have the same world UUID and fall within all three coordinate ranges. A position on any minimum or maximum face is included.

      Parameters:
      point - the world block position to test
      Returns:
      true when the world and every coordinate are within the bounds
      Throws:
      NullPointerException - if point is null
    • 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.
    • origin

      public MazeLocation origin()
      Returns the value of the origin record component.
      Returns:
      the value of the origin record component
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • depth

      public int depth()
      Returns the value of the depth record component.
      Returns:
      the value of the depth record component