public final class Position extends java.lang.Object implements java.lang.Comparable<Position>, java.io.Serializable
| Constructor and Description |
|---|
Position(io.netty.buffer.ByteBuf buf)
Constructs a Position from a ByteBuf.
|
Position(java.io.DataInputStream inputStream)
Constructs a Position from an InputStream.
|
Position(net.minecraft.entity.Entity entity)
Constructs a Position from an Entity.
|
Position(int x,
int y,
int z)
Constructs a Position from basic integers.
|
Position(net.minecraft.util.MovingObjectPosition pos)
Constructs a Position from a MovingObjectPosition.
|
Position(net.minecraft.nbt.NBTTagCompound tag)
Constructs a Position from a NBTTagCompound.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
int |
compareTo(Position pos) |
boolean |
equals(java.lang.Object compared) |
net.minecraft.block.Block |
getBlockAtPosition(net.minecraft.world.World world)
Retrieves a Block from this Position.
|
double |
getDistance(int x,
int y,
int z)
Calculates the distance between this position and a specified set of coordinates.
|
double |
getDistance(Position pos)
Calculates the distance between this position and a second position.
|
int |
getMetaAtPosition(net.minecraft.world.World world)
Retrieves the meta value of a Block at this Position.
|
int |
getX()
Provides access to the X coordinate for this Position.
|
int |
getY()
Provides access to the Y coordinate for this Position.
|
int |
getZ()
Provides access to the Z coordinate for this Position.
|
int |
hashCode() |
boolean |
isBlockAtPosition(net.minecraft.world.World world)
Checks whether or not there is a block at this Position.
|
Position |
offset(int direction)
Creates a new Position which is moved one block in the specified direction.
|
Position |
offset(int direction,
int amount)
Creates a new Position which is moved a specified amount of blocks, in the specified
direction.
|
void |
sendEntityToPosition(net.minecraft.entity.EntityLivingBase entity)
Sends an EntityLivingBase to this position within the world.
|
void |
setBlockAtPosition(net.minecraft.world.World world,
net.minecraft.block.Block block)
Sets a new Block to this Position.
|
void |
setBlockAtPositionToAir(net.minecraft.world.World world)
Sets the Block at this position to Air.
|
void |
setMetaAtPosition(net.minecraft.world.World world,
int meta)
Sets the meta value of a Block at this Position.
|
java.lang.String |
toString() |
Position |
translate(int x,
int y,
int z)
Creates a new Position which has been translated by the specified amounts along the X, Y
and Z axis.
|
Position |
translateDown()
Creates a new Position which has been translated downwards by one block.
|
Position |
translateDown(int distance)
Creates a new Position which has been translated downwards by a specified amount of
blocks.
|
Position |
translateEast()
Creates a new Position which has been translated east by one block.
|
Position |
translateEast(int distance)
Creates a new Position which has been translated east by a specified amount of blocks.
|
Position |
translateNorth()
Creates a new Position which has been translated downwards by one block.
|
Position |
translateNorth(int distance)
Creates a new Position which has been translated north by a specified amount of blocks.
|
Position |
translateSouth()
Creates a new Position which has been translated south by one block.
|
Position |
translateSouth(int distance)
Creates a new Position which has been translated south by a specified amount of blocks.
|
Position |
translateUp()
Creates a new Position which has been translated upwards by one block.
|
Position |
translateUp(int distance)
Creates a new Position which has been translated upwards by a specified amount of
blocks.
|
Position |
translateWest()
Creates a new Position which has been translated west by one block.
|
Position |
translateWest(int distance)
Creates a new Position which has been translated west by a specified amount of blocks.
|
void |
write(io.netty.buffer.ByteBuf buf)
Writes the coordinates to a ByteBuf.
|
void |
write(java.io.DataOutputStream dataStream)
Writes the coordinates of this position to an outgoing data stream.
|
net.minecraft.nbt.NBTTagCompound |
write(net.minecraft.nbt.NBTTagCompound tag)
Write the coordinates of this position to an NBTTagCompound.
|
public Position(net.minecraft.util.MovingObjectPosition pos)
pos: - A MovingObjectPosition containing block coordinates.public Position(net.minecraft.entity.Entity entity)
entity: - An Entity containing position coordinates.public Position(net.minecraft.nbt.NBTTagCompound tag)
tag: - An NBTTagCompound which contains coordinate data.public Position(java.io.DataInputStream inputStream)
throws java.io.IOException
inputStream: - A stream of data to read data from. The next three integers in this
stream are used for the construction of the Position.IOException: - An IOException that can be thrown for any of the various
IOException causes.java.io.IOExceptionpublic Position(io.netty.buffer.ByteBuf buf)
buf: - The ByteBuf to read the data from.public Position(int x,
int y,
int z)
x: - The X coordinate for this Position.y: - The Y coordinate for this Position.z: - The Z coordinate for this Position.public int getX()
public int getY()
public int getZ()
public void write(java.io.DataOutputStream dataStream)
throws java.io.IOException
dataStream: - The stream of data to write the coordinates to.IOException: - An IOException that can be thrown for any of the various
IOException causes.java.io.IOExceptionpublic net.minecraft.nbt.NBTTagCompound write(net.minecraft.nbt.NBTTagCompound tag)
tag: - The NBTTagCompound to write the coordinates to.public void write(io.netty.buffer.ByteBuf buf)
buf: - The ByteBuf to write this data to.public Position offset(int direction)
direction: - The direction to transition towards. 0:down 1:up 2:north 3:south
4:east 5:westpublic Position offset(int direction, int amount)
direction: - The direction to transition towards. 0:down 1:up 2:north 3:south
4:east 5:westamount: - The amount of blocks to move.public Position translate(int x, int y, int z)
x: - The distance to move on the X axis.y: - The distance to move on the Y axis.z: - The distance to move on the Z axis.public Position translateUp()
public Position translateUp(int distance)
distance: - The distance to translate the position upwards.public Position translateDown()
public Position translateDown(int distance)
distance: - The distance to translate the position downwards.public Position translateNorth()
public Position translateNorth(int distance)
distance: - The distance to translate the position north.public Position translateSouth()
public Position translateSouth(int distance)
distance: - The distance to translate the position south.public Position translateWest()
public Position translateWest(int distance)
distance: - The distance to translate the position west.public Position translateEast()
public Position translateEast(int distance)
distance: - The distance to translate the position east.public double getDistance(Position pos)
pos: - A second position within the world.public double getDistance(int x,
int y,
int z)
x: - The second X coordinate.y: - The second Y coordinate.z: - The second Z coordinate.public boolean isBlockAtPosition(net.minecraft.world.World world)
world: - An instance of the World to check within.public net.minecraft.block.Block getBlockAtPosition(net.minecraft.world.World world)
world: - An instance of the world to grab the Block from.public void setBlockAtPosition(net.minecraft.world.World world,
net.minecraft.block.Block block)
world: - An instance of the world to place the Block in.block: - The Block that you wish tho place at this Position.public void setBlockAtPositionToAir(net.minecraft.world.World world)
world: - An instance of the world to replace the Block in.public int getMetaAtPosition(net.minecraft.world.World world)
world: - An instance of the world to grab the meta from.public void setMetaAtPosition(net.minecraft.world.World world,
int meta)
world: - An instance of the world to set the meta within.meta: - The desired meta value for the Block at this Position.public void sendEntityToPosition(net.minecraft.entity.EntityLivingBase entity)
entity: - The EntityLivingBase you wish to send to this position.public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean equals(java.lang.Object compared)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(Position pos)
compareTo in interface java.lang.Comparable<Position>public java.lang.String toString()
toString in class java.lang.Object