Explorar o código

Fix a duping bug that uses a coordinate error. Fixes #2979 and fixes #3429.

Glitchfinder %!s(int64=7) %!d(string=hai) anos
pai
achega
be2de1d487

+ 10 - 9
src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java

@@ -184,9 +184,10 @@ public class HashChunkletManager implements ChunkletManager {
 
     @Override
     public boolean isTrue(int x, int y, int z, World world) {
-        int cx = x / 16;
-        int cz = z / 16;
-        int cy = y / 64;
+        int cx = x >> 4;
+        int cz = z >> 4;
+        int cy = y >> 6;
+
         String key = world.getName() + "," + cx + "," + cz + "," + cy;
 
         if (!store.containsKey(key)) {
@@ -212,9 +213,9 @@ public class HashChunkletManager implements ChunkletManager {
 
     @Override
     public void setTrue(int x, int y, int z, World world) {
-        int cx = x / 16;
-        int cz = z / 16;
-        int cy = y / 64;
+        int cx = x >> 4;
+        int cz = z >> 4;
+        int cy = y >> 6;
 
         int ix = Math.abs(x) % 16;
         int iz = Math.abs(z) % 16;
@@ -244,9 +245,9 @@ public class HashChunkletManager implements ChunkletManager {
 
     @Override
     public void setFalse(int x, int y, int z, World world) {
-        int cx = x / 16;
-        int cz = z / 16;
-        int cy = y / 64;
+        int cx = x >> 4;
+        int cz = z >> 4;
+        int cy = y >> 6;
 
         int ix = Math.abs(x) % 16;
         int iz = Math.abs(z) % 16;

+ 7 - 6
src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java

@@ -293,8 +293,9 @@ public class HashChunkManager implements ChunkManager {
             return false;
         }
 
-        int cx = x / 16;
-        int cz = z / 16;
+        int cx = x >> 4;
+        int cz = z >> 4;
+
         String key = world.getName() + "," + cx + "," + cz;
 
         if (!store.containsKey(key)) {
@@ -336,8 +337,8 @@ public class HashChunkManager implements ChunkManager {
             return;
         }
 
-        int cx = x / 16;
-        int cz = z / 16;
+        int cx = x >> 4;
+        int cz = z >> 4;
 
         int ix = Math.abs(x) % 16;
         int iz = Math.abs(z) % 16;
@@ -382,8 +383,8 @@ public class HashChunkManager implements ChunkManager {
             return;
         }
 
-        int cx = x / 16;
-        int cz = z / 16;
+        int cx = x >> 4;
+        int cz = z >> 4;
 
         int ix = Math.abs(x) % 16;
         int iz = Math.abs(z) % 16;