revert some changes

This commit is contained in:
Jesse Boyd
2019-04-05 15:48:41 +11:00
parent 94d5d8df8e
commit be5541b61b
18 changed files with 29 additions and 51 deletions

View File

@ -564,10 +564,7 @@ public class BlockVector2 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Integer.hashCode(x);
hash = 31 * hash + Integer.hashCode(z);
return hash;
return (x << 16) ^ z;
}
@Override

View File

@ -629,11 +629,7 @@ public class BlockVector3 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Integer.hashCode(x);
hash = 31 * hash + Integer.hashCode(y);
hash = 31 * hash + Integer.hashCode(z);
return hash;
return (x ^ (z << 12)) ^ (y << 24);
}
@Override

View File

@ -491,7 +491,7 @@ public class Vector2 {
@Override
public int hashCode() {
return ((int) getX() ^ ((int) getZ() << 16));
return (((int) x) << 16) ^ ((int) z);
}
@Override

View File

@ -40,21 +40,6 @@ public class Vector3 {
public static final Vector3 ONE = new Vector3(1, 1, 1);
public static Vector3 at(double x, double y, double z) {
// switch for efficiency on typical cases
// in MC y is rarely 0/1 on selections
int yTrunc = (int) y;
switch (yTrunc) {
case 0:
if (x == 0 && y == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && y == 1 && z == 1) {
return ONE;
}
break;
}
return new Vector3(x, y, z);
}
@ -647,15 +632,14 @@ public class Vector3 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Double.hashCode(x);
hash = 31 * hash + Double.hashCode(y);
hash = 31 * hash + Double.hashCode(z);
return hash;
return (((int) x) ^ (((int) z) << 12)) ^ (((int) y) << 24);
}
@Override
public String toString() {
String x = (getX() == getBlockX() ? "" + getBlockX() : "" + getX());
String y = (getY() == getBlockY() ? "" + getBlockY() : "" + getY());
String z = (getZ() == getBlockZ() ? "" + getBlockZ() : "" + getZ());
return "(" + x + ", " + y + ", " + z + ")";
}