Added BlockVector a la WorldEdit as requested by #246. This BlockVector is safe to be used as keys in hash sets and hash maps, but it is mutable and careful attention must be paid to not modify the vector post-insertion into a set or map.

This commit is contained in:
sk89q
2011-02-05 23:20:06 -08:00
parent 71fb1d2646
commit 8b9541be53
2 changed files with 116 additions and 0 deletions

View File

@@ -563,6 +563,15 @@ public class Vector implements Cloneable {
public Location toLocation(World world, float yaw, float pitch) {
return new Location(world, x, y, z, yaw, pitch);
}
/**
* Get the block vector of this vector.
*
* @return
*/
public BlockVector toBlockVector() {
return new BlockVector(x, y, z);
}
/**
* Get the threshold used for equals().