Interface BlockPosition

All Superinterfaces:
Position

@Experimental @NullMarked public interface BlockPosition extends Position
A position represented with integers.

May see breaking changes until Experimental annotation is removed.

See Also:
  • Field Summary

    Fields inherited from interface io.papermc.paper.math.Position

    BLOCK_ZERO, FINE_ZERO
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Checks of this position represents a BlockPosition
    default boolean
    Checks if this position represents a FinePosition
    default FinePosition
    offset(double x, double y, double z)
    Returns a position offset by the specified amounts.
    offset(int x, int y, int z)
    Returns a position offset by the specified amounts.
    offset(Axis axis, int amount)
    Returns a block position offset by the amount along the specified axis.
    offset(BlockFace blockFace)
    Returns a block position offset by 1 in the direction specified.
    offset(BlockFace blockFace, int amount)
    Returns a block position offset in the direction specified multiplied by the amount.
    Returns the block position of this position or itself if it already is a block position
    default double
    x()
    Gets the x value for this position
    default double
    y()
    Gets the y value for this position
    default double
    z()
    Gets the z value for this position

    Methods inherited from interface io.papermc.paper.math.Position

    blockX, blockY, blockZ, isFinite, toCenter, toLocation, toVector
  • Method Details

    • x

      default double x()
      Description copied from interface: Position
      Gets the x value for this position
      Specified by:
      x in interface Position
      Returns:
      the x value
    • y

      default double y()
      Description copied from interface: Position
      Gets the y value for this position
      Specified by:
      y in interface Position
      Returns:
      the y value
    • z

      default double z()
      Description copied from interface: Position
      Gets the z value for this position
      Specified by:
      z in interface Position
      Returns:
      the z value
    • isBlock

      default boolean isBlock()
      Description copied from interface: Position
      Checks of this position represents a BlockPosition
      Specified by:
      isBlock in interface Position
      Returns:
      true if block
    • isFine

      default boolean isFine()
      Description copied from interface: Position
      Checks if this position represents a FinePosition
      Specified by:
      isFine in interface Position
      Returns:
      true if fine
    • toBlock

      default BlockPosition toBlock()
      Description copied from interface: Position
      Returns the block position of this position or itself if it already is a block position
      Specified by:
      toBlock in interface Position
      Returns:
      the block position
    • offset

      default BlockPosition offset(int x, int y, int z)
      Description copied from interface: Position
      Returns a position offset by the specified amounts.
      Specified by:
      offset in interface Position
      Parameters:
      x - x value to offset
      y - y value to offset
      z - z value to offset
      Returns:
      the offset position
    • offset

      default FinePosition offset(double x, double y, double z)
      Description copied from interface: Position
      Returns a position offset by the specified amounts.
      Specified by:
      offset in interface Position
      Parameters:
      x - x value to offset
      y - y value to offset
      z - z value to offset
      Returns:
      the offset position
    • offset

      @Contract(value="_ -> new", pure=true) default BlockPosition offset(BlockFace blockFace)
      Returns a block position offset by 1 in the direction specified.
      Parameters:
      blockFace - the block face to offset towards
      Returns:
      the offset block position
    • offset

      @Contract(pure=true) default BlockPosition offset(BlockFace blockFace, int amount)
      Returns a block position offset in the direction specified multiplied by the amount.
      Parameters:
      blockFace - the block face to offset towards
      amount - the number of times to move in that direction
      Returns:
      the offset block position
    • offset

      @Contract(pure=true) default BlockPosition offset(Axis axis, int amount)
      Returns a block position offset by the amount along the specified axis.
      Parameters:
      axis - the axis to offset along
      amount - the amount to offset along that axis
      Returns:
      the offset block position