diff --git a/src/main/java/org/bukkit/util/Vector.java b/src/main/java/org/bukkit/util/Vector.java index 8a44c17d..d018a066 100644 --- a/src/main/java/org/bukkit/util/Vector.java +++ b/src/main/java/org/bukkit/util/Vector.java @@ -526,16 +526,17 @@ public class Vector implements Cloneable { } /** - * Returns a hash code for this vector. Due to floating point errors, this - * hash code should not be used in hash tables of any sort. + * Returns a hash code for this vector * * @return hash code */ @Override public int hashCode() { - return ((int)Double.doubleToLongBits(x) >> 13) ^ - ((int)Double.doubleToLongBits(y) >> 7) ^ - (int)Double.doubleToLongBits(z); + int hash = 7; + 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; } /**