mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Improved hashCode implementations for the Vector classes.
Block[World]Vector was ignoring changes of y < 128 (i.e. all of them) and changes of x < 8192.
This commit is contained in:
parent
3bbebcd64e
commit
50009cc855
@ -93,8 +93,8 @@ public class BlockVector extends Vector {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (Integer.valueOf((int)x).hashCode() >> 13) ^
|
return (Integer.valueOf((int)x).hashCode() << 19) ^
|
||||||
(Integer.valueOf((int)y).hashCode() >> 7) ^
|
(Integer.valueOf((int)y).hashCode() << 12) ^
|
||||||
Integer.valueOf((int)z).hashCode();
|
Integer.valueOf((int)z).hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,8 @@ public class BlockWorldVector extends WorldVector {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (Integer.valueOf((int)x).hashCode() >> 13) ^
|
return (Integer.valueOf((int)x).hashCode() << 19) ^
|
||||||
(Integer.valueOf((int)y).hashCode() >> 7) ^
|
(Integer.valueOf((int)y).hashCode() << 12) ^
|
||||||
Integer.valueOf((int)z).hashCode();
|
Integer.valueOf((int)z).hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,9 +585,12 @@ public class Vector {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ((new Double(x)).hashCode() >> 13) ^
|
int hash = 7;
|
||||||
((new Double(y)).hashCode() >> 7) ^
|
|
||||||
(new Double(z)).hashCode();
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user