diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index 5c6d36551..7e741c6de 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -71,7 +71,7 @@ public class WorldListener implements Listener { manager.loadChunk(cx, cz, world); - for(int y = 0; y < 4; y++) { + for(int y = 0; y < (world.getMaxHeight() / 64); y++) { String chunkletName = world.getName() + "," + cx + "," + cz + "," + y; ChunkletStore tempChunklet = manager.store.get(chunkletName); PrimitiveChunkletStore primitiveChunklet = null; @@ -120,6 +120,10 @@ public class WorldListener implements Listener { else return; boolean[] newArray = cChunk.store[x][z]; + if(oldArray.length < 64) + return; + else if(newArray.length < ((y * 64) + 64)) + return; System.arraycopy(oldArray, 0, newArray, (y * 64), 64); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/BlockStoreConversionZDirectory.java b/src/main/java/com/gmail/nossr50/runnables/BlockStoreConversionZDirectory.java index e201c4abb..ad528b03f 100755 --- a/src/main/java/com/gmail/nossr50/runnables/BlockStoreConversionZDirectory.java +++ b/src/main/java/com/gmail/nossr50/runnables/BlockStoreConversionZDirectory.java @@ -82,7 +82,7 @@ public class BlockStoreConversionZDirectory implements Runnable { this.manager.loadChunk(this.cx, this.cz, this.world); - for(this.y = 0; this.y < 4; this.y++) { + for(this.y = 0; this.y < (this.world.getMaxHeight() / 64); this.y++) { this.chunkletName = this.world.getName() + "," + this.cx + "," + this.cz + "," + this.y; this.tempChunklet = this.manager.store.get(this.chunkletName); if(this.tempChunklet instanceof PrimitiveChunkletStore) @@ -128,6 +128,10 @@ public class BlockStoreConversionZDirectory implements Runnable { else return; this.newArray = this.currentChunk.store[x][z]; + if(this.oldArray.length < 64) + return; + else if(this.newArray.length < ((this.y * 64) + 64)) + return; System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); } }