Merge branch 'master' into breaking

This commit is contained in:
Jesse Boyd
2019-04-05 15:47:04 +11:00
43 changed files with 985 additions and 919 deletions

View File

@ -641,4 +641,4 @@ public class BlockVector3 {
return "(" + x + ", " + y + ", " + z + ")";
}
}
}

View File

@ -40,6 +40,21 @@ 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);
}
@ -632,15 +647,16 @@ public class Vector3 {
@Override
public int hashCode() {
return ((int) getX() ^ ((int) getZ() << 16)) ^ ((int) getY() << 30);
int hash = 17;
hash = 31 * hash + Double.hashCode(x);
hash = 31 * hash + Double.hashCode(y);
hash = 31 * hash + Double.hashCode(z);
return hash;
}
@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 + ")";
}
}
}