Interface ColumnPosition


public sealed interface ColumnPosition
An immutable pair of block X and Z coordinates, pointing at a column of blocks.
Since:
0.1.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    atY(int y)
    Gets the block of this column at the given height.
    default ChunkPos
    Gets the position of the chunk containing this column.
    default int
    Gets the X coordinate of the chunk containing this column.
    default int
    Gets the Z coordinate of the chunk containing this column.
    column(int x, int z)
    Creates a column position at the given coordinates.
    offset(int x, int z)
    Moves this column along both axes.
    offsetX(int x)
    Moves this column along the X axis.
    offsetZ(int z)
    Moves this column along the Z axis.
    with(int x, int z)
    Copies this column with different coordinates.
    withX(int x)
    Copies this column with a different X coordinate.
    withZ(int z)
    Copies this column with a different Z coordinate.
    int
    x()
    Gets the X coordinate of this column.
    int
    z()
    Gets the Z coordinate of this column.
  • Method Details

    • column

      @Contract(value="_, _ -> new", pure=true) static ColumnPosition column(int x, int z)
      Creates a column position at the given coordinates.
      Parameters:
      x - the block X coordinate
      z - the block Z coordinate
      Returns:
      a new column position at the given coordinates
      Since:
      0.1.0
    • x

      @Contract(pure=true) int x()
      Gets the X coordinate of this column.
      Returns:
      the block X coordinate
      Since:
      0.1.0
    • z

      @Contract(pure=true) int z()
      Gets the Z coordinate of this column.
      Returns:
      the block Z coordinate
      Since:
      0.1.0
    • offsetX

      @Contract(value="_ -> new", pure=true) ColumnPosition offsetX(int x)
      Moves this column along the X axis.
      Parameters:
      x - the amount to add to the X coordinate
      Returns:
      a new column with the given amount added to the X coordinate
      Since:
      0.1.0
    • offsetZ

      @Contract(value="_ -> new", pure=true) ColumnPosition offsetZ(int z)
      Moves this column along the Z axis.
      Parameters:
      z - the amount to add to the Z coordinate
      Returns:
      a new column with the given amount added to the Z coordinate
      Since:
      0.1.0
    • offset

      @Contract(value="_, _ -> new", pure=true) ColumnPosition offset(int x, int z)
      Moves this column along both axes.
      Parameters:
      x - the amount to add to the X coordinate
      z - the amount to add to the Z coordinate
      Returns:
      a new column with the given amounts added to each coordinate
      Since:
      0.1.0
    • withX

      @Contract(value="_ -> new", pure=true) ColumnPosition withX(int x)
      Copies this column with a different X coordinate.
      Parameters:
      x - the new X coordinate
      Returns:
      a new column with the X coordinate replaced
      Since:
      0.1.0
    • withZ

      @Contract(value="_ -> new", pure=true) ColumnPosition withZ(int z)
      Copies this column with a different Z coordinate.
      Parameters:
      z - the new Z coordinate
      Returns:
      a new column with the Z coordinate replaced
      Since:
      0.1.0
    • with

      @Contract(value="_, _ -> new", pure=true) ColumnPosition with(int x, int z)
      Copies this column with different coordinates.
      Parameters:
      x - the new X coordinate
      z - the new Z coordinate
      Returns:
      a new column with both coordinates replaced
      Since:
      0.1.0
    • atY

      @Contract(value="_ -> new", pure=true) default BlockPosition atY(int y)
      Gets the block of this column at the given height.
      Parameters:
      y - the block Y coordinate
      Returns:
      a new block position in this column at the given height
      Since:
      0.1.0
    • chunk

      @Contract(value=" -> new", pure=true) default ChunkPos chunk()
      Gets the position of the chunk containing this column.
      Returns:
      the position of the chunk holding this column
      Since:
      0.1.0
    • chunkX

      @Contract(pure=true) default int chunkX()
      Gets the X coordinate of the chunk containing this column.
      Returns:
      the X coordinate of the chunk holding this column
      Since:
      0.1.0
    • chunkZ

      @Contract(pure=true) default int chunkZ()
      Gets the Z coordinate of the chunk containing this column.
      Returns:
      the Z coordinate of the chunk holding this column
      Since:
      0.1.0