From 96c9d3867bd98d7d9d4d23e2ce0b8edf3f99915e Mon Sep 17 00:00:00 2001 From: Madeline Miller Date: Sat, 2 Mar 2024 20:05:38 +1000 Subject: [PATCH] Drop custom equals and hashCode methods in Vector/BlockVector classes --- .../com/sk89q/worldedit/math/BlockVector2.java | 15 --------------- .../com/sk89q/worldedit/math/BlockVector3.java | 14 -------------- .../java/com/sk89q/worldedit/math/Vector2.java | 18 ------------------ .../java/com/sk89q/worldedit/math/Vector3.java | 18 ------------------ 4 files changed, 65 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java index 65c8c00e14..2832bd98ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java @@ -530,21 +530,6 @@ public BlockVector3 toBlockVector3(int y) { return BlockVector3.at(x, y, z); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof BlockVector2 other)) { - return false; - } - - return other.x == this.x && other.z == this.z; - - } - - @Override - public int hashCode() { - return (x << 16) ^ z; - } - @Override public String toString() { return "(" + x + ", " + z + ")"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java index 7c11ce0332..1e88233280 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java @@ -681,20 +681,6 @@ public Vector3 toVector3() { return Vector3.at(x, y, z); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof BlockVector3 other)) { - return false; - } - - return other.x == this.x && other.y == this.y && other.z == this.z; - } - - @Override - public int hashCode() { - return (x ^ (z << 12)) ^ (y << 24); - } - @Override public String toString() { return "(" + x + ", " + y + ", " + z + ")"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java index 65af7a0c3f..9838383694 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java @@ -465,24 +465,6 @@ public Vector3 toVector3(double y) { return Vector3.at(x, y, z); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector2 other)) { - return false; - } - - return other.x == this.x && other.z == this.z; - - } - - @Override - public int hashCode() { - int hash = 17; - hash = 31 * hash + Double.hashCode(x); - hash = 31 * hash + Double.hashCode(z); - return hash; - } - @Override public String toString() { return "(" + x + ", " + z + ")"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java index 7af6d5507c..e545d6238e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java @@ -604,24 +604,6 @@ public Vector2 toVector2() { return Vector2.at(x, z); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector3 other)) { - return false; - } - - return other.x == this.x && other.y == this.y && other.z == this.z; - } - - @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; - } - @Override public String toString() { return "(" + x + ", " + y + ", " + z + ")";