From fa4078a2d6a41f1aecdd1aba5d90ee670292710e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 17:12:38 +1100 Subject: [PATCH] "It Compiles" - Update Spigot to Minecraft 1.7.2 proper. See below for full release notes (MUST READ). This is a lightly tested build. You are encouraged to keep backups at all times. Please attempt to report all issues to IRC. The following features are intentionally missing from this build and will be added as soon as humanly possible. - BungeeCord IP forwarding - Firing of AsyncLoginEvent in offline mode - A few custom kick / other hardcoded messages As always this build comes with no warranty. Thanks for your support. ~md_5 --- CraftBukkit-Patches/0002-mc-dev-imports.patch | 198 +++++++++++++++++- .../0013-Compressed-Nibble-Arrays.patch | 49 ++++- CraftBukkit-Patches/0017-Orebfuscator.patch | 14 +- .../0046-Lower-Chunk-Compression.patch | 15 +- .../0052-Player-Collision-API.patch | 24 +-- 5 files changed, 284 insertions(+), 16 deletions(-) diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index b4e6a6e..bb01f23 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -1,4 +1,4 @@ -From 5df0962615a66779058f3ca87ea05ac17be54059 Mon Sep 17 00:00:00 2001 +From f820823194d6cde4ea5396e0caa36e160f5f2c3e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 15:10:48 +1100 Subject: [PATCH] mc-dev imports @@ -443,6 +443,202 @@ index 0000000..fcb9912 + } + } +} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +new file mode 100644 +index 0000000..c7b799a +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -0,0 +1,190 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.zip.DataFormatException; ++import java.util.zip.Deflater; ++import java.util.zip.Inflater; ++ ++public class PacketPlayOutMapChunk extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private byte[] e; ++ private byte[] buffer; ++ private boolean inflatedBuffer; ++ private int size; ++ private static byte[] buildBuffer = new byte[196864]; ++ ++ public PacketPlayOutMapChunk() {} ++ ++ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { ++ this.a = chunk.locX; ++ this.b = chunk.locZ; ++ this.inflatedBuffer = flag; ++ ChunkMap chunkmap = a(chunk, flag, i); ++ Deflater deflater = new Deflater(-1); ++ ++ this.d = chunkmap.c; ++ this.c = chunkmap.b; ++ ++ try { ++ this.buffer = chunkmap.a; ++ deflater.setInput(chunkmap.a, 0, chunkmap.a.length); ++ deflater.finish(); ++ this.e = new byte[chunkmap.a.length]; ++ this.size = deflater.deflate(this.e); ++ } finally { ++ deflater.end(); ++ } ++ } ++ ++ public static int c() { ++ return 196864; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ this.inflatedBuffer = packetdataserializer.readBoolean(); ++ this.c = packetdataserializer.readShort(); ++ this.d = packetdataserializer.readShort(); ++ this.size = packetdataserializer.readInt(); ++ if (buildBuffer.length < this.size) { ++ buildBuffer = new byte[this.size]; ++ } ++ ++ packetdataserializer.readBytes(buildBuffer, 0, this.size); ++ int i = 0; ++ ++ int j; ++ ++ for (j = 0; j < 16; ++j) { ++ i += this.c >> j & 1; ++ } ++ ++ j = 12288 * i; ++ if (this.inflatedBuffer) { ++ j += 256; ++ } ++ ++ this.buffer = new byte[j]; ++ Inflater inflater = new Inflater(); ++ ++ inflater.setInput(buildBuffer, 0, this.size); ++ ++ try { ++ inflater.inflate(this.buffer); ++ } catch (DataFormatException dataformatexception) { ++ throw new IOException("Bad compressed data format"); ++ } finally { ++ inflater.end(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeBoolean(this.inflatedBuffer); ++ packetdataserializer.writeShort((short) (this.c & '\uffff')); ++ packetdataserializer.writeShort((short) (this.d & '\uffff')); ++ packetdataserializer.writeInt(this.size); ++ packetdataserializer.writeBytes(this.e, 0, this.size); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("x=%d, z=%d, full=%b, sects=%d, add=%d, size=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Boolean.valueOf(this.inflatedBuffer), Integer.valueOf(this.c), Integer.valueOf(this.d), Integer.valueOf(this.size)}); ++ } ++ ++ public static ChunkMap a(Chunk chunk, boolean flag, int i) { ++ int j = 0; ++ ChunkSection[] achunksection = chunk.i(); ++ int k = 0; ++ ChunkMap chunkmap = new ChunkMap(); ++ byte[] abyte = buildBuffer; ++ ++ if (flag) { ++ chunk.q = true; ++ } ++ ++ int l; ++ ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { ++ chunkmap.b |= 1 << l; ++ if (achunksection[l].getExtendedIdArray() != null) { ++ chunkmap.c |= 1 << l; ++ ++k; ++ } ++ } ++ } ++ ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { ++ byte[] abyte1 = achunksection[l].getIdArray(); ++ ++ System.arraycopy(abyte1, 0, abyte, j, abyte1.length); ++ j += abyte1.length; ++ } ++ } ++ ++ NibbleArray nibblearray; ++ ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { ++ nibblearray = achunksection[l].getDataArray(); ++ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); ++ j += nibblearray.a.length; ++ } ++ } ++ ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { ++ nibblearray = achunksection[l].getEmittedLightArray(); ++ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); ++ j += nibblearray.a.length; ++ } ++ } ++ ++ if (!chunk.world.worldProvider.g) { ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { ++ nibblearray = achunksection[l].getSkyLightArray(); ++ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); ++ j += nibblearray.a.length; ++ } ++ } ++ } ++ ++ if (k > 0) { ++ for (l = 0; l < achunksection.length; ++l) { ++ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) { ++ nibblearray = achunksection[l].getExtendedIdArray(); ++ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); ++ j += nibblearray.a.length; ++ } ++ } ++ } ++ ++ if (flag) { ++ byte[] abyte2 = chunk.m(); ++ ++ System.arraycopy(abyte2, 0, abyte, j, abyte2.length); ++ j += abyte2.length; ++ } ++ ++ chunkmap.a = new byte[j]; ++ System.arraycopy(abyte, 0, chunkmap.a, 0, j); ++ return chunkmap; ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java new file mode 100644 index 0000000..900ed68 diff --git a/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch b/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch index bab8a1e..7ea7cb9 100644 --- a/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch +++ b/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch @@ -1,4 +1,4 @@ -From 21428931e905c898c8272765539255bcb802c19e Mon Sep 17 00:00:00 2001 +From cb6a4e3598f76edb4743ae4041a135b7913793bc Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 13 Jan 2013 03:49:07 -0800 Subject: [PATCH] Compressed Nibble Arrays @@ -270,6 +270,53 @@ index fcb9912..6ee28cc 100644 nbttaglist.add(nbttagcompound1); } } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index c7b799a..856e825 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -138,16 +138,16 @@ public class PacketPlayOutMapChunk extends Packet { + for (l = 0; l < achunksection.length; ++l) { + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getDataArray(); +- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); +- j += nibblearray.a.length; ++ nibblearray.copyToByteArray(abyte, j); ++ j += nibblearray.getByteLength(); + } + } + + for (l = 0; l < achunksection.length; ++l) { + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getEmittedLightArray(); +- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); +- j += nibblearray.a.length; ++ nibblearray.copyToByteArray(abyte, j); ++ j += nibblearray.getByteLength(); + } + } + +@@ -155,8 +155,8 @@ public class PacketPlayOutMapChunk extends Packet { + for (l = 0; l < achunksection.length; ++l) { + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getSkyLightArray(); +- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); +- j += nibblearray.a.length; ++ nibblearray.copyToByteArray(abyte, j); ++ j += nibblearray.getByteLength(); + } + } + } +@@ -165,8 +165,8 @@ public class PacketPlayOutMapChunk extends Packet { + for (l = 0; l < achunksection.length; ++l) { + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getExtendedIdArray(); +- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); +- j += nibblearray.a.length; ++ nibblearray.copyToByteArray(abyte, j); ++ j += nibblearray.getByteLength(); + } + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index b2c6ef4..55f5225 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/CraftBukkit-Patches/0017-Orebfuscator.patch b/CraftBukkit-Patches/0017-Orebfuscator.patch index 93e982c..768f178 100644 --- a/CraftBukkit-Patches/0017-Orebfuscator.patch +++ b/CraftBukkit-Patches/0017-Orebfuscator.patch @@ -1,4 +1,4 @@ -From b6377ce207cad41a8ff913d19889573b70a245ff Mon Sep 17 00:00:00 2001 +From f6ae5fd819d9eec7c5fac9f58d43065bf344d962 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 16 May 2013 18:51:05 +1000 Subject: [PATCH] Orebfuscator @@ -36,6 +36,18 @@ index 39e5b5b..d2587c1 100644 if (flag) { double d0 = (double) ((float) i + this.world.random.nextFloat()); double d1 = (double) ((float) j + this.world.random.nextFloat()); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index 856e825..7169ec8 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -28,6 +28,7 @@ public class PacketPlayOutMapChunk extends Packet { + + this.d = chunkmap.c; + this.c = chunkmap.b; ++ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot + + try { + this.buffer = chunkmap.a; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java index 3eac231..c3cfdc7 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java diff --git a/CraftBukkit-Patches/0046-Lower-Chunk-Compression.patch b/CraftBukkit-Patches/0046-Lower-Chunk-Compression.patch index 56ab214..6205816 100644 --- a/CraftBukkit-Patches/0046-Lower-Chunk-Compression.patch +++ b/CraftBukkit-Patches/0046-Lower-Chunk-Compression.patch @@ -1,10 +1,23 @@ -From 466df5e17f27655c88c8047ac2ffa10f2b3a1998 Mon Sep 17 00:00:00 2001 +From 5ba3d91a29c49fa5b5d8a98930126132d480fb3c Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 09:07:54 +1000 Subject: [PATCH] Lower Chunk Compression Use a chunk compression level of 4 - this provides an optimal balance between speed and compression. +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index 7169ec8..3006712 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -24,7 +24,7 @@ public class PacketPlayOutMapChunk extends Packet { + this.b = chunk.locZ; + this.inflatedBuffer = flag; + ChunkMap chunkmap = a(chunk, flag, i); +- Deflater deflater = new Deflater(-1); ++ Deflater deflater = new Deflater(4); // Spigot + + this.d = chunkmap.c; + this.c = chunkmap.b; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java index c3cfdc7..8e1c4cb 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java diff --git a/CraftBukkit-Patches/0052-Player-Collision-API.patch b/CraftBukkit-Patches/0052-Player-Collision-API.patch index 4eec39c..c33a4ff 100644 --- a/CraftBukkit-Patches/0052-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0052-Player-Collision-API.patch @@ -1,11 +1,11 @@ -From d91a8eb52fb822cea177f0ad19670574f2858c64 Mon Sep 17 00:00:00 2001 +From ebf483597d7c2d7071a1fe7c2012fc3f9c946f09 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:27:07 +1000 Subject: [PATCH] Player Collision API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 7442943..14f5510 100644 +index 7442943..f034d30 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -430,7 +430,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen @@ -13,12 +13,12 @@ index 7442943..14f5510 100644 List list = this.world.getEntities(this, axisalignedbb); - if (list != null) { -+ if (list != null && this.L()) { // Spigot: Add this.L() condition ++ if (list != null && this.R()) { // Spigot: Add this.R() condition for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index a61001d..35d30f1 100644 +index a61001d..24a59eb 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1478,7 +1478,7 @@ public abstract class EntityLiving extends Entity { @@ -26,12 +26,12 @@ index a61001d..35d30f1 100644 List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) { -+ if (this.L() && list != null && !list.isEmpty()) { // Spigot: Add this.L() condition ++ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index af08d2f..12e90cc 100644 +index af08d2f..d910e8a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -64,6 +64,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -42,16 +42,16 @@ index af08d2f..12e90cc 100644 + public boolean collidesWithEntities = true; + + @Override ++ public boolean R() ++ { ++ return this.collidesWithEntities && super.R(); ++ } ++ ++ @Override + public boolean S() + { + return this.collidesWithEntities && super.S(); + } -+ -+ /*@Override -+ public boolean M() -+ { -+ return this.collidesWithEntities && super.M(); -+ }*/ // SPIGOT TODO + // Spigot end public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {