Optimize the invalid block fixing

This commit is contained in:
Thinkofdeath 2014-11-29 23:25:17 +00:00
parent 0f552845d0
commit cef65526d4

View file

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-29 20:00:36.009119253 +0000
+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-29 20:00:18.677119638 +0000
--- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:25:09.296846856 +0000
+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:24:59.400847076 +0000
@@ -23,8 +23,40 @@
public ChunkRegionLoader(File file) {
this.e = file;
@ -107,7 +107,7 @@
DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
@@ -302,8 +358,32 @@
@@ -302,8 +358,27 @@
int j1 = l >> 8 & 15;
int k1 = l >> 4 & 15;
int l1 = nibblearray1 != null ? nibblearray1.a(i1, j1, k1) : 0;
@ -127,12 +127,7 @@
+ try {
+ data = block.toLegacyData(block.fromLegacyData(data));
+ } catch (Exception ignored) {
+ for (data = 0; data <= 15; data++) {
+ packed = ex << 12 | id << 4 | data;
+ if (Block.d.a(packed) != null) {
+ break;
+ }
+ }
+ data = block.toLegacyData(block.getBlockData());
+ }
+ packed = ex << 12 | id << 4 | data;
+ }
@ -142,7 +137,7 @@
}
chunksection.a(achar);
@@ -320,7 +400,13 @@
@@ -320,7 +395,13 @@
if (nbttagcompound.hasKeyOfType("Biomes", 7)) {
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@ -156,7 +151,7 @@
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
@@ -379,6 +465,6 @@
@@ -379,6 +460,6 @@
}
}