Browse Source

Additional changes that are less important but related to the dupe fix.

t00thpick1 7 years ago
parent
commit
87ebf7023f

+ 5 - 4
src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java

@@ -5,6 +5,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.UUID;
 
+import org.bukkit.Bukkit;
 import org.bukkit.World;
 
 import com.gmail.nossr50.util.blockmeta.ChunkletStore;
@@ -72,7 +73,7 @@ public class PrimitiveChunkStore implements ChunkStore {
     public boolean isEmpty() {
         for (int x = 0; x < 16; x++) {
             for (int z = 0; z < 16; z++) {
-                for (int y = 0; y < store.length; y++) {
+                for (int y = 0; y < store[0][0].length; y++) {
                     if (store[x][z][y]) {
                         return false;
                     }
@@ -86,7 +87,7 @@ public class PrimitiveChunkStore implements ChunkStore {
     public void copyFrom(ChunkletStore otherStore) {
         for (int x = 0; x < 16; x++) {
             for (int z = 0; z < 16; z++) {
-                for (int y = 0; y < store.length; y++) {
+                for (int y = 0; y < store[0][0].length; y++) {
                     store[x][z][y] = otherStore.isTrue(x, y, z);
                 }
             }
@@ -132,10 +133,10 @@ public class PrimitiveChunkStore implements ChunkStore {
 
     private void fixArray() {
         boolean[][][] temp = this.store;
-        this.store = new boolean[16][16][temp.length];
+        this.store = new boolean[16][16][Bukkit.getWorld(worldUid).getMaxHeight()];
         for (int x = 0; x < 16; x++) {
             for (int z = 0; z < 16; z++) {
-                for (int y = 0; y < temp.length; y++) {
+                for (int y = 0; y < store[0][0].length; y++) {
                     try {
                         store[x][z][y] = temp[x][y][z];
                     }