Package io.papermc.paper.math
Interface Position
- All Known Subinterfaces:
- BlockPosition,- FinePosition
- All Known Implementing Classes:
- Location
Common interface for 
FinePosition and BlockPosition.
 May see breaking changes until Experimental annotation is removed.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic @NotNull BlockPositionblock(int x, int y, int z) Creates a position at the coordinatesstatic @NotNull BlockPositionCreates a position from the location.intblockX()Gets the block x value for this positionintblockY()Gets the block x value for this positionintblockZ()Gets the block x value for this positionstatic @NotNull FinePositionfine(double x, double y, double z) Creates a position at the coordinatesstatic @NotNull FinePositionCreates a position from the location.booleanisBlock()Checks of this position represents aBlockPositionbooleanisFine()Checks if this position represents aFinePositionoffset(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.toBlock()Returns the block position of this position or itself if it already is a block positiondefault @NotNull FinePositiontoCenter()Returns a new position at the center of the block position this representstoLocation(@NotNull World world) Creates a new location object at this position with the specified worldtoVector()Converts this position to a vectordoublex()Gets the x value for this positiondoubley()Gets the y value for this positiondoublez()Gets the z value for this position
- 
Field Details- 
FINE_ZERO
- 
BLOCK_ZERO
 
- 
- 
Method Details- 
blockXint blockX()Gets the block x value for this position- Returns:
- the block x value
 
- 
blockYint blockY()Gets the block x value for this position- Returns:
- the block x value
 
- 
blockZint blockZ()Gets the block x value for this position- Returns:
- the block x value
 
- 
xdouble x()Gets the x value for this position- Returns:
- the x value
 
- 
ydouble y()Gets the y value for this position- Returns:
- the y value
 
- 
zdouble z()Gets the z value for this position- Returns:
- the z value
 
- 
isBlockboolean isBlock()Checks of this position represents aBlockPosition- Returns:
- true if block
 
- 
isFineboolean isFine()Checks if this position represents aFinePosition- Returns:
- true if fine
 
- 
offsetReturns a position offset by the specified amounts.- Parameters:
- x- x value to offset
- y- y value to offset
- z- z value to offset
- Returns:
- the offset position
 
- 
offsetReturns a position offset by the specified amounts.- Parameters:
- x- x value to offset
- y- y value to offset
- z- z value to offset
- Returns:
- the offset position
 
- 
toCenterReturns a new position at the center of the block position this represents- Returns:
- a new center position
 
- 
toBlockReturns the block position of this position or itself if it already is a block position- Returns:
- the block position
 
- 
toVectorConverts this position to a vector- Returns:
- a new vector
 
- 
toLocation@Contract(value="_ -> new", pure=true) @NotNull default @NotNull Location toLocation(@NotNull @NotNull World world) Creates a new location object at this position with the specified world- Parameters:
- world- the world for the location object
- Returns:
- a new location
 
- 
block@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull BlockPosition block(int x, int y, int z) Creates a position at the coordinates- Parameters:
- x- x coord
- y- y coord
- z- z coord
- Returns:
- a position with those coords
 
- 
block@Contract(value="_ -> new", pure=true) @NotNull static @NotNull BlockPosition block(@NotNull @NotNull Location location) Creates a position from the location.- Parameters:
- location- the location to copy the position of
- Returns:
- a new position at that location
 
- 
fine@Contract(value="_, _, _ -> new", pure=true) @NotNull static @NotNull FinePosition fine(double x, double y, double z) Creates a position at the coordinates- Parameters:
- x- x coord
- y- y coord
- z- z coord
- Returns:
- a position with those coords
 
- 
fine@Contract(value="_ -> new", pure=true) @NotNull static @NotNull FinePosition fine(@NotNull @NotNull Location location) Creates a position from the location.- Parameters:
- location- the location to copy the position of
- Returns:
- a new position at that location
 
 
-