Package com.comphenix.protocol.wrappers
Class BlockPosition
java.lang.Object
com.comphenix.protocol.wrappers.BlockPosition
Copies a immutable net.minecraft.server.BlockPosition, which represents a integer 3D vector.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic BlockPositionRepresents the null (0, 0, 0) origin.protected final intprotected final intprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionBlockPosition(int x, int y, int z) Construct an immutable 3D vector.BlockPosition(org.bukkit.util.Vector vector) Construct an immutable integer 3D vector from a mutable Bukkit vector. -
Method Summary
Modifier and TypeMethodDescriptionadd(BlockPosition other) Adds the current position and a given position together, producing a result position.divide(int divisor) Divide each dimension in the current position by the given divisor.booleanstatic EquivalentConverter<BlockPosition> Used to convert between NMS ChunkPosition and the wrapper instance.intgetX()Retrieve the x-coordinate.intgetY()Retrieve the y-coordinate.intgetZ()Retrieve the z-coordinate.inthashCode()multiply(int factor) Multiply each dimension in the current position by the given factor.subtract(BlockPosition other) Adds the current position and a given position together, producing a result position.org.bukkit.LocationtoLocation(org.bukkit.World world) Convert this instance to an equivalent Location.toString()org.bukkit.util.VectortoVector()Convert this instance to an equivalent real 3D vector.
-
Field Details
-
ORIGIN
Represents the null (0, 0, 0) origin. -
x
protected final int x -
y
protected final int y -
z
protected final int z
-
-
Constructor Details
-
BlockPosition
public BlockPosition(int x, int y, int z) Construct an immutable 3D vector.- Parameters:
x- - x coordinatey- - y coordinatez- - z coordinate
-
BlockPosition
public BlockPosition(org.bukkit.util.Vector vector) Construct an immutable integer 3D vector from a mutable Bukkit vector.- Parameters:
vector- - the mutable real Bukkit vector to copy.
-
-
Method Details
-
toVector
public org.bukkit.util.Vector toVector()Convert this instance to an equivalent real 3D vector.- Returns:
- Real 3D vector.
-
toLocation
public org.bukkit.Location toLocation(org.bukkit.World world) Convert this instance to an equivalent Location.- Parameters:
world- World for the location- Returns:
- Location
-
getX
public int getX()Retrieve the x-coordinate.- Returns:
- X coordinate.
-
getY
public int getY()Retrieve the y-coordinate.- Returns:
- Y coordinate.
-
getZ
public int getZ()Retrieve the z-coordinate.- Returns:
- Z coordinate.
-
add
Adds the current position and a given position together, producing a result position.- Parameters:
other- - the other position.- Returns:
- The new result position.
-
subtract
Adds the current position and a given position together, producing a result position.- Parameters:
other- - the other position.- Returns:
- The new result position.
-
multiply
Multiply each dimension in the current position by the given factor.- Parameters:
factor- - multiplier.- Returns:
- The new result.
-
divide
Divide each dimension in the current position by the given divisor.- Parameters:
divisor- - the divisor.- Returns:
- The new result.
-
getConverter
Used to convert between NMS ChunkPosition and the wrapper instance.- Returns:
- A new converter.
-
equals
-
hashCode
public int hashCode() -
toString
-