mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
optimise equals and hashCode of SeededVector
This commit is contained in:
parent
9f6dcfd71b
commit
1aa73bf742
@ -16,6 +16,7 @@ import net.jafama.FastMath;
|
|||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
@ -111,5 +112,19 @@ public class BiomePipelineProvider implements BiomeProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private record SeededVector(int x, int z, long seed) {
|
private record SeededVector(int x, int z, long seed) {
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(obj instanceof SeededVector that) {
|
||||||
|
return this.z == that.z && this.x == that.x && this.seed == that.seed;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int code = x;
|
||||||
|
code = 31 * code + z;
|
||||||
|
return 31 * code + ((int) (seed ^ (seed >>> 32)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user