Interface Position
- All Known Subinterfaces:
BlockPosition, FinePosition, Location
An immutable set of X, Y and Z coordinates.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlockPositionblock(int x, int y, int z) Creates a block position at the given coordinates.default intblockX()Gets the X coordinate of the block containing this position.default intblockY()Gets the Y coordinate of the block containing this position.default intblockZ()Gets the Z coordinate of the block containing this position.default ChunkPoschunk()Gets the position of the chunk containing this position.default intchunkX()Gets the X coordinate of the chunk containing this position.default intchunkZ()Gets the Z coordinate of the chunk containing this position.default doubledistanceSquared(Position other) Computes the squared distance between this position and another.static FinePositionfine(double x, double y, double z) Creates a fine position at the given coordinates.default intlocalX()Gets the X coordinate of this position relative to the chunk containing it.default intlocalZ()Gets the Z coordinate of this position relative to the chunk containing it.offset(double x, double y, double z) Moves this position along all three axes.offset(int x, int y, int z) Moves this position along all three axes by a whole number of blocks.offsetX(double x) Moves this position along the X axis.offsetX(int x) Moves this position along the X axis by a whole number of blocks.offsetY(double y) Moves this position along the Y axis.offsetY(int y) Moves this position along the Y axis by a whole number of blocks.offsetZ(double z) Moves this position along the Z axis.offsetZ(int z) Moves this position along the Z axis by a whole number of blocks.Moves this position by one block in the direction of the given face.Moves this position by the defined distance in the direction of the given face.toLocation(World world) Places this position in a world.with(double x, double y, double z) Copies this position with different coordinates.with(int x, int y, int z) Copies this position with different whole coordinates.withX(double x) Copies this position with a different X coordinate.withX(int x) Copies this position with a different whole X coordinate.withY(double y) Copies this position with a different Y coordinate.withY(int y) Copies this position with a different whole Y coordinate.withZ(double z) Copies this position with a different Z coordinate.withZ(int z) Copies this position with a different whole Z coordinate.doublex()Gets the X coordinate of this position.doubley()Gets the Y coordinate of this position.doublez()Gets the Z coordinate of this position.
-
Method Details
-
fine
Creates a fine position at the given coordinates.- Parameters:
x- the X coordinatey- the Y coordinatez- the Z coordinate- Returns:
- a new fine position at the given coordinates
- Since:
- 0.1.0
-
block
Creates a block position at the given coordinates.- Parameters:
x- the block X coordinatey- the block Y coordinatez- the block Z coordinate- Returns:
- a new block position at the given coordinates
- Since:
- 0.1.0
-
x
-
y
-
z
-
relative
Moves this position by the defined distance in the direction of the given face.- Parameters:
face- the direction to move towardsdistance- the offset distance- Returns:
- a new position moved by one block towards the given face
- Since:
- 0.1.0
-
relative
-
offsetX
Moves this position along the X axis.- Parameters:
x- the amount to add to the X coordinate- Returns:
- a new position with the given amount added to the X coordinate
- Since:
- 0.1.0
-
offsetY
Moves this position along the Y axis.- Parameters:
y- the amount to add to the Y coordinate- Returns:
- a new position with the given amount added to the Y coordinate
- Since:
- 0.1.0
-
offsetZ
Moves this position along the Z axis.- Parameters:
z- the amount to add to the Z coordinate- Returns:
- a new position with the given amount added to the Z coordinate
- Since:
- 0.1.0
-
offset
Moves this position along all three axes.- Parameters:
x- the amount to add to the X coordinatey- the amount to add to the Y coordinatez- the amount to add to the Z coordinate- Returns:
- a new position with the given amounts added to each coordinate
- Since:
- 0.1.0
-
offsetX
-
offsetY
-
offsetZ
-
offset
Moves this position along all three axes by a whole number of blocks.- Parameters:
x- the amount to add to the X coordinatey- the amount to add to the Y coordinatez- the amount to add to the Z coordinate- Returns:
- a new position of the same kind with the given amounts added to each coordinate
- Since:
- 0.1.0
-
withX
Copies this position with a different X coordinate.- Parameters:
x- the new X coordinate- Returns:
- a new position with the X coordinate replaced
- Since:
- 0.1.0
-
withY
Copies this position with a different Y coordinate.- Parameters:
y- the new Y coordinate- Returns:
- a new position with the Y coordinate replaced
- Since:
- 0.1.0
-
withZ
Copies this position with a different Z coordinate.- Parameters:
z- the new Z coordinate- Returns:
- a new position with the Z coordinate replaced
- Since:
- 0.1.0
-
with
Copies this position with different coordinates.- Parameters:
x- the new X coordinatey- the new Y coordinatez- the new Z coordinate- Returns:
- a new position with all coordinates replaced
- Since:
- 0.1.0
-
withX
-
withY
-
withZ
-
with
Copies this position with different whole coordinates.- Parameters:
x- the new X coordinatey- the new Y coordinatez- the new Z coordinate- Returns:
- a new position of the same kind with all coordinates replaced
- Since:
- 0.1.0
-
blockX
-
blockY
-
blockZ
-
chunk
-
chunkX
-
chunkZ
-
localX
-
localZ
-
distanceSquared
-
toLocation
-