diff --git a/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java b/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java index 161edf18..424d9151 100644 --- a/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java +++ b/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitChunk_1_7.java @@ -32,6 +32,11 @@ public class BukkitChunk_1_7 extends CharFaweChunk { return datas[i]; } + @Override + public void setBlock(int x, int y, int z, int id) { + this.setBlock(x, y, z, id, 0); + } + @Override public void setBlock(int x, int y, int z, int id, int data) { int i = FaweCache.CACHE_I[y][z][x]; @@ -47,8 +52,7 @@ public class BukkitChunk_1_7 extends CharFaweChunk { this.count[i]++; switch (id) { case 0: - this.air[i]++; - vs[j] = -1; + vs[j] = 0; vs2[j] = (char) 1; return; case 11: @@ -62,81 +66,19 @@ public class BukkitChunk_1_7 extends CharFaweChunk { case 138: case 169: case 213: - this.relight[i]++; - case 2: - case 4: - case 13: - case 14: - case 15: - case 20: - case 21: - case 22: - case 30: - case 32: - case 37: - case 41: - case 42: - case 45: - case 46: - case 47: - case 48: - case 49: - case 55: - case 56: - case 57: - case 58: - case 60: - case 7: - case 73: - case 79: - case 80: - case 81: - case 82: - case 83: - case 85: - case 87: - case 88: - case 101: - case 102: - case 103: - case 110: - case 112: - case 113: - case 121: - case 129: - case 133: - case 165: - case 166: - case 170: - case 172: - case 173: - case 174: - case 188: - case 189: - case 190: - case 191: - case 192: - vs[j] = (byte) (id); - vs2[j] = (char) (id << 4); - return; case 130: case 76: case 62: case 50: case 10: this.relight[i]++; - case 54: - case 146: - case 61: - case 65: - case 68: // removed default: vs2[j] = (char) ((id << 4) + data); vs[j] = (byte) id; if (data != 0) { NibbleArray dataArray = datas[i]; if (dataArray == null) { - datas[i] = dataArray = new NibbleArray(4096, 4); + datas[i] = dataArray = new NibbleArray(new byte[2048], 4); } dataArray.a(x, y & 15, z, data); } diff --git a/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitQueue17.java b/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitQueue17.java index ff16f4c6..a7a53a41 100644 --- a/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitQueue17.java +++ b/bukkit1710/src/main/java/com/boydti/fawe/bukkit/v1_7/BukkitQueue17.java @@ -65,9 +65,22 @@ import org.bukkit.generator.ChunkGenerator; public class BukkitQueue17 extends BukkitQueue_0 { + private static Field fieldData; + private static Field fieldIds; + public BukkitQueue17(final String world) { super(world); checkVersion("v1_7_R4"); + if (fieldData == null) { + try { + fieldData = ChunkSection.class.getDeclaredField("blockData"); + fieldData.setAccessible(true); + fieldIds = ChunkSection.class.getDeclaredField("blockIds"); + fieldIds.setAccessible(true); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + } } @Override @@ -358,24 +371,31 @@ public class BukkitQueue17 extends BukkitQueue_0= 4096)) { sections[j] = section = new ChunkSection(j << 4, flag); section.setIdArray(newIdArray); - section.setDataArray(newDataArray); + if (newDataArray != null) { + section.setDataArray(newDataArray); + } continue; } - byte[] currentIdArray = section.getIdArray(); - NibbleArray currentDataArray = section.getDataArray(); + byte[] currentIdArray = (byte[]) fieldIds.get(section); + NibbleArray currentDataArray = (NibbleArray) fieldData.get(section); boolean data = currentDataArray != null; - if (!data) { + if (!data && newDataArray != null) { section.setDataArray(newDataArray); } + if (currentIdArray == null) { + section.setIdArray(newIdArray); + continue; + } boolean fill = true; int solid = 0; + char[] charArray = fs.getIdArray(j); for (int k = 0; k < newIdArray.length; k++) { - byte n = newIdArray[k]; - switch (n) { + char combined = charArray[k]; + switch (combined) { case 0: fill = false; continue; - case -1: + case 1: fill = false; if (currentIdArray[k] != 0) { solid++; @@ -384,16 +404,14 @@ public class BukkitQueue17 extends BukkitQueue_0