From a37ee09f172cb77addf8d8716f4412b869e42b4f Mon Sep 17 00:00:00 2001 From: kanesada2 Date: Thu, 29 Dec 2016 16:53:56 +0900 Subject: [PATCH] fix #2979 --- .../util/blockmeta/HashChunkletManager.java | 33 ++++++++++++++++++- .../blockmeta/chunkmeta/HashChunkManager.java | 22 +++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java index fa970e58d..d028611b2 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java @@ -187,6 +187,17 @@ public class HashChunkletManager implements ChunkletManager { int cx = x / 16; int cz = z / 16; int cy = y / 64; + + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } + if(y < 0){ + --cy; + } + String key = world.getName() + "," + cx + "," + cz + "," + cy; if (!store.containsKey(key)) { @@ -215,7 +226,17 @@ public class HashChunkletManager implements ChunkletManager { int cx = x / 16; int cz = z / 16; int cy = y / 64; - + + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } + if(y < 0){ + --cy; + } + int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; int iy = Math.abs(y) % 64; @@ -248,6 +269,16 @@ public class HashChunkletManager implements ChunkletManager { int cz = z / 16; int cy = y / 64; + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } + if(y < 0){ + --cy; + } + int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; int iy = Math.abs(y) % 64; diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index 44a2398e0..078bdd401 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -295,6 +295,14 @@ public class HashChunkManager implements ChunkManager { int cx = x / 16; int cz = z / 16; + + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } + String key = world.getName() + "," + cx + "," + cz; if (!store.containsKey(key)) { @@ -339,6 +347,13 @@ public class HashChunkManager implements ChunkManager { int cx = x / 16; int cz = z / 16; + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } + int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; @@ -384,6 +399,13 @@ public class HashChunkManager implements ChunkManager { int cx = x / 16; int cz = z / 16; + + if(x < 0){ + --cx; + } + if(z < 0){ + --cz; + } int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16;