Skip to content

Commit 9a26907

Browse files
committed
generate a hashcode method
1 parent 2a1241c commit 9a26907

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/main/java/mekanism/client/render/lib/Outlines.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,14 @@ public static Line from(Vector3f v1, Vector3f v2) {
8888
}
8989

9090
private static int calculateHash(float x1, float y1, float z1, float x2, float y2, float z2) {
91-
float minX = Math.min(x1, x2);
92-
float minY = Math.min(y1, y2);
93-
float minZ = Math.min(z1, z2);
94-
float maxX = Math.max(x1, x2);
95-
float maxY = Math.max(x1, x2);
96-
float maxZ = Math.max(x1, x2);
9791
//Supports up to a scale of 0.005 in the json (which the miner uses for LEDs)
98-
return Objects.hash(
99-
(long) (minX * 3_200),
100-
(long) (minY * 3_200),
101-
(long) (minZ * 3_200),
102-
(long) (maxX * 3_200),
103-
(long) (maxY * 3_200),
104-
(long) (maxZ * 3_200)
105-
);
92+
int result = Long.hashCode((long) Math.min(x1, x2) * 3_200);
93+
result = 31 * result + Long.hashCode((long) Math.min(y1, y2) * 3_200);
94+
result = 31 * result + Long.hashCode((long) Math.min(z1, z2) * 3_200);
95+
result = 31 * result + Long.hashCode((long) Math.max(x1, x2) * 3_200);
96+
result = 31 * result + Long.hashCode((long) Math.max(x1, x2) * 3_200);
97+
result = 31 * result + Long.hashCode((long) Math.max(x1, x2) * 3_200);
98+
return result;
10699
}
107100

108101
@Override

0 commit comments

Comments
 (0)