Skip to content

Commit

Permalink
Improve block sorting when building
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursivePineapple committed Feb 12, 2025
1 parent e1f19c9 commit 96b2b65
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,9 @@ public boolean equals(Object obj) {
*/
public static Comparator<PendingBlock> getComparator() {
return Comparator.comparingInt((PendingBlock b) -> b.buildOrder)
.thenComparing(Comparator.comparing(b -> b.spec, ImmutableBlockSpec.getComparator()))
.thenComparingLong(b -> {
int chunkX = b.x >> 4;
int chunkZ = b.z >> 4;

return (long) chunkX | (long) (chunkZ << 32);
})
.thenComparing(b -> b.spec, ImmutableBlockSpec.getComparator())
.thenComparingInt(b -> b.x >> 4)
.thenComparingInt(b -> b.z >> 4)
.thenComparingInt(b -> Objects.hash(b.gt, b.ae, b.arch, b.mp, b.inventory));
}

Expand Down

0 comments on commit 96b2b65

Please sign in to comment.