Skip to content

Commit

Permalink
Drop custom equals and hashCode methods in Vector/BlockVector classes
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Mar 2, 2024
1 parent 4a404f1 commit 96c9d38
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
Expand Down
18 changes: 0 additions & 18 deletions worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
Expand Down
18 changes: 0 additions & 18 deletions worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")";
Expand Down

0 comments on commit 96c9d38

Please sign in to comment.