Location

Represents 3-dimensional position in world

Constructors

Link copied to clipboard
public void Location(World world, double x, double y, double z)
Constructs new Location with the given coordinates
public void Location(World world, double x, double y, double z, float yaw, float pitch)
Constructs new Location with the given coordinates and direction

Properties

Link copied to clipboard
public float pitch
Link copied to clipboard
public World world
Link copied to clipboard
public double x
Link copied to clipboard
public double y
Link copied to clipboard
public float yaw
Link copied to clipboard
public double z

Functions

Link copied to clipboard
public Location add(Location vec)
public Location add(double x, double y, double z)
Adds the location by another.
public Location add(Vector vec)
Adds the location by vector.
Link copied to clipboard
public Location clone()
Link copied to clipboard
public static Location deserialize(Map<String, Object> args)
Required method for deserialization
Link copied to clipboard
public double distance(Location o)
Get the distance between this location and another.
Link copied to clipboard
public double distanceSquared(Location o)
Get the squared distance between this location and another.
Link copied to clipboard
public boolean equals(Object obj)
Link copied to clipboard
public Block getBlock()
Gets the block at the represented location
Link copied to clipboard
public int getBlockX()
Gets the floored value of the X component, indicating the block that this location is contained with.
Link copied to clipboard
public int getBlockY()
Gets the floored value of the Y component, indicating the block that this location is contained with.
Link copied to clipboard
public int getBlockZ()
Gets the floored value of the Z component, indicating the block that this location is contained with.
Link copied to clipboard
public Chunk getChunk()
Gets the chunk at the represented location
Link copied to clipboard
Gets unit-vector pointing in the direction that this Location is facing.
Link copied to clipboard
public float getPitch()
Gets the pitch of this location, measured in degrees.
Link copied to clipboard
public World getWorld()
Gets the world that this location resides in
Link copied to clipboard
public double getX()
Gets the x-coordinate of this location
Link copied to clipboard
public double getY()
Gets the y-coordinate of this location
Link copied to clipboard
public float getYaw()
Gets the yaw of this location, measured in degrees.
Link copied to clipboard
public double getZ()
Gets the z-coordinate of this location
Link copied to clipboard
public int hashCode()
Link copied to clipboard
public double length()
Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2).
Link copied to clipboard
public double lengthSquared()
Gets the magnitude of the location squared.
Link copied to clipboard
public static int locToBlock(double loc)
Safely converts double (location coordinate) to an int (block coordinate)
Link copied to clipboard
public Location multiply(double m)
Performs scalar multiplication, multiplying all components with getClassById scalar.
Link copied to clipboard
Creates getClassById Map representation of this class.
Link copied to clipboard
public Location setDirection(Vector vector)
Sets the yaw and pitch to point in the direction of the vector.
Link copied to clipboard
public void setPitch(float pitch)
Sets the pitch of this location, measured in degrees.
Link copied to clipboard
public void setWorld(World world)
Sets the world that this location resides in
Link copied to clipboard
public void setX(double x)
Sets the x-coordinate of this location
Link copied to clipboard
public void setY(double y)
Sets the y-coordinate of this location
Link copied to clipboard
public void setYaw(float yaw)
Sets the yaw of this location, measured in degrees.
Link copied to clipboard
public void setZ(double z)
Sets the z-coordinate of this location
Link copied to clipboard
public Location subtract(Location vec)
public Location subtract(double x, double y, double z)
Subtracts the location by another.
public Location subtract(Vector vec)
Subtracts the location by vector.
Link copied to clipboard
public String toString()
Link copied to clipboard
public Vector toVector()
Constructs getClassById new Vector based on this Location
Link copied to clipboard
public Location zero()
Zero this location's components.