Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.util.BlockVector Class Reference
Inheritance diagram for org.bukkit.util.BlockVector:
org.bukkit.util.Vector org.bukkit.configuration.serialization.ConfigurationSerializable

Public Member Functions

 BlockVector ()
 
 BlockVector (Vector vec)
 
 BlockVector (int x, int y, int z)
 
 BlockVector (double x, double y, double z)
 
 BlockVector (float x, float y, float z)
 
boolean equals (Object obj)
 
int hashCode ()
 
BlockVector clone ()
 
- Public Member Functions inherited from org.bukkit.util.Vector
 Vector ()
 
 Vector (int x, int y, int z)
 
 Vector (double x, double y, double z)
 
 Vector (float x, float y, float z)
 
Vector add (Vector vec)
 
Vector subtract (Vector vec)
 
Vector multiply (Vector vec)
 
Vector divide (Vector vec)
 
Vector copy (Vector vec)
 
double length ()
 
double lengthSquared ()
 
double distance (Vector o)
 
double distanceSquared (Vector o)
 
float angle (Vector other)
 
Vector midpoint (Vector other)
 
Vector getMidpoint (Vector other)
 
Vector multiply (int m)
 
Vector multiply (double m)
 
Vector multiply (float m)
 
double dot (Vector other)
 
Vector crossProduct (Vector o)
 
Vector normalize ()
 
Vector zero ()
 
boolean isInAABB (Vector min, Vector max)
 
boolean isInSphere (Vector origin, double radius)
 
double getX ()
 
int getBlockX ()
 
double getY ()
 
int getBlockY ()
 
double getZ ()
 
int getBlockZ ()
 
Vector setX (int x)
 
Vector setX (double x)
 
Vector setX (float x)
 
Vector setY (int y)
 
Vector setY (double y)
 
Vector setY (float y)
 
Vector setZ (int z)
 
Vector setZ (double z)
 
Vector setZ (float z)
 
boolean equals (Object obj)
 
int hashCode ()
 
Vector clone ()
 
String toString ()
 
Location toLocation (World world)
 
Location toLocation (World world, float yaw, float pitch)
 
BlockVector toBlockVector ()
 
Map< String, Object > serialize ()
 

Static Public Member Functions

static BlockVector deserialize (Map< String, Object > args)
 
- Static Public Member Functions inherited from org.bukkit.util.Vector
static double getEpsilon ()
 
static Vector getMinimum (Vector v1, Vector v2)
 
static Vector getMaximum (Vector v1, Vector v2)
 
static Vector getRandom ()
 
static Vector deserialize (Map< String, Object > args)
 

Additional Inherited Members

- Protected Attributes inherited from org.bukkit.util.Vector
double x
 
double y
 
double z
 

Detailed Description

A vector with a hash function that floors the X, Y, Z components, a la BlockVector in WorldEdit. BlockVectors can be used in hash sets and hash maps. Be aware that BlockVectors are mutable, but it is important that BlockVectors are never changed once put into a hash set or hash map.

Definition at line 13 of file BlockVector.java.

Constructor & Destructor Documentation

org.bukkit.util.BlockVector.BlockVector ( )

Construct the vector with all components as 0.

Definition at line 18 of file BlockVector.java.

18  {
19  this.x = 0;
20  this.y = 0;
21  this.z = 0;
22  }
org.bukkit.util.BlockVector.BlockVector ( Vector  vec)

Construct the vector with another vector.

Parameters
vecThe other vector.

Definition at line 29 of file BlockVector.java.

References org.bukkit.util.Vector.getX(), org.bukkit.util.Vector.getY(), and org.bukkit.util.Vector.getZ().

29  {
30  this.x = vec.getX();
31  this.y = vec.getY();
32  this.z = vec.getZ();
33  }
org.bukkit.util.BlockVector.BlockVector ( int  x,
int  y,
int  z 
)

Construct the vector with provided integer components.

Parameters
xX component
yY component
zZ component

Definition at line 42 of file BlockVector.java.

42  {
43  this.x = x;
44  this.y = y;
45  this.z = z;
46  }
org.bukkit.util.BlockVector.BlockVector ( double  x,
double  y,
double  z 
)

Construct the vector with provided double components.

Parameters
xX component
yY component
zZ component

Definition at line 55 of file BlockVector.java.

55  {
56  this.x = x;
57  this.y = y;
58  this.z = z;
59  }
org.bukkit.util.BlockVector.BlockVector ( float  x,
float  y,
float  z 
)

Construct the vector with provided float components.

Parameters
xX component
yY component
zZ component

Definition at line 68 of file BlockVector.java.

68  {
69  this.x = x;
70  this.y = y;
71  this.z = z;
72  }

Member Function Documentation

BlockVector org.bukkit.util.BlockVector.clone ( )

Get a new block vector.

Returns
vector

Definition at line 107 of file BlockVector.java.

References org.bukkit.util.BlockVector.clone().

Referenced by org.bukkit.util.BlockVector.clone().

107  {
108  return (BlockVector) super.clone();
109  }
boolean org.bukkit.util.BlockVector.equals ( Object  obj)

Checks if another object is equivalent.

Parameters
objThe other object
Returns
whether the other object is equivalent

Definition at line 81 of file BlockVector.java.

References org.bukkit.util.Vector.getX(), org.bukkit.util.Vector.getY(), and org.bukkit.util.Vector.getZ().

81  {
82  if (!(obj instanceof BlockVector)) {
83  return false;
84  }
85  BlockVector other = (BlockVector) obj;
86 
87  return (int) other.getX() == (int) this.x && (int) other.getY() == (int) this.y && (int) other.getZ() == (int) this.z;
88 
89  }
int org.bukkit.util.BlockVector.hashCode ( )

Returns a hash code for this vector.

Returns
hash code

Definition at line 97 of file BlockVector.java.

97  {
98  return (Integer.valueOf((int) x).hashCode() >> 13) ^ (Integer.valueOf((int) y).hashCode() >> 7) ^ Integer.valueOf((int) z).hashCode();
99  }

The documentation for this class was generated from the following file: