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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlockPosition
block
(int x, int y, int z) Creates a position at the coordinatesstatic BlockPosition
Creates a position from the location.int
blockX()
Gets the block x value for this positionint
blockY()
Gets the block x value for this positionint
blockZ()
Gets the block x value for this positionstatic FinePosition
fine
(double x, double y, double z) Creates a position at the coordinatesstatic FinePosition
Creates a position from the location.boolean
isBlock()
Checks of this position represents aBlockPosition
boolean
isFine()
Checks if this position represents aFinePosition
default boolean
isFinite()
Checks if each component of this position is finite.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.toBlock()
Returns the block position of this position or itself if it already is a block positiondefault FinePosition
toCenter()
Returns a new position at the center of the block position this representsdefault Location
toLocation
(World world) Creates a new location object at this position with the specified worlddefault Vector
toVector()
Converts this position to a vectordouble
x()
Gets the x value for this positiondouble
y()
Gets the y value for this positiondouble
z()
Gets the z value for this position
-
Field Details
-
FINE_ZERO
-
BLOCK_ZERO
-
-
Method Details
-
blockX
int blockX()Gets the block x value for this position- Returns:
- the block x value
-
blockY
int blockY()Gets the block x value for this position- Returns:
- the block x value
-
blockZ
int blockZ()Gets the block x value for this position- Returns:
- the block x value
-
x
double x()Gets the x value for this position- Returns:
- the x value
-
y
double y()Gets the y value for this position- Returns:
- the y value
-
z
double z()Gets the z value for this position- Returns:
- the z value
-
isBlock
boolean isBlock()Checks of this position represents aBlockPosition
- Returns:
- true if block
-
isFine
boolean isFine()Checks if this position represents aFinePosition
- Returns:
- true if fine
-
isFinite
default boolean isFinite()Checks if each component of this position is finite. -
offset
Returns a position offset by the specified amounts.- Parameters:
x
- x value to offsety
- y value to offsetz
- z value to offset- Returns:
- the offset position
-
offset
Returns a position offset by the specified amounts.- Parameters:
x
- x value to offsety
- y value to offsetz
- z value to offset- Returns:
- the offset position
-
toCenter
Returns a new position at the center of the block position this represents- Returns:
- a new center position
-
toBlock
Returns the block position of this position or itself if it already is a block position- Returns:
- the block position
-
toVector
Converts this position to a vector- Returns:
- a new vector
-
toLocation
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
Creates a position at the coordinates- Parameters:
x
- x coordy
- y coordz
- z coord- Returns:
- a position with those coords
-
block
Creates a position from the location.- Parameters:
location
- the location to copy the position of- Returns:
- a new position at that location
-
fine
Creates a position at the coordinates- Parameters:
x
- x coordy
- y coordz
- z coord- Returns:
- a position with those coords
-
fine
Creates a position from the location.- Parameters:
location
- the location to copy the position of- Returns:
- a new position at that location
-