geforkt von Mirrors/FastAsyncWorldEdit
Merge pull request #379 from boy0001/vector-fix
Vector and BlockVector should use the same hashCode
Dieser Commit ist enthalten in:
Commit
b17f2b55d7
@ -73,6 +73,11 @@ public class BlockVector extends Vector {
|
|||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof Vector)) {
|
if (!(obj instanceof Vector)) {
|
||||||
@ -84,13 +89,6 @@ public class BlockVector extends Vector {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return ((int) x << 19) ^
|
|
||||||
((int) y << 12) ^
|
|
||||||
(int) z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector toBlockVector() {
|
public BlockVector toBlockVector() {
|
||||||
return this;
|
return this;
|
||||||
|
@ -69,6 +69,11 @@ public class BlockVector2D extends Vector2D {
|
|||||||
super(x, z);
|
super(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return ((int) x << 16) ^ (int) z;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof Vector2D)) {
|
if (!(obj instanceof Vector2D)) {
|
||||||
@ -80,12 +85,6 @@ public class BlockVector2D extends Vector2D {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return (Integer.valueOf((int) x).hashCode() >> 13) ^
|
|
||||||
Integer.valueOf((int) z).hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector2D toBlockVector2D() {
|
public BlockVector2D toBlockVector2D() {
|
||||||
return this;
|
return this;
|
||||||
|
@ -789,12 +789,7 @@ public class Vector implements Comparable<Vector> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24);
|
||||||
|
|
||||||
hash = 79 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
|
|
||||||
hash = 79 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
|
|
||||||
hash = 79 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32));
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -627,8 +627,7 @@ public class Vector2D {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ((new Double(x)).hashCode() >> 13) ^
|
return ((int) x << 16) ^ (int) z;
|
||||||
(new Double(z)).hashCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren