13
0
geforkt von Mirrors/Paper
Paper/nms-patches/DataPaletteBlock.patch
Thinkofdeath c126d6101e Backport a bug fix from the pre-release
A mistake in the buffer size calculation caused the buffer for chunk
packets to be around 16 times the size they should have been.
2016-03-10 19:47:48 +00:00

34 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/DataPaletteBlock.java
+++ b/net/minecraft/server/DataPaletteBlock.java
@@ -109,7 +109,21 @@
int i1 = nibblearray1 == null ? 0 : nibblearray1.a(j, k, l);
int j1 = i1 << 12 | (abyte[i] & 255) << 4 | nibblearray.a(j, k, l);
- this.setBlockIndex(i, (IBlockData) Block.REGISTRY_ID.fromId(j1));
+ // CraftBukkit start - fix blocks with random data values (caused by plugins)
+ IBlockData data = Block.REGISTRY_ID.fromId(j1);
+ if (data == null) {
+ Block block = Block.getById(j1 >> 4);
+ if (block != null) {
+ try {
+ data = block.fromLegacyData(j1 & 0xF);
+ } catch (Exception ignored) {
+ data = block.getBlockData();
+ }
+ }
+ }
+ this.setBlockIndex(i, data);
+ // this.setBlockIndex(i, (IBlockData) Block.REGISTRY_ID.fromId(j1));
+ // CraftBukkit end
}
}
@@ -117,6 +131,6 @@
public int a() {
int i = this.b.b();
- return 1 + this.c.a() + PacketDataSerializer.a(i) + i * 8;
+ return 1 + this.c.a() + PacketDataSerializer.a(i) + this.b.a().length * 8; // CraftBukkit - Backport fix, remove on update
}
}