diff --git a/Bukkit-Patches/0031-Skip-loading-of-ProtocolLib-and-Orebfuscator.patch b/Bukkit-Patches/0031-Skip-loading-of-ProtocolLib-and-Orebfuscator.patch new file mode 100644 index 0000000000..bee65d3236 --- /dev/null +++ b/Bukkit-Patches/0031-Skip-loading-of-ProtocolLib-and-Orebfuscator.patch @@ -0,0 +1,33 @@ +From 55d719bb45bb3b91b3b540142c568504b3e7f4c9 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Mon, 1 Sep 2014 19:36:20 +1000 +Subject: [PATCH] Skip loading of ProtocolLib and Orebfuscator. + +As it does not work with Spigot 1.8 builds! + +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index 1d51908..c7ad532 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -132,6 +132,18 @@ public final class SimplePluginManager implements PluginManager { + try { + description = loader.getPluginDescription(file); + String name = description.getName(); ++ // Spigot Start ++ if ( name.equalsIgnoreCase( "ProtocolLib" ) ) ++ { ++ server.getLogger().log( Level.WARNING, "Skipping loading of ProtocolLib as it does not work with Spigot 1.8 builds!" ); ++ continue; ++ } ++ if ( name.equalsIgnoreCase( "Orebfuscator" ) ) ++ { ++ server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); ++ continue; ++ } ++ // Spigot End + if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { + server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name"); + continue; +-- +1.9.1 + diff --git a/CraftBukkit-Patches/0179-Snapshot-imports.patch b/CraftBukkit-Patches/0179-Snapshot-imports.patch new file mode 100644 index 0000000000..8d04866494 --- /dev/null +++ b/CraftBukkit-Patches/0179-Snapshot-imports.patch @@ -0,0 +1,3254 @@ +From 7ab42b1266d4c8a7974b16cfdf3715e4891d58fd Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Mon, 1 Sep 2014 16:47:48 +1000 +Subject: [PATCH] Snapshot imports + + +diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java +new file mode 100644 +index 0000000..770da8f +--- /dev/null ++++ b/src/main/java/net/minecraft/server/MerchantRecipe.java +@@ -0,0 +1,101 @@ ++package net.minecraft.server; ++ ++public class MerchantRecipe { ++ ++ private ItemStack buyingItem1; ++ private ItemStack buyingItem2; ++ private ItemStack sellingItem; ++ private int uses; ++ private int maxUses; ++ ++ public MerchantRecipe(NBTTagCompound nbttagcompound) { ++ this.a(nbttagcompound); ++ } ++ ++ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) { ++ this.buyingItem1 = itemstack; ++ this.buyingItem2 = itemstack1; ++ this.sellingItem = itemstack2; ++ this.maxUses = 7; ++ } ++ ++ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1) { ++ this(itemstack, (ItemStack) null, itemstack1); ++ } ++ ++ public MerchantRecipe(ItemStack itemstack, Item item) { ++ this(itemstack, new ItemStack(item)); ++ } ++ ++ public ItemStack getBuyItem1() { ++ return this.buyingItem1; ++ } ++ ++ public ItemStack getBuyItem2() { ++ return this.buyingItem2; ++ } ++ ++ public boolean hasSecondItem() { ++ return this.buyingItem2 != null; ++ } ++ ++ public ItemStack getBuyItem3() { ++ return this.sellingItem; ++ } ++ ++ public boolean a(MerchantRecipe merchantrecipe) { ++ return this.buyingItem1.getItem() == merchantrecipe.buyingItem1.getItem() && this.sellingItem.getItem() == merchantrecipe.sellingItem.getItem() ? this.buyingItem2 == null && merchantrecipe.buyingItem2 == null || this.buyingItem2 != null && merchantrecipe.buyingItem2 != null && this.buyingItem2.getItem() == merchantrecipe.buyingItem2.getItem() : false; ++ } ++ ++ public boolean b(MerchantRecipe merchantrecipe) { ++ return this.a(merchantrecipe) && (this.buyingItem1.count < merchantrecipe.buyingItem1.count || this.buyingItem2 != null && this.buyingItem2.count < merchantrecipe.buyingItem2.count); ++ } ++ ++ public void f() { ++ ++this.uses; ++ } ++ ++ public void a(int i) { ++ this.maxUses += i; ++ } ++ ++ public boolean g() { ++ return this.uses >= this.maxUses; ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("buy"); ++ ++ this.buyingItem1 = ItemStack.createStack(nbttagcompound1); ++ NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("sell"); ++ ++ this.sellingItem = ItemStack.createStack(nbttagcompound2); ++ if (nbttagcompound.hasKeyOfType("buyB", 10)) { ++ this.buyingItem2 = ItemStack.createStack(nbttagcompound.getCompound("buyB")); ++ } ++ ++ if (nbttagcompound.hasKeyOfType("uses", 99)) { ++ this.uses = nbttagcompound.getInt("uses"); ++ } ++ ++ if (nbttagcompound.hasKeyOfType("maxUses", 99)) { ++ this.maxUses = nbttagcompound.getInt("maxUses"); ++ } else { ++ this.maxUses = 7; ++ } ++ } ++ ++ public NBTTagCompound i() { ++ NBTTagCompound nbttagcompound = new NBTTagCompound(); ++ ++ nbttagcompound.set("buy", this.buyingItem1.save(new NBTTagCompound())); ++ nbttagcompound.set("sell", this.sellingItem.save(new NBTTagCompound())); ++ if (this.buyingItem2 != null) { ++ nbttagcompound.set("buyB", this.buyingItem2.save(new NBTTagCompound())); ++ } ++ ++ nbttagcompound.setInt("uses", this.uses); ++ nbttagcompound.setInt("maxUses", this.maxUses); ++ return nbttagcompound; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java +new file mode 100644 +index 0000000..be6ab25 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java +@@ -0,0 +1,89 @@ ++package net.minecraft.server; ++ ++import java.util.ArrayList; ++ ++public class MerchantRecipeList extends ArrayList { ++ ++ public MerchantRecipeList() {} ++ ++ public MerchantRecipeList(NBTTagCompound nbttagcompound) { ++ this.a(nbttagcompound); ++ } ++ ++ public MerchantRecipe a(ItemStack itemstack, ItemStack itemstack1, int i) { ++ if (i > 0 && i < this.size()) { ++ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); ++ ++ return itemstack.getItem() == merchantrecipe.getBuyItem1().getItem() && (itemstack1 == null && !merchantrecipe.hasSecondItem() || merchantrecipe.hasSecondItem() && itemstack1 != null && merchantrecipe.getBuyItem2().getItem() == itemstack1.getItem()) && itemstack.count >= merchantrecipe.getBuyItem1().count && (!merchantrecipe.hasSecondItem() || itemstack1.count >= merchantrecipe.getBuyItem2().count) ? merchantrecipe : null; ++ } else { ++ for (int j = 0; j < this.size(); ++j) { ++ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(j); ++ ++ if (itemstack.getItem() == merchantrecipe1.getBuyItem1().getItem() && itemstack.count >= merchantrecipe1.getBuyItem1().count && (!merchantrecipe1.hasSecondItem() && itemstack1 == null || merchantrecipe1.hasSecondItem() && itemstack1 != null && merchantrecipe1.getBuyItem2().getItem() == itemstack1.getItem() && itemstack1.count >= merchantrecipe1.getBuyItem2().count)) { ++ return merchantrecipe1; ++ } ++ } ++ ++ return null; ++ } ++ } ++ ++ public void a(MerchantRecipe merchantrecipe) { ++ for (int i = 0; i < this.size(); ++i) { ++ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(i); ++ ++ if (merchantrecipe.a(merchantrecipe1)) { ++ if (merchantrecipe.b(merchantrecipe1)) { ++ this.set(i, merchantrecipe); ++ } ++ ++ return; ++ } ++ } ++ ++ this.add(merchantrecipe); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte((byte) (this.size() & 255)); ++ ++ for (int i = 0; i < this.size(); ++i) { ++ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); ++ ++ packetdataserializer.a(merchantrecipe.getBuyItem1()); ++ packetdataserializer.a(merchantrecipe.getBuyItem3()); ++ ItemStack itemstack = merchantrecipe.getBuyItem2(); ++ ++ packetdataserializer.writeBoolean(itemstack != null); ++ if (itemstack != null) { ++ packetdataserializer.a(itemstack); ++ } ++ ++ packetdataserializer.writeBoolean(merchantrecipe.g()); ++ } ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ NBTTagList nbttaglist = nbttagcompound.getList("Recipes", 10); ++ ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ NBTTagCompound nbttagcompound1 = nbttaglist.get(i); ++ ++ this.add(new MerchantRecipe(nbttagcompound1)); ++ } ++ } ++ ++ public NBTTagCompound a() { ++ NBTTagCompound nbttagcompound = new NBTTagCompound(); ++ NBTTagList nbttaglist = new NBTTagList(); ++ ++ for (int i = 0; i < this.size(); ++i) { ++ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); ++ ++ nbttaglist.add(merchantrecipe.i()); ++ } ++ ++ nbttagcompound.set("Recipes", nbttaglist); ++ return nbttagcompound; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java +new file mode 100644 +index 0000000..71ec28c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketDecoder.java +@@ -0,0 +1,49 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++import net.minecraft.util.com.google.common.collect.BiMap; ++import net.minecraft.util.io.netty.buffer.ByteBuf; ++import net.minecraft.util.io.netty.channel.ChannelHandlerContext; ++import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++import org.apache.logging.log4j.Marker; ++import org.apache.logging.log4j.MarkerManager; ++ ++public class PacketDecoder extends ByteToMessageDecoder { ++ ++ private static final Logger a = LogManager.getLogger(); ++ private static final Marker b = MarkerManager.getMarker("PACKET_RECEIVED", NetworkManager.b); ++ private final NetworkStatistics c; ++ ++ public PacketDecoder(NetworkStatistics networkstatistics) { ++ this.c = networkstatistics; ++ } ++ ++ protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List list) throws IOException { ++ int i = bytebuf.readableBytes(); ++ ++ if (i != 0) { ++ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); ++ int j = packetdataserializer.a(); ++ Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j); ++ ++ if (packet == null) { ++ throw new IOException("Bad packet id " + j); ++ } else { ++ packet.a(packetdataserializer); ++ if (packetdataserializer.readableBytes() > 0) { ++ throw new IOException("Packet was larger than I expected, found " + packetdataserializer.readableBytes() + " bytes extra whilst reading packet " + j); ++ } else { ++ list.add(packet); ++ this.c.a(j, (long) i); ++ if (a.isDebugEnabled()) { ++ a.debug(b, " IN: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), Integer.valueOf(j), packet.getClass().getName(), packet.b()}); ++ } ++ } ++ } ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java +new file mode 100644 +index 0000000..91df585 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInArmAnimation extends Packet { ++ ++ private int a; ++ private int b; ++ ++ public PacketPlayInArmAnimation() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b)}); ++ } ++ ++ public int d() { ++ return this.b; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +new file mode 100644 +index 0000000..3c5ed45 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +@@ -0,0 +1,56 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInBlockDig extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int face; ++ private int e; ++ ++ public PacketPlayInBlockDig() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.e = packetdataserializer.readUnsignedByte(); ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ this.c = packetdataserializer.readInt(); ++ this.face = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.face); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public int d() { ++ return this.b; ++ } ++ ++ public int e() { ++ return this.c; ++ } ++ ++ public int f() { ++ return this.face; ++ } ++ ++ public int g() { ++ return this.e; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +new file mode 100644 +index 0000000..701b3a2 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +@@ -0,0 +1,77 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInBlockPlace extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private ItemStack e; ++ private float f; ++ private float g; ++ private float h; ++ ++ public PacketPlayInBlockPlace() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readUnsignedByte(); ++ this.e = packetdataserializer.c(); ++ this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F; ++ this.g = (float) packetdataserializer.readUnsignedByte() / 16.0F; ++ this.h = (float) packetdataserializer.readUnsignedByte() / 16.0F; ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.a(this.e); ++ packetdataserializer.writeByte((int) (this.f * 16.0F)); ++ packetdataserializer.writeByte((int) (this.g * 16.0F)); ++ packetdataserializer.writeByte((int) (this.h * 16.0F)); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public int d() { ++ return this.b; ++ } ++ ++ public int e() { ++ return this.c; ++ } ++ ++ public int getFace() { ++ return this.d; ++ } ++ ++ public ItemStack getItemStack() { ++ return this.e; ++ } ++ ++ public float h() { ++ return this.f; ++ } ++ ++ public float i() { ++ return this.g; ++ } ++ ++ public float j() { ++ return this.h; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +new file mode 100644 +index 0000000..e05fe07 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +@@ -0,0 +1,38 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInEntityAction extends Packet { ++ ++ private int a; ++ private int animation; ++ private int c; ++ ++ public PacketPlayInEntityAction() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.animation = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.animation); ++ packetdataserializer.writeInt(this.c); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public int d() { ++ return this.animation; ++ } ++ ++ public int e() { ++ return this.c; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java +new file mode 100644 +index 0000000..6dab3b9 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java +@@ -0,0 +1,32 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInKeepAlive extends Packet { ++ ++ private int a; ++ ++ public PacketPlayInKeepAlive() {} ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ } ++ ++ public boolean a() { ++ return true; ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java +new file mode 100644 +index 0000000..63b8e4b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java +@@ -0,0 +1,28 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInPosition extends PacketPlayInFlying { ++ ++ public PacketPlayInPosition() { ++ this.hasPos = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.x = packetdataserializer.readDouble(); ++ this.y = packetdataserializer.readDouble(); ++ this.stance = packetdataserializer.readDouble(); ++ this.z = packetdataserializer.readDouble(); ++ super.a(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeDouble(this.x); ++ packetdataserializer.writeDouble(this.y); ++ packetdataserializer.writeDouble(this.stance); ++ packetdataserializer.writeDouble(this.z); ++ super.b(packetdataserializer); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ super.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java +new file mode 100644 +index 0000000..9a6b726 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java +@@ -0,0 +1,33 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInPositionLook extends PacketPlayInFlying { ++ ++ public PacketPlayInPositionLook() { ++ this.hasPos = true; ++ this.hasLook = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.x = packetdataserializer.readDouble(); ++ this.y = packetdataserializer.readDouble(); ++ this.stance = packetdataserializer.readDouble(); ++ this.z = packetdataserializer.readDouble(); ++ this.yaw = packetdataserializer.readFloat(); ++ this.pitch = packetdataserializer.readFloat(); ++ super.a(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeDouble(this.x); ++ packetdataserializer.writeDouble(this.y); ++ packetdataserializer.writeDouble(this.stance); ++ packetdataserializer.writeDouble(this.z); ++ packetdataserializer.writeFloat(this.yaw); ++ packetdataserializer.writeFloat(this.pitch); ++ super.b(packetdataserializer); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ super.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java +new file mode 100644 +index 0000000..034fd5e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java +@@ -0,0 +1,69 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInSettings extends Packet { ++ ++ private String a; ++ private int b; ++ private EnumChatVisibility c; ++ private boolean d; ++ private EnumDifficulty e; ++ private boolean f; ++ ++ public PacketPlayInSettings() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(7); ++ this.b = packetdataserializer.readByte(); ++ this.c = EnumChatVisibility.a(packetdataserializer.readByte()); ++ this.d = packetdataserializer.readBoolean(); ++ this.e = EnumDifficulty.getById(packetdataserializer.readByte()); ++ this.f = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c.a()); ++ packetdataserializer.writeBoolean(this.d); ++ packetdataserializer.writeByte(this.e.a()); ++ packetdataserializer.writeBoolean(this.f); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public String c() { ++ return this.a; ++ } ++ ++ public int d() { ++ return this.b; ++ } ++ ++ public EnumChatVisibility e() { ++ return this.c; ++ } ++ ++ public boolean f() { ++ return this.d; ++ } ++ ++ public EnumDifficulty g() { ++ return this.e; ++ } ++ ++ public boolean h() { ++ return this.f; ++ } ++ ++ public String b() { ++ return String.format("lang=\'%s\', view=%d, chat=%s, col=%b, difficulty=%s, cape=%b", new Object[] { this.a, Integer.valueOf(this.b), this.c, Boolean.valueOf(this.d), this.e, Boolean.valueOf(this.f)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java +new file mode 100644 +index 0000000..d304284 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java +@@ -0,0 +1,49 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInSteerVehicle extends Packet { ++ ++ private float a; ++ private float b; ++ private boolean c; ++ private boolean d; ++ ++ public PacketPlayInSteerVehicle() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readFloat(); ++ this.b = packetdataserializer.readFloat(); ++ this.c = packetdataserializer.readBoolean(); ++ this.d = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeFloat(this.a); ++ packetdataserializer.writeFloat(this.b); ++ packetdataserializer.writeBoolean(this.c); ++ packetdataserializer.writeBoolean(this.d); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public float c() { ++ return this.a; ++ } ++ ++ public float d() { ++ return this.b; ++ } ++ ++ public boolean e() { ++ return this.c; ++ } ++ ++ public boolean f() { ++ return this.d; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java +new file mode 100644 +index 0000000..476638e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++import net.minecraft.util.org.apache.commons.lang3.StringUtils; ++ ++import java.io.IOException; ++ ++public class PacketPlayInTabComplete extends Packet { ++ ++ private String a; ++ ++ public PacketPlayInTabComplete() {} ++ ++ public PacketPlayInTabComplete(String s) { ++ this.a = s; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(32767); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(StringUtils.substring(this.a, 0, 32767)); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public String c() { ++ return this.a; ++ } ++ ++ public String b() { ++ return String.format("message=\'%s\'", new Object[] { this.a}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java +new file mode 100644 +index 0000000..3458448 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java +@@ -0,0 +1,58 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInUpdateSign extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private String[] d; ++ ++ public PacketPlayInUpdateSign() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readInt(); ++ this.d = new String[4]; ++ ++ for (int i = 0; i < 4; ++i) { ++ this.d[i] = packetdataserializer.c(15); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeInt(this.c); ++ ++ for (int i = 0; i < 4; ++i) { ++ packetdataserializer.a(this.d[i]); ++ } ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public int d() { ++ return this.b; ++ } ++ ++ public int e() { ++ return this.c; ++ } ++ ++ public String[] f() { ++ return this.d; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +new file mode 100644 +index 0000000..39f3037 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInUseEntity extends Packet { ++ ++ private int a; ++ private EnumEntityUseAction action; ++ ++ public PacketPlayInUseEntity() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.action.ordinal()); ++ } ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public Entity a(World world) { ++ return world.getEntity(this.a); ++ } ++ ++ public EnumEntityUseAction c() { ++ return this.action; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java +new file mode 100644 +index 0000000..2bba639 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java +@@ -0,0 +1,67 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInWindowClick extends Packet { ++ ++ private int a; ++ private int slot; ++ private int button; ++ private short d; ++ private ItemStack item; ++ private int shift; ++ ++ public PacketPlayInWindowClick() {} ++ ++ public void a(PacketPlayInListener packetplayinlistener) { ++ packetplayinlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readByte(); ++ this.slot = packetdataserializer.readShort(); ++ this.button = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readShort(); ++ this.shift = packetdataserializer.readByte(); ++ this.item = packetdataserializer.c(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte(this.a); ++ packetdataserializer.writeShort(this.slot); ++ packetdataserializer.writeByte(this.button); ++ packetdataserializer.writeShort(this.d); ++ packetdataserializer.writeByte(this.shift); ++ packetdataserializer.a(this.item); ++ } ++ ++ public String b() { ++ return this.item != null ? String.format("id=%d, slot=%d, button=%d, type=%d, itemid=%d, itemcount=%d, itemaux=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift), Integer.valueOf(Item.getId(this.item.getItem())), Integer.valueOf(this.item.count), Integer.valueOf(this.item.getData())}) : String.format("id=%d, slot=%d, button=%d, type=%d, itemid=-1", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift)}); ++ } ++ ++ public int c() { ++ return this.a; ++ } ++ ++ public int d() { ++ return this.slot; ++ } ++ ++ public int e() { ++ return this.button; ++ } ++ ++ public short f() { ++ return this.d; ++ } ++ ++ public ItemStack g() { ++ return this.item; ++ } ++ ++ public int h() { ++ return this.shift; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +new file mode 100644 +index 0000000..d7954ff +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutBed extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ ++ public PacketPlayOutBed() {} ++ ++ public PacketPlayOutBed(EntityHuman entityhuman, int i, int j, int k) { ++ this.b = i; ++ this.c = j; ++ this.d = k; ++ this.a = entityhuman.getId(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeInt(this.d); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +new file mode 100644 +index 0000000..cdcdfd6 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +@@ -0,0 +1,48 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutBlockAction extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ private Block f; ++ ++ public PacketPlayOutBlockAction() {} ++ ++ public PacketPlayOutBlockAction(int i, int j, int k, Block block, int l, int i1) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = i1; ++ this.f = block; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readUnsignedByte(); ++ this.e = packetdataserializer.readUnsignedByte(); ++ this.f = Block.getById(packetdataserializer.a() & 4095); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.b(Block.getId(this.f) & 4095); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +new file mode 100644 +index 0000000..c93e8bc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +@@ -0,0 +1,44 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutBlockBreakAnimation extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ ++ public PacketPlayOutBlockBreakAnimation() {} ++ ++ public PacketPlayOutBlockBreakAnimation(int i, int j, int k, int l, int i1) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = i1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.a(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.e); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +new file mode 100644 +index 0000000..f6863bd +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -0,0 +1,47 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutChat extends Packet { ++ ++ private IChatBaseComponent a; ++ private boolean b; ++ ++ public PacketPlayOutChat() { ++ this.b = true; ++ } ++ ++ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { ++ this(ichatbasecomponent, true); ++ } ++ ++ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) { ++ this.b = true; ++ this.a = ichatbasecomponent; ++ this.b = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = ChatSerializer.a(packetdataserializer.c(32767)); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(ChatSerializer.a(this.a)); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("message=\'%s\'", new Object[] { this.a}); ++ } ++ ++ public boolean d() { ++ return this.b; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java +new file mode 100644 +index 0000000..0870ac9 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java +@@ -0,0 +1,32 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutCollect extends Packet { ++ ++ private int a; ++ private int b; ++ ++ public PacketPlayOutCollect() {} ++ ++ public PacketPlayOutCollect(int i, int j) { ++ this.a = i; ++ this.b = j; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java +new file mode 100644 +index 0000000..f2a032e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java +@@ -0,0 +1,45 @@ ++package net.minecraft.server; ++ ++import net.minecraft.util.io.netty.buffer.ByteBuf; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutCustomPayload extends Packet { ++ ++ private String tag; ++ private byte[] data; ++ ++ public PacketPlayOutCustomPayload() {} ++ ++ public PacketPlayOutCustomPayload(String s, ByteBuf bytebuf) { ++ this(s, bytebuf.array()); ++ } ++ ++ public PacketPlayOutCustomPayload(String s, byte[] abyte) { ++ this.tag = s; ++ this.data = abyte; ++ if (abyte.length >= 1048576) { ++ throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes"); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.tag = packetdataserializer.c(20); ++ this.data = new byte[packetdataserializer.readUnsignedShort()]; ++ packetdataserializer.readBytes(this.data); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.tag); ++ packetdataserializer.writeShort(this.data.length); ++ packetdataserializer.writeBytes(this.data); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +new file mode 100644 +index 0000000..dc4259d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +@@ -0,0 +1,42 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntity extends Packet { ++ ++ protected int a; ++ protected byte b; ++ protected byte c; ++ protected byte d; ++ protected byte e; ++ protected byte f; ++ protected boolean g; ++ ++ public PacketPlayOutEntity() {} ++ ++ public PacketPlayOutEntity(int i) { ++ this.a = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d", new Object[] { Integer.valueOf(this.a)}); ++ } ++ ++ public String toString() { ++ return "Entity_" + super.toString(); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +new file mode 100644 +index 0000000..4fa5b82 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +@@ -0,0 +1,50 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityDestroy extends Packet { ++ ++ private int[] a; ++ ++ public PacketPlayOutEntityDestroy() {} ++ ++ public PacketPlayOutEntityDestroy(int... aint) { ++ this.a = aint; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = new int[packetdataserializer.readByte()]; ++ ++ for (int i = 0; i < this.a.length; ++i) { ++ this.a[i] = packetdataserializer.readInt(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte(this.a.length); ++ ++ for (int i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeInt(this.a[i]); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ StringBuilder stringbuilder = new StringBuilder(); ++ ++ for (int i = 0; i < this.a.length; ++i) { ++ if (i > 0) { ++ stringbuilder.append(", "); ++ } ++ ++ stringbuilder.append(this.a[i]); ++ } ++ ++ return String.format("entities=%d[%s]", new Object[] { Integer.valueOf(this.a.length), stringbuilder}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java +new file mode 100644 +index 0000000..97752ca +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java +@@ -0,0 +1,44 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityEffect extends Packet { ++ ++ private int a; ++ private byte b; ++ private byte c; ++ private short d; ++ ++ public PacketPlayOutEntityEffect() {} ++ ++ public PacketPlayOutEntityEffect(int i, MobEffect mobeffect) { ++ this.a = i; ++ this.b = (byte) (mobeffect.getEffectId() & 255); ++ this.c = (byte) (mobeffect.getAmplifier() & 255); ++ if (mobeffect.getDuration() > 32767) { ++ this.d = 32767; ++ } else { ++ this.d = (short) mobeffect.getDuration(); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeShort(this.d); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +new file mode 100644 +index 0000000..736e3fd +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityEquipment extends Packet { ++ ++ private int a; ++ private int b; ++ private ItemStack c; ++ ++ public PacketPlayOutEntityEquipment() {} ++ ++ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) { ++ this.a = i; ++ this.b = j; ++ this.c = itemstack == null ? null : itemstack.cloneItemStack(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.c(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.a(this.c); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("entity=%d, slot=%d, item=%s", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), this.c}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +new file mode 100644 +index 0000000..0204062 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityHeadRotation extends Packet { ++ ++ private int a; ++ private byte b; ++ ++ public PacketPlayOutEntityHeadRotation() {} ++ ++ public PacketPlayOutEntityHeadRotation(Entity entity, byte b0) { ++ this.a = entity.getId(); ++ this.b = b0; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, rot=%d", new Object[] { Integer.valueOf(this.a), Byte.valueOf(this.b)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java +new file mode 100644 +index 0000000..72243ec +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutEntityLook() { ++ this.g = true; ++ } ++ ++ public PacketPlayOutEntityLook(int i, byte b0, byte b1) { ++ super(i); ++ this.e = b0; ++ this.f = b1; ++ this.g = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ super.a(packetdataserializer); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ } ++ ++ public String b() { ++ return super.b() + String.format(", yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.e), Byte.valueOf(this.f)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ super.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +new file mode 100644 +index 0000000..a95877f +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +@@ -0,0 +1,38 @@ ++package net.minecraft.server; ++ ++import java.util.List; ++ ++public class PacketPlayOutEntityMetadata extends Packet { ++ ++ private int a; ++ private List b; ++ ++ public PacketPlayOutEntityMetadata() {} ++ ++ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) { ++ this.a = i; ++ if (flag) { ++ this.b = datawatcher.c(); ++ } else { ++ this.b = datawatcher.b(); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ DataWatcher.a(this.b, packetdataserializer); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +new file mode 100644 +index 0000000..c988bcc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +@@ -0,0 +1,57 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityTeleport extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private byte e; ++ private byte f; ++ ++ public PacketPlayOutEntityTeleport() {} ++ ++ public PacketPlayOutEntityTeleport(Entity entity) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F)); ++ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); ++ } ++ ++ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = b0; ++ this.f = b1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +new file mode 100644 +index 0000000..46f2543 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +@@ -0,0 +1,74 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityVelocity extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ ++ public PacketPlayOutEntityVelocity() {} ++ ++ public PacketPlayOutEntityVelocity(Entity entity) { ++ this(entity.getId(), entity.motX, entity.motY, entity.motZ); ++ } ++ ++ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) { ++ this.a = i; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.b = (int) (d0 * 8000.0D); ++ this.c = (int) (d1 * 8000.0D); ++ this.d = (int) (d2 * 8000.0D); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readShort(); ++ this.d = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.writeShort(this.d); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Float.valueOf((float) this.b / 8000.0F), Float.valueOf((float) this.c / 8000.0F), Float.valueOf((float) this.d / 8000.0F)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java +new file mode 100644 +index 0000000..4038cc8 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutExperience extends Packet { ++ ++ private float a; ++ private int b; ++ private int c; ++ ++ public PacketPlayOutExperience() {} ++ ++ public PacketPlayOutExperience(float f, int i, int j) { ++ this.a = f; ++ this.b = i; ++ this.c = j; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readFloat(); ++ this.c = packetdataserializer.readShort(); ++ this.b = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeFloat(this.a); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.writeShort(this.b); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java +new file mode 100644 +index 0000000..456532b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java +@@ -0,0 +1,32 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutKeepAlive extends Packet { ++ ++ private int a; ++ ++ public PacketPlayOutKeepAlive() {} ++ ++ public PacketPlayOutKeepAlive(int i) { ++ this.a = i; ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ } ++ ++ public boolean a() { ++ return true; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java +new file mode 100644 +index 0000000..49e0ff5 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java +@@ -0,0 +1,70 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutLogin extends Packet { ++ ++ private int a; ++ private boolean b; ++ private EnumGamemode c; ++ private int d; ++ private EnumDifficulty e; ++ private int f; ++ private WorldType g; ++ ++ public PacketPlayOutLogin() {} ++ ++ public PacketPlayOutLogin(int i, EnumGamemode enumgamemode, boolean flag, int j, EnumDifficulty enumdifficulty, int k, WorldType worldtype) { ++ this.a = i; ++ this.d = j; ++ this.e = enumdifficulty; ++ this.c = enumgamemode; ++ this.f = k; ++ this.b = flag; ++ this.g = worldtype; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.readInt(); ++ short short1 = packetdataserializer.readUnsignedByte(); ++ ++ this.b = (short1 & 8) == 8; ++ int i = short1 & -9; ++ ++ this.c = EnumGamemode.getById(i); ++ this.d = packetdataserializer.readByte(); ++ this.e = EnumDifficulty.getById(packetdataserializer.readUnsignedByte()); ++ this.f = packetdataserializer.readUnsignedByte(); ++ this.g = WorldType.getType(packetdataserializer.c(16)); ++ if (this.g == null) { ++ this.g = WorldType.NORMAL; ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.writeInt(this.a); ++ int i = this.c.getId(); ++ ++ if (this.b) { ++ i |= 8; ++ } ++ ++ packetdataserializer.writeByte(i); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeByte(this.e.a()); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.a(this.g.name()); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("eid=%d, gameType=%d, hardcore=%b, dimension=%d, difficulty=%s, maxplayers=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.c.getId()), Boolean.valueOf(this.b), Integer.valueOf(this.d), this.e, Integer.valueOf(this.f)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java +new file mode 100644 +index 0000000..5980c2d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java +@@ -0,0 +1,38 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutMap extends Packet { ++ ++ private int a; ++ private byte[] b; ++ ++ public PacketPlayOutMap() {} ++ ++ public PacketPlayOutMap(int i, byte[] abyte) { ++ this.a = i; ++ this.b = abyte; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.a(); ++ this.b = new byte[packetdataserializer.readUnsignedShort()]; ++ packetdataserializer.readBytes(this.b); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeShort(this.b.length); ++ packetdataserializer.writeBytes(this.b); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, length=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b.length)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java +new file mode 100644 +index 0000000..0a12db5 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java +@@ -0,0 +1,81 @@ ++package net.minecraft.server; ++ ++import java.io.ByteArrayOutputStream; ++import java.io.DataOutputStream; ++import java.io.IOException; ++ ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class PacketPlayOutMultiBlockChange extends Packet { ++ ++ private static final Logger a = LogManager.getLogger(); ++ private ChunkCoordIntPair b; ++ private byte[] c; ++ private int d; ++ ++ public PacketPlayOutMultiBlockChange() {} ++ ++ public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) { ++ this.b = new ChunkCoordIntPair(chunk.locX, chunk.locZ); ++ this.d = i; ++ int j = 4 * i; ++ ++ try { ++ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(j); ++ DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); ++ ++ for (int k = 0; k < i; ++k) { ++ int l = ashort[k] >> 12 & 15; ++ int i1 = ashort[k] >> 8 & 15; ++ int j1 = ashort[k] & 255; ++ ++ dataoutputstream.writeShort(ashort[k]); ++ dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15)); ++ } ++ ++ this.c = bytearrayoutputstream.toByteArray(); ++ if (this.c.length != j) { ++ throw new RuntimeException("Expected length " + j + " doesn\'t match received length " + this.c.length); ++ } ++ } catch (IOException ioexception) { ++ a.error("Couldn\'t create bulk block update packet", ioexception); ++ this.c = null; ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.b = new ChunkCoordIntPair(packetdataserializer.readInt(), packetdataserializer.readInt()); ++ this.d = packetdataserializer.readShort() & '\uffff'; ++ int i = packetdataserializer.readInt(); ++ ++ if (i > 0) { ++ this.c = new byte[i]; ++ packetdataserializer.readBytes(this.c); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.b.x); ++ packetdataserializer.writeInt(this.b.z); ++ packetdataserializer.writeShort((short) this.d); ++ if (this.c != null) { ++ packetdataserializer.writeInt(this.c.length); ++ packetdataserializer.writeBytes(this.c); ++ } else { ++ packetdataserializer.writeInt(0); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("xc=%d, zc=%d, count=%d", new Object[] { Integer.valueOf(this.b.x), Integer.valueOf(this.b.z), Integer.valueOf(this.d)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java +new file mode 100644 +index 0000000..d67a364 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutOpenSignEditor extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ ++ public PacketPlayOutOpenSignEditor() {} ++ ++ public PacketPlayOutOpenSignEditor(int i, int j, int k) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +new file mode 100644 +index 0000000..7cae01e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +@@ -0,0 +1,38 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutPlayerInfo extends Packet { ++ ++ private String a; ++ private boolean b; ++ private int c; ++ ++ public PacketPlayOutPlayerInfo() {} ++ ++ public PacketPlayOutPlayerInfo(String s, boolean flag, int i) { ++ this.a = s; ++ this.b = flag; ++ this.c = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(16); ++ this.b = packetdataserializer.readBoolean(); ++ this.c = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeBoolean(this.b); ++ packetdataserializer.writeShort(this.c); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java +new file mode 100644 +index 0000000..f2234f0 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java +@@ -0,0 +1,48 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutPosition extends Packet { ++ ++ private double a; ++ private double b; ++ private double c; ++ private float d; ++ private float e; ++ private boolean f; ++ ++ public PacketPlayOutPosition() {} ++ ++ public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag) { ++ this.a = d0; ++ this.b = d1; ++ this.c = d2; ++ this.d = f; ++ this.e = f1; ++ this.f = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readDouble(); ++ this.b = packetdataserializer.readDouble(); ++ this.c = packetdataserializer.readDouble(); ++ this.d = packetdataserializer.readFloat(); ++ this.e = packetdataserializer.readFloat(); ++ this.f = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeDouble(this.a); ++ packetdataserializer.writeDouble(this.b); ++ packetdataserializer.writeDouble(this.c); ++ packetdataserializer.writeFloat(this.d); ++ packetdataserializer.writeFloat(this.e); ++ packetdataserializer.writeBoolean(this.f); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java +new file mode 100644 +index 0000000..d83ae7b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMove() {} ++ ++ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ } ++ ++ public String b() { ++ return super.b() + String.format(", xa=%d, ya=%d, za=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ super.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java +new file mode 100644 +index 0000000..9155c96 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java +@@ -0,0 +1,44 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMoveLook() { ++ this.g = true; ++ } ++ ++ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ this.e = b3; ++ this.f = b4; ++ this.g = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ } ++ ++ public String b() { ++ return super.b() + String.format(", xa=%d, ya=%d, za=%d, yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d), Byte.valueOf(this.e), Byte.valueOf(this.f)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ super.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java +new file mode 100644 +index 0000000..9041f82 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java +@@ -0,0 +1,32 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutRemoveEntityEffect extends Packet { ++ ++ private int a; ++ private int b; ++ ++ public PacketPlayOutRemoveEntityEffect() {} ++ ++ public PacketPlayOutRemoveEntityEffect(int i, MobEffect mobeffect) { ++ this.a = i; ++ this.b = mobeffect.getEffectId(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +new file mode 100644 +index 0000000..7403dbd +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +@@ -0,0 +1,38 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutScoreboardObjective extends Packet { ++ ++ private String a; ++ private String b; ++ private int c; ++ ++ public PacketPlayOutScoreboardObjective() {} ++ ++ public PacketPlayOutScoreboardObjective(ScoreboardObjective scoreboardobjective, int i) { ++ this.a = scoreboardobjective.getName(); ++ this.b = scoreboardobjective.getDisplayName(); ++ this.c = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(16); ++ this.b = packetdataserializer.c(32); ++ this.c = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeByte(this.c); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +new file mode 100644 +index 0000000..f50851b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +@@ -0,0 +1,53 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutScoreboardScore extends Packet { ++ ++ private String a = ""; ++ private String b = ""; ++ private int c; ++ private int d; ++ ++ public PacketPlayOutScoreboardScore() {} ++ ++ public PacketPlayOutScoreboardScore(ScoreboardScore scoreboardscore, int i) { ++ this.a = scoreboardscore.getPlayerName(); ++ this.b = scoreboardscore.getObjective().getName(); ++ this.c = scoreboardscore.getScore(); ++ this.d = i; ++ } ++ ++ public PacketPlayOutScoreboardScore(String s) { ++ this.a = s; ++ this.b = ""; ++ this.c = 0; ++ this.d = 1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(16); ++ this.d = packetdataserializer.readByte(); ++ if (this.d != 1) { ++ this.b = packetdataserializer.c(16); ++ this.c = packetdataserializer.readInt(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeByte(this.d); ++ if (this.d != 1) { ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeInt(this.c); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +new file mode 100644 +index 0000000..e8f0971 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +@@ -0,0 +1,95 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.ArrayList; ++import java.util.Collection; ++import java.util.Iterator; ++ ++public class PacketPlayOutScoreboardTeam extends Packet { ++ ++ private String a = ""; ++ private String b = ""; ++ private String c = ""; ++ private String d = ""; ++ private Collection e = new ArrayList(); ++ private int f; ++ private int g; ++ ++ public PacketPlayOutScoreboardTeam() {} ++ ++ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, int i) { ++ this.a = scoreboardteam.getName(); ++ this.f = i; ++ if (i == 0 || i == 2) { ++ this.b = scoreboardteam.getDisplayName(); ++ this.c = scoreboardteam.getPrefix(); ++ this.d = scoreboardteam.getSuffix(); ++ this.g = scoreboardteam.packOptionData(); ++ } ++ ++ if (i == 0) { ++ this.e.addAll(scoreboardteam.getPlayerNameSet()); ++ } ++ } ++ ++ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, Collection collection, int i) { ++ if (i != 3 && i != 4) { ++ throw new IllegalArgumentException("Method must be join or leave for player constructor"); ++ } else if (collection != null && !collection.isEmpty()) { ++ this.f = i; ++ this.a = scoreboardteam.getName(); ++ this.e.addAll(collection); ++ } else { ++ throw new IllegalArgumentException("Players cannot be null/empty"); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(16); ++ this.f = packetdataserializer.readByte(); ++ if (this.f == 0 || this.f == 2) { ++ this.b = packetdataserializer.c(32); ++ this.c = packetdataserializer.c(16); ++ this.d = packetdataserializer.c(16); ++ this.g = packetdataserializer.readByte(); ++ } ++ ++ if (this.f == 0 || this.f == 3 || this.f == 4) { ++ short short1 = packetdataserializer.readShort(); ++ ++ for (int i = 0; i < short1; ++i) { ++ this.e.add(packetdataserializer.c(40)); ++ } ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeByte(this.f); ++ if (this.f == 0 || this.f == 2) { ++ packetdataserializer.a(this.b); ++ packetdataserializer.a(this.c); ++ packetdataserializer.a(this.d); ++ packetdataserializer.writeByte(this.g); ++ } ++ ++ if (this.f == 0 || this.f == 3 || this.f == 4) { ++ packetdataserializer.writeShort(this.e.size()); ++ Iterator iterator = this.e.iterator(); ++ ++ while (iterator.hasNext()) { ++ String s = (String) iterator.next(); ++ ++ packetdataserializer.a(s); ++ } ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +new file mode 100644 +index 0000000..5aeb4e3 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutSetSlot extends Packet { ++ ++ private int a; ++ private int b; ++ private ItemStack c; ++ ++ public PacketPlayOutSetSlot() {} ++ ++ public PacketPlayOutSetSlot(int i, int j, ItemStack itemstack) { ++ this.a = i; ++ this.b = j; ++ this.c = itemstack == null ? null : itemstack.cloneItemStack(); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readByte(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.c(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.a(this.c); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +new file mode 100644 +index 0000000..17302e0 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +@@ -0,0 +1,135 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutSpawnEntity extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ private int f; ++ private int g; ++ private int h; ++ private int i; ++ private int j; ++ private int k; ++ ++ public PacketPlayOutSpawnEntity() {} ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i) { ++ this(entity, i, 0); ++ } ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); ++ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); ++ this.j = i; ++ this.k = j; ++ if (j > 0) { ++ double d0 = entity.motX; ++ double d1 = entity.motY; ++ double d2 = entity.motZ; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.e = (int) (d0 * 8000.0D); ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.a(); ++ this.j = packetdataserializer.readByte(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.h = packetdataserializer.readByte(); ++ this.i = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readInt(); ++ if (this.k > 0) { ++ this.e = packetdataserializer.readShort(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.h); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeInt(this.k); ++ if (this.k > 0) { ++ packetdataserializer.writeShort(this.e); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.j), Float.valueOf((float) this.b / 32.0F), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F)}); ++ } ++ ++ public void a(int i) { ++ this.b = i; ++ } ++ ++ public void b(int i) { ++ this.c = i; ++ } ++ ++ public void c(int i) { ++ this.d = i; ++ } ++ ++ public void d(int i) { ++ this.e = i; ++ } ++ ++ public void e(int i) { ++ this.f = i; ++ } ++ ++ public void f(int i) { ++ this.g = i; ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +new file mode 100644 +index 0000000..435fe8d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +@@ -0,0 +1,108 @@ ++package net.minecraft.server; ++ ++import java.util.List; ++ ++public class PacketPlayOutSpawnEntityLiving extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ private int f; ++ private int g; ++ private int h; ++ private byte i; ++ private byte j; ++ private byte k; ++ private DataWatcher l; ++ private List m; ++ ++ public PacketPlayOutSpawnEntityLiving() {} ++ ++ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) { ++ this.a = entityliving.getId(); ++ this.b = (byte) EntityTypes.a(entityliving); ++ this.c = entityliving.as.a(entityliving.locX); ++ this.d = MathHelper.floor(entityliving.locY * 32.0D); ++ this.e = entityliving.as.a(entityliving.locZ); ++ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); ++ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); ++ this.k = (byte) ((int) (entityliving.aO * 256.0F / 360.0F)); ++ double d0 = 3.9D; ++ double d1 = entityliving.motX; ++ double d2 = entityliving.motY; ++ double d3 = entityliving.motZ; ++ ++ if (d1 < -d0) { ++ d1 = -d0; ++ } ++ ++ if (d2 < -d0) { ++ d2 = -d0; ++ } ++ ++ if (d3 < -d0) { ++ d3 = -d0; ++ } ++ ++ if (d1 > d0) { ++ d1 = d0; ++ } ++ ++ if (d2 > d0) { ++ d2 = d0; ++ } ++ ++ if (d3 > d0) { ++ d3 = d0; ++ } ++ ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ this.h = (int) (d3 * 8000.0D); ++ this.l = entityliving.getDataWatcher(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.a(); ++ this.b = packetdataserializer.readByte() & 255; ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ this.i = packetdataserializer.readByte(); ++ this.j = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ this.h = packetdataserializer.readShort(); ++ this.m = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.b & 255); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeByte(this.k); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ packetdataserializer.writeShort(this.h); ++ this.l.a(packetdataserializer); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F), Float.valueOf((float) this.e / 32.0F), Float.valueOf((float) this.f / 8000.0F), Float.valueOf((float) this.g / 8000.0F), Float.valueOf((float) this.h / 8000.0F)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java +new file mode 100644 +index 0000000..2c86b81 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java +@@ -0,0 +1,54 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutSpawnEntityPainting extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ private String f; ++ ++ public PacketPlayOutSpawnEntityPainting() {} ++ ++ public PacketPlayOutSpawnEntityPainting(EntityPainting entitypainting) { ++ this.a = entitypainting.getId(); ++ this.b = entitypainting.x; ++ this.c = entitypainting.y; ++ this.d = entitypainting.z; ++ this.e = entitypainting.direction; ++ this.f = entitypainting.art.B; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.a(); ++ this.f = packetdataserializer.c(EnumArt.A); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.a(this.f); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public String b() { ++ return String.format("id=%d, type=%s, x=%d, y=%d, z=%d", new Object[] { Integer.valueOf(this.a), this.f, Integer.valueOf(this.b), Integer.valueOf(this.c), Integer.valueOf(this.d)}); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java +new file mode 100644 +index 0000000..3887d15 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java +@@ -0,0 +1,44 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutTileEntityData extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private NBTTagCompound e; ++ ++ public PacketPlayOutTileEntityData() {} ++ ++ public PacketPlayOutTileEntityData(int i, int j, int k, int l, NBTTagCompound nbttagcompound) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = nbttagcompound; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readUnsignedByte(); ++ this.e = packetdataserializer.b(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte((byte) this.d); ++ packetdataserializer.a(this.e); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +new file mode 100644 +index 0000000..7b288ad +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +@@ -0,0 +1,79 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.ArrayList; ++import java.util.Collection; ++import java.util.Iterator; ++import java.util.List; ++import java.util.UUID; ++ ++public class PacketPlayOutUpdateAttributes extends Packet { ++ ++ private int a; ++ private final List b = new ArrayList(); ++ ++ public PacketPlayOutUpdateAttributes() {} ++ ++ public PacketPlayOutUpdateAttributes(int i, Collection collection) { ++ this.a = i; ++ Iterator iterator = collection.iterator(); ++ ++ while (iterator.hasNext()) { ++ AttributeInstance attributeinstance = (AttributeInstance) iterator.next(); ++ ++ this.b.add(new AttributeSnapshot(this, attributeinstance.getAttribute().getName(), attributeinstance.b(), attributeinstance.c())); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.readInt(); ++ int i = packetdataserializer.readInt(); ++ ++ for (int j = 0; j < i; ++j) { ++ String s = packetdataserializer.c(64); ++ double d0 = packetdataserializer.readDouble(); ++ ArrayList arraylist = new ArrayList(); ++ short short1 = packetdataserializer.readShort(); ++ ++ for (int k = 0; k < short1; ++k) { ++ UUID uuid = new UUID(packetdataserializer.readLong(), packetdataserializer.readLong()); ++ ++ arraylist.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", packetdataserializer.readDouble(), packetdataserializer.readByte())); ++ } ++ ++ this.b.add(new AttributeSnapshot(this, s, d0, arraylist)); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.b.size()); ++ Iterator iterator = this.b.iterator(); ++ ++ while (iterator.hasNext()) { ++ AttributeSnapshot attributesnapshot = (AttributeSnapshot) iterator.next(); ++ ++ packetdataserializer.a(attributesnapshot.a()); ++ packetdataserializer.writeDouble(attributesnapshot.b()); ++ packetdataserializer.writeShort(attributesnapshot.c().size()); ++ Iterator iterator1 = attributesnapshot.c().iterator(); ++ ++ while (iterator1.hasNext()) { ++ AttributeModifier attributemodifier = (AttributeModifier) iterator1.next(); ++ ++ packetdataserializer.writeLong(attributemodifier.a().getMostSignificantBits()); ++ packetdataserializer.writeLong(attributemodifier.a().getLeastSignificantBits()); ++ packetdataserializer.writeDouble(attributemodifier.d()); ++ packetdataserializer.writeByte(attributemodifier.c()); ++ } ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +new file mode 100644 +index 0000000..72b3219 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutUpdateHealth extends Packet { ++ ++ private float a; ++ private int b; ++ private float c; ++ ++ public PacketPlayOutUpdateHealth() {} ++ ++ public PacketPlayOutUpdateHealth(float f, int i, float f1) { ++ this.a = f; ++ this.b = i; ++ this.c = f1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readFloat(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readFloat(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeFloat(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeFloat(this.c); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java +new file mode 100644 +index 0000000..7c5d2eb +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java +@@ -0,0 +1,49 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutUpdateSign extends Packet { ++ ++ private int x; ++ private int y; ++ private int z; ++ private String[] lines; ++ ++ public PacketPlayOutUpdateSign() {} ++ ++ public PacketPlayOutUpdateSign(int i, int j, int k, String[] astring) { ++ this.x = i; ++ this.y = j; ++ this.z = k; ++ this.lines = new String[] { astring[0], astring[1], astring[2], astring[3]}; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.x = packetdataserializer.readInt(); ++ this.y = packetdataserializer.readShort(); ++ this.z = packetdataserializer.readInt(); ++ this.lines = new String[4]; ++ ++ for (int i = 0; i < 4; ++i) { ++ this.lines[i] = packetdataserializer.c(15); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.writeInt(this.x); ++ packetdataserializer.writeShort(this.y); ++ packetdataserializer.writeInt(this.z); ++ ++ for (int i = 0; i < 4; ++i) { ++ packetdataserializer.a(this.lines[i]); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +new file mode 100644 +index 0000000..7ea6702 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +@@ -0,0 +1,54 @@ ++package net.minecraft.server; ++ ++import java.util.List; ++ ++public class PacketPlayOutWindowItems extends Packet { ++ ++ private int a; ++ private ItemStack[] b; ++ ++ public PacketPlayOutWindowItems() {} ++ ++ public PacketPlayOutWindowItems(int i, List list) { ++ this.a = i; ++ this.b = new ItemStack[list.size()]; ++ ++ for (int j = 0; j < this.b.length; ++j) { ++ ItemStack itemstack = (ItemStack) list.get(j); ++ ++ this.b[j] = itemstack == null ? null : itemstack.cloneItemStack(); ++ } ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readUnsignedByte(); ++ short short1 = packetdataserializer.readShort(); ++ ++ this.b = new ItemStack[short1]; ++ ++ for (int i = 0; i < short1; ++i) { ++ this.b[i] = packetdataserializer.c(); ++ } ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeByte(this.a); ++ packetdataserializer.writeShort(this.b.length); ++ ItemStack[] aitemstack = this.b; ++ int i = aitemstack.length; ++ ++ for (int j = 0; j < i; ++j) { ++ ItemStack itemstack = aitemstack[j]; ++ ++ packetdataserializer.a(itemstack); ++ } ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java +new file mode 100644 +index 0000000..f1001c6 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java +@@ -0,0 +1,48 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutWorldEvent extends Packet { ++ ++ private int a; ++ private int b; ++ private int c; ++ private int d; ++ private int e; ++ private boolean f; ++ ++ public PacketPlayOutWorldEvent() {} ++ ++ public PacketPlayOutWorldEvent(int i, int j, int k, int l, int i1, boolean flag) { ++ this.a = i; ++ this.c = j; ++ this.d = k; ++ this.e = l; ++ this.b = i1; ++ this.f = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readByte() & 255; ++ this.e = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readInt(); ++ this.f = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeInt(this.a); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.d & 255); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeBoolean(this.f); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java +new file mode 100644 +index 0000000..29f0c99 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java +@@ -0,0 +1,62 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutWorldParticles extends Packet { ++ ++ private String a; ++ private float b; ++ private float c; ++ private float d; ++ private float e; ++ private float f; ++ private float g; ++ private float h; ++ private int i; ++ ++ public PacketPlayOutWorldParticles() {} ++ ++ public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i) { ++ this.a = s; ++ this.b = f; ++ this.c = f1; ++ this.d = f2; ++ this.e = f3; ++ this.f = f4; ++ this.g = f5; ++ this.h = f6; ++ this.i = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.c(64); ++ this.b = packetdataserializer.readFloat(); ++ this.c = packetdataserializer.readFloat(); ++ this.d = packetdataserializer.readFloat(); ++ this.e = packetdataserializer.readFloat(); ++ this.f = packetdataserializer.readFloat(); ++ this.g = packetdataserializer.readFloat(); ++ this.h = packetdataserializer.readFloat(); ++ this.i = packetdataserializer.readInt(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.writeFloat(this.b); ++ packetdataserializer.writeFloat(this.c); ++ packetdataserializer.writeFloat(this.d); ++ packetdataserializer.writeFloat(this.e); ++ packetdataserializer.writeFloat(this.f); ++ packetdataserializer.writeFloat(this.g); ++ packetdataserializer.writeFloat(this.h); ++ packetdataserializer.writeInt(this.i); ++ } ++ ++ public void a(PacketPlayOutListener packetplayoutlistener) { ++ packetplayoutlistener.a(this); ++ } ++ ++ public void handle(PacketListener packetlistener) { ++ this.a((PacketPlayOutListener) packetlistener); ++ } ++} +-- +1.9.1 + diff --git a/CraftBukkit-Patches/0180-Snapshot-protocol.patch b/CraftBukkit-Patches/0180-Snapshot-protocol.patch new file mode 100644 index 0000000000..23aedb3cc2 --- /dev/null +++ b/CraftBukkit-Patches/0180-Snapshot-protocol.patch @@ -0,0 +1,4119 @@ +From c6375be65f8716214295ff749bb253ba55f9e4c1 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Mon, 1 Sep 2014 16:47:48 +1000 +Subject: [PATCH] Snapshot protocol + + +diff --git a/pom.xml b/pom.xml +index 6aeffa8..0d00e79 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -146,6 +146,7 @@ + ${api.version} + Bukkit Team + true ++ ${maven.build.timestamp} + + + +diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java +index 395d054..96e40ec 100644 +--- a/src/main/java/net/minecraft/server/DataWatcher.java ++++ b/src/main/java/net/minecraft/server/DataWatcher.java +@@ -9,6 +9,7 @@ import java.util.concurrent.locks.ReadWriteLock; + import java.util.concurrent.locks.ReentrantReadWriteLock; + + import net.minecraft.util.org.apache.commons.lang3.ObjectUtils; ++import org.spigotmc.ProtocolData; // Spigot - protocol patch + + public class DataWatcher { + +@@ -31,6 +32,19 @@ public class DataWatcher { + public void a(int i, Object object) { + int integer = classToId.get(object.getClass()); // Spigot + ++ // Spigot start - protocol patch ++ if ( object instanceof ProtocolData.ByteShort ++ || object instanceof ProtocolData.DualByte ++ || object instanceof ProtocolData.HiddenByte ) ++ { ++ integer = classToId.get( Byte.class ); ++ } ++ if ( object instanceof ProtocolData.IntByte ++ || object instanceof ProtocolData.DualInt ) { ++ integer = classToId.get( Integer.class ); ++ } ++ // Spigot end ++ + if (integer == -1) { // Spigot + throw new IllegalArgumentException("Unknown data type: " + object.getClass()); + } else if (i > 31) { +@@ -57,19 +71,19 @@ public class DataWatcher { + } + + public byte getByte(int i) { +- return ((Byte) this.i(i).b()).byteValue(); ++ return ((Number) this.i(i).b()).byteValue(); // Spigot - protocol patch + } + + public short getShort(int i) { +- return ((Short) this.i(i).b()).shortValue(); ++ return ((Number) this.i(i).b()).shortValue(); // Spigot - protocol patch + } + + public int getInt(int i) { +- return ((Integer) this.i(i).b()).intValue(); ++ return ((Number) this.i(i).b()).intValue(); // Spigot - protocol patch + } + + public float getFloat(int i) { +- return ((Float) this.i(i).b()).floatValue(); ++ return ((Number) this.i(i).b()).floatValue(); // Spigot - protocol patch + } + + public String getString(int i) { +@@ -80,6 +94,18 @@ public class DataWatcher { + return (ItemStack) this.i(i).b(); + } + ++ // Spigot start - protocol patch ++ public ProtocolData.DualByte getDualByte(int i) { ++ return (ProtocolData.DualByte) this.i(i).b(); ++ } ++ public ProtocolData.IntByte getIntByte(int i) { ++ return (ProtocolData.IntByte) this.i(i).b(); ++ } ++ public ProtocolData.DualInt getDualInt(int i) { ++ return (ProtocolData.DualInt) this.i(i).b(); ++ } ++ // Spigot end ++ + private WatchableObject i(int i) { + this.f.readLock().lock(); + +@@ -119,14 +145,20 @@ public class DataWatcher { + return this.e; + } + ++ // Spigot start - protocol patch + public static void a(List list, PacketDataSerializer packetdataserializer) { ++ a(list, packetdataserializer, 5); ++ } ++ ++ public static void a(List list, PacketDataSerializer packetdataserializer, int version) { ++ // Spigot end - protocol patch + if (list != null) { + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + WatchableObject watchableobject = (WatchableObject) iterator.next(); + +- a(packetdataserializer, watchableobject); ++ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch + } + } + +@@ -171,14 +203,20 @@ public class DataWatcher { + return arraylist; + } + ++ // Spigot start - protocol patch + public void a(PacketDataSerializer packetdataserializer) { ++ a(packetdataserializer, 5); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer, int version) { ++ // Spigot end + this.f.readLock().lock(); + Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot + + while (iterator.hasNext()) { + WatchableObject watchableobject = (WatchableObject) iterator.next(); + +- a(packetdataserializer, watchableobject); ++ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch + } + + this.f.readLock().unlock(); +@@ -211,25 +249,46 @@ public class DataWatcher { + return arraylist; + } + +- private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject) { +- int i = (watchableobject.c() << 5 | watchableobject.a() & 31) & 255; ++ // Spigot start - protocol patch ++ private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject, int version) { ++ int type = watchableobject.c(); ++ if (watchableobject.b() instanceof ProtocolData.ByteShort && version >= 16) { ++ type = 1; ++ } ++ if (watchableobject.b() instanceof ProtocolData.IntByte && version >= 28) { ++ type = 0; ++ } ++ if ( version < 16 && watchableobject.b() instanceof ProtocolData.HiddenByte ) return; ++ ++ int i = (type << 5 | watchableobject.a() & 31) & 255; + + packetdataserializer.writeByte(i); +- switch (watchableobject.c()) { ++ switch (type) { + case 0: +- packetdataserializer.writeByte(((Byte) watchableobject.b()).byteValue()); ++ if ( watchableobject.b() instanceof ProtocolData.DualByte ) ++ { ++ ProtocolData.DualByte dualByte = (ProtocolData.DualByte) watchableobject.b(); ++ packetdataserializer.writeByte( version >= 16 ? dualByte.value2 : dualByte.value ); ++ } else ++ { ++ packetdataserializer.writeByte( ( (Number) watchableobject.b() ).byteValue() ); ++ } + break; + + case 1: +- packetdataserializer.writeShort(((Short) watchableobject.b()).shortValue()); ++ packetdataserializer.writeShort(((Number) watchableobject.b()).shortValue()); + break; + + case 2: +- packetdataserializer.writeInt(((Integer) watchableobject.b()).intValue()); ++ int val = ((Number) watchableobject.b()).intValue(); ++ if ( watchableobject.b() instanceof ProtocolData.DualInt && version >= 46 ) { ++ val = ((ProtocolData.DualInt) watchableobject.b()).value2; ++ } ++ packetdataserializer.writeInt(val); + break; + + case 3: +- packetdataserializer.writeFloat(((Float) watchableobject.b()).floatValue()); ++ packetdataserializer.writeFloat(((Number) watchableobject.b()).floatValue()); + break; + + case 4: +@@ -254,6 +313,7 @@ public class DataWatcher { + packetdataserializer.writeInt(chunkcoordinates.z); + } + } ++ // Spigot end + + public static List b(PacketDataSerializer packetdataserializer) { + ArrayList arraylist = null; +diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java +index 7ddca48..af73b81 100644 +--- a/src/main/java/net/minecraft/server/EntityAgeable.java ++++ b/src/main/java/net/minecraft/server/EntityAgeable.java +@@ -73,11 +73,11 @@ public abstract class EntityAgeable extends EntityCreature { + + protected void c() { + super.c(); +- this.datawatcher.a(12, new Integer(0)); ++ this.datawatcher.a(12, new org.spigotmc.ProtocolData.IntByte(0, (byte) 0)); // Spigot - protocol patch + } + + public int getAge() { +- return this.datawatcher.getInt(12); ++ return this.datawatcher.getIntByte(12).value; // Spigot - protocol patch + } + + public void a(int i) { +@@ -92,7 +92,7 @@ public abstract class EntityAgeable extends EntityCreature { + } + + public void setAge(int i) { +- this.datawatcher.watch(12, Integer.valueOf(i)); ++ this.datawatcher.watch(12, new org.spigotmc.ProtocolData.IntByte(i, (byte) ( i < 0 ? -1 : (i >= 6000 ? 1 : 0)))); // Spigot - protocol patch + this.a(this.isBaby()); + } + +diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java +index fa6670b..87afc9c 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderman.java ++++ b/src/main/java/net/minecraft/server/EntityEnderman.java +@@ -7,6 +7,7 @@ import org.bukkit.Location; + import org.bukkit.craftbukkit.event.CraftEventFactory; + import org.bukkit.event.entity.EntityTeleportEvent; + // CraftBukkit end ++import org.spigotmc.ProtocolData; // Spigot - protocol patch + + public class EntityEnderman extends EntityMonster { + +@@ -33,7 +34,7 @@ public class EntityEnderman extends EntityMonster { + + protected void c() { + super.c(); +- this.datawatcher.a(16, new Byte((byte) 0)); ++ this.datawatcher.a( 16, new ProtocolData.ByteShort( (short) 0 ) ); // Spigot - protocol patch, handle metadata change + this.datawatcher.a(17, new Byte((byte) 0)); + this.datawatcher.a(18, new Byte((byte) 0)); + } +@@ -315,11 +316,11 @@ public class EntityEnderman extends EntityMonster { + } + + public void setCarried(Block block) { +- this.datawatcher.watch(16, Byte.valueOf((byte) (Block.getId(block) & 255))); ++ this.datawatcher.watch( 16, new ProtocolData.ByteShort( (short) Block.getId( block ) ) ); // Spigot - protocol patch, handle metadata change + } + + public Block getCarried() { +- return Block.getById(this.datawatcher.getByte(16)); ++ return Block.getById(this.datawatcher.getShort( 16 )); // Spigot - protocol patch, handle metadata change + } + + public void setCarriedData(int i) { +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index 219eb5f..5bb7295 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerBedLeaveEvent; + import org.bukkit.event.player.PlayerDropItemEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; + // CraftBukkit end ++import org.spigotmc.ProtocolData; // Spigot - protocol patch + + public abstract class EntityHuman extends EntityLiving implements ICommandListener { + +@@ -89,9 +90,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen + + protected void c() { + super.c(); +- this.datawatcher.a(16, Byte.valueOf((byte) 0)); ++ this.datawatcher.a( 16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) ); // Spigot - protocol patch, handle metadata usage change (show cape -> collisions) + this.datawatcher.a(17, Float.valueOf(0.0F)); + this.datawatcher.a(18, Integer.valueOf(0)); ++ this.datawatcher.a( 10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value + } + + public boolean by() { +@@ -1224,15 +1226,23 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen + return this.sleeping && this.sleepTicks >= 100; + } + +- protected void b(int i, boolean flag) { +- byte b0 = this.datawatcher.getByte(16); +- ++ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions) ++ protected void b(int i, boolean flag, int version) { ++ ProtocolData.DualByte db = this.datawatcher.getDualByte( 16 ); ++ byte b0 = version >= 16 ? db.value2 : db.value; + if (flag) { +- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1 << i))); ++ b0 = (byte) ( b0 | 1 << i ); ++ } else { ++ b0 = (byte) (b0 & ~(1 << i)); ++ } ++ if (version >= 16) { ++ db.value2 = b0; + } else { +- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & ~(1 << i)))); ++ db.value = b0; + } ++ this.datawatcher.watch(16, db); + } ++ // Spigot end + + public void b(IChatBaseComponent ichatbasecomponent) {} + +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index f6c4788..617f7d4 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -93,6 +93,10 @@ public abstract class EntityInsentient extends EntityLiving { + super.c(); + this.datawatcher.a(11, Byte.valueOf((byte) 0)); + this.datawatcher.a(10, ""); ++ // Spigot start - protocol patch ++ this.datawatcher.a(3, Byte.valueOf((byte) 0)); ++ this.datawatcher.a(2, ""); ++ // Spigot end + } + + public int q() { +@@ -733,6 +737,7 @@ public abstract class EntityInsentient extends EntityLiving { + + public void setCustomName(String s) { + this.datawatcher.watch(10, s); ++ this.datawatcher.watch(2, s); // Spigot - protocol patch + } + + public String getCustomName() { +@@ -745,6 +750,7 @@ public abstract class EntityInsentient extends EntityLiving { + + public void setCustomNameVisible(boolean flag) { + this.datawatcher.watch(11, Byte.valueOf((byte) (flag ? 1 : 0))); ++ this.datawatcher.watch(3, Byte.valueOf((byte) (flag ? 1 : 0))); // Spigot - protocol patch + } + + public boolean getCustomNameVisible() { +diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java +index d1d73f9..5109b5d 100644 +--- a/src/main/java/net/minecraft/server/EntityItemFrame.java ++++ b/src/main/java/net/minecraft/server/EntityItemFrame.java +@@ -16,6 +16,10 @@ public class EntityItemFrame extends EntityHanging { + protected void c() { + this.getDataWatcher().add(2, 5); + this.getDataWatcher().a(3, Byte.valueOf((byte) 0)); ++ // Spigot start - protocol patch ++ this.getDataWatcher().add(8, 5); ++ this.getDataWatcher().a(9, Byte.valueOf((byte) 0)); ++ // Spigot end + } + + public boolean damageEntity(DamageSource damagesource, float f) { +@@ -99,6 +103,10 @@ public class EntityItemFrame extends EntityHanging { + + this.getDataWatcher().watch(2, itemstack); + this.getDataWatcher().update(2); ++ // Spigot start - protocol patch ++ this.getDataWatcher().watch(8, itemstack); ++ this.getDataWatcher().update(8); ++ // Spigot end + } + + public int getRotation() { +@@ -107,6 +115,7 @@ public class EntityItemFrame extends EntityHanging { + + public void setRotation(int i) { + this.getDataWatcher().watch(3, Byte.valueOf((byte) (i % 4))); ++ this.getDataWatcher().watch(9, Byte.valueOf((byte) ((i % 4) * 2))); // Spigot - protocol patch + } + + public void b(NBTTagCompound nbttagcompound) { +diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +index 2a1e69d..0710fcc 100644 +--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +@@ -74,7 +74,7 @@ public abstract class EntityMinecartAbstract extends Entity { + this.datawatcher.a(17, new Integer(0)); + this.datawatcher.a(18, new Integer(1)); + this.datawatcher.a(19, new Float(0.0F)); +- this.datawatcher.a(20, new Integer(0)); ++ this.datawatcher.a(20, new org.spigotmc.ProtocolData.DualInt(0, 0)); // Spigot - protocol patch + this.datawatcher.a(21, new Integer(6)); + this.datawatcher.a(22, Byte.valueOf((byte) 0)); + } +@@ -841,12 +841,22 @@ public abstract class EntityMinecartAbstract extends Entity { + } + + public void k(int i) { +- this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.p() << 16)); ++ // Spigot start - protocol patch ++ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20); ++ val.value = Integer.valueOf(i & '\uffff' | this.p() << 16); ++ val.value2 = Integer.valueOf(i & '\uffff' | this.p() << 12); ++ this.getDataWatcher().watch(20, val); ++ // Spigot end + this.a(true); + } + + public void l(int i) { +- this.getDataWatcher().watch(20, Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16)); ++ // Spigot start - protocol patch ++ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20); ++ val.value = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16); ++ val.value2 = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 12); ++ this.getDataWatcher().watch(20, val); ++ // Spigot end + this.a(true); + } + +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 413af68..bf70d65 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -26,6 +26,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; + import org.bukkit.event.inventory.InventoryType; + import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; + // CraftBukkit end ++import org.spigotmc.ProtocolData; // Spigot - protocol patch + + public class EntityPlayer extends EntityHuman implements ICrafting { + +@@ -233,7 +234,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + + if (!arraylist.isEmpty()) { +- this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist)); ++ this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist, this.playerConnection.networkManager.getVersion())); // Spigot - protocol patch + Iterator iterator2 = arraylist1.iterator(); + + while (iterator2.hasNext()) { +@@ -594,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // CraftBukkit end + + this.nextContainerCounter(); +- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true)); ++ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 0, true)); // Spigot - protocol patch + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); +@@ -609,7 +610,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // CraftBukkit end + + this.nextContainerCounter(); +- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null)); ++ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 0, s != null)); // Spigot - protocol patch + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); +@@ -624,7 +625,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // CraftBukkit end + + this.nextContainerCounter(); +- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true)); ++ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 0, true)); // Spigot - protocol patch + this.activeContainer = container; // CraftBukkit - Use container we passed to event + this.activeContainer.windowId = this.containerCounter; + this.activeContainer.addSlotListener(this); +@@ -764,7 +765,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + MerchantRecipeList merchantrecipelist = imerchant.getOffers(this); + + if (merchantrecipelist != null) { +- PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer()); ++ PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer(), playerConnection.networkManager.getVersion()); // Spigot + + try { + packetdataserializer.writeInt(this.containerCounter); +@@ -1004,7 +1005,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.server.a(packetplayinsettings.g()); + } + +- this.b(1, !packetplayinsettings.h()); ++ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions) ++ if (packetplayinsettings.version < 16) ++ { ++ this.b( 1, !packetplayinsettings.h(), packetplayinsettings.version ); ++ } else ++ { ++ this.b( 1, false, packetplayinsettings.version ); ++ datawatcher.watch( 10, new ProtocolData.HiddenByte( (byte) packetplayinsettings.flags ) ); ++ } ++ // Spigot end + } + + public EnumChatVisibility getChatFlags() { +@@ -1013,6 +1023,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + public void setResourcePack(String s) { + this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", s.getBytes(Charsets.UTF_8))); ++ // Spigot start - protocol patch ++ if ( playerConnection.networkManager.getVersion() >= 36 ) ++ { ++ playerConnection.sendPacket( new org.spigotmc.ProtocolInjector.PacketPlayResourcePackSend( s, "thinkislazy" ) ); ++ } ++ // Spigot end + } + + public ChunkCoordinates getChunkCoordinates() { +diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +index f654d58..6e32e24 100644 +--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +@@ -320,6 +320,13 @@ public class EntityTrackerEntry { + this.trackedPlayers.add(entityplayer); + Packet packet = this.c(); + ++ // Spigot start - protocol patch ++ if ( tracker instanceof EntityPlayer ) ++ { ++ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); ++ } ++ // Spigot end ++ + entityplayer.playerConnection.sendPacket(packet); + if (!this.tracker.getDataWatcher().d()) { + entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(this.tracker.getId(), this.tracker.getDataWatcher(), true)); +diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java +index 09fdb88..3d659ea 100644 +--- a/src/main/java/net/minecraft/server/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/HandshakeListener.java +@@ -72,7 +72,7 @@ public class HandshakeListener implements PacketHandshakingInListener { + } + // CraftBukkit end + +- if (packethandshakinginsetprotocol.d() > 5) { ++ if (packethandshakinginsetprotocol.d() > 5 && packethandshakinginsetprotocol.d() != 46) { // Spigot + chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + this.b.close(chatcomponenttext); +diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java +index c08ccca..881fd4b 100644 +--- a/src/main/java/net/minecraft/server/ItemWorldMap.java ++++ b/src/main/java/net/minecraft/server/ItemWorldMap.java +@@ -199,7 +199,7 @@ public class ItemWorldMap extends ItemWorldMapBase { + public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) { + byte[] abyte = this.getSavedMap(itemstack, world).getUpdatePacket(itemstack, world, entityhuman); + +- return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte); ++ return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte, this.getSavedMap(itemstack, world).scale); // Spigot - protocol patch + } + + public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { +diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +index e380a70..bd254de 100644 +--- a/src/main/java/net/minecraft/server/LoginListener.java ++++ b/src/main/java/net/minecraft/server/LoginListener.java +@@ -10,6 +10,7 @@ import javax.crypto.SecretKey; + import net.minecraft.util.com.google.common.base.Charsets; + import net.minecraft.util.com.mojang.authlib.GameProfile; + import net.minecraft.util.com.mojang.authlib.properties.Property; ++import net.minecraft.util.io.netty.util.concurrent.Future; + import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; + import net.minecraft.util.org.apache.commons.lang3.Validate; + import org.apache.logging.log4j.LogManager; +@@ -101,6 +102,19 @@ public class LoginListener implements PacketLoginInListener { + // CraftBukkit end + } else { + this.g = EnumProtocolState.e; ++ // Spigot start ++ if ( networkManager.getVersion() >= 27 ) ++ { ++ this.networkManager.handle( new org.spigotmc.ProtocolInjector.PacketLoginCompression( 256 ), new GenericFutureListener() ++ { ++ @Override ++ public void operationComplete(Future future) throws Exception ++ { ++ networkManager.enableCompression(); ++ } ++ } ); ++ } ++ // Spigot end + this.networkManager.handle(new PacketLoginOutSuccess(this.i), new GenericFutureListener[0]); + this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference + } +diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java +index 770da8f..aa6bbf6 100644 +--- a/src/main/java/net/minecraft/server/MerchantRecipe.java ++++ b/src/main/java/net/minecraft/server/MerchantRecipe.java +@@ -5,8 +5,8 @@ public class MerchantRecipe { + private ItemStack buyingItem1; + private ItemStack buyingItem2; + private ItemStack sellingItem; +- private int uses; +- private int maxUses; ++ public int uses; // Spigot - protocol patch ++ public int maxUses; // Spigot - protocol patch + + public MerchantRecipe(NBTTagCompound nbttagcompound) { + this.a(nbttagcompound); +diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java +index be6ab25..6ddbf7a 100644 +--- a/src/main/java/net/minecraft/server/MerchantRecipeList.java ++++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java +@@ -60,6 +60,13 @@ public class MerchantRecipeList extends ArrayList { + } + + packetdataserializer.writeBoolean(merchantrecipe.g()); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 28 ) ++ { ++ packetdataserializer.writeInt( merchantrecipe.uses ); ++ packetdataserializer.writeInt( merchantrecipe.maxUses ); ++ } ++ // Spigot end + } + } + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index b905c6e..8c3950a 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -758,6 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + + public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring) + DispenserRegistry.b(); ++ org.spigotmc.ProtocolInjector.inject(); + + try { + /* CraftBukkit start - Replace everything +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index ae3de2f..6d579e3 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -24,6 +24,8 @@ import org.apache.logging.log4j.Marker; + import org.apache.logging.log4j.MarkerManager; + // Spigot start + import com.google.common.collect.ImmutableSet; ++import org.spigotmc.SpigotCompressor; ++import org.spigotmc.SpigotDecompressor; + // Spigot end + + public class NetworkManager extends SimpleChannelInboundHandler { +@@ -53,7 +55,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private boolean r; + // Spigot Start + public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); +- public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5); ++ public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 46); + public static final int CURRENT_VERSION = 5; + public static int getVersion(Channel attr) + { +@@ -244,4 +246,12 @@ public class NetworkManager extends SimpleChannelInboundHandler { + return this.m.remoteAddress(); + } + // Spigot End ++ ++ ++ // Spigot start - protocol patch ++ public void enableCompression() { ++ m.pipeline().addBefore( "decoder", "decompress", new SpigotDecompressor() ); ++ m.pipeline().addBefore( "encoder", "compress", new SpigotCompressor() ); ++ } ++ // Spigot end + } +diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java +index 592ffc5..7a1e8f0 100644 +--- a/src/main/java/net/minecraft/server/Packet.java ++++ b/src/main/java/net/minecraft/server/Packet.java +@@ -26,12 +26,39 @@ public abstract class Packet { + } + + public static void a(ByteBuf bytebuf, byte[] abyte) { +- bytebuf.writeShort(abyte.length); ++ // Spigot start - protocol patch ++ if (bytebuf instanceof PacketDataSerializer) ++ { ++ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf; ++ if (packetDataSerializer.version >= 20) { ++ packetDataSerializer.b( abyte.length ); ++ } else { ++ bytebuf.writeShort( abyte.length ); ++ } ++ } else ++ { ++ bytebuf.writeShort( abyte.length ); ++ } ++ // Spigot end + bytebuf.writeBytes(abyte); + } + + public static byte[] a(ByteBuf bytebuf) throws IOException { // CraftBukkit - added throws +- short short1 = bytebuf.readShort(); ++ // Spigot start - protocol patch ++ short short1 = 0; ++ if (bytebuf instanceof PacketDataSerializer) ++ { ++ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf; ++ if (packetDataSerializer.version >= 20) { ++ short1 = (short) packetDataSerializer.a(); ++ } else { ++ short1 = bytebuf.readShort(); ++ } ++ } else ++ { ++ short1 = bytebuf.readShort(); ++ } ++ // Spigot end + + if (short1 < 0) { + throw new IOException("Key was smaller than nothing! Weird key!"); +diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java +index e4df5b3..90641d9 100644 +--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +@@ -8,6 +8,7 @@ import java.nio.ByteOrder; + import java.nio.channels.GatheringByteChannel; + import java.nio.channels.ScatteringByteChannel; + import java.nio.charset.Charset; ++import java.util.UUID; + + import net.minecraft.util.com.google.common.base.Charsets; + import net.minecraft.util.io.netty.buffer.ByteBuf; +@@ -16,6 +17,15 @@ import net.minecraft.util.io.netty.buffer.ByteBufProcessor; + + import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit + ++// Spigot start - protocol patch ++import java.io.DataInputStream; ++import java.io.DataOutputStream; ++import net.minecraft.util.io.netty.buffer.Unpooled; ++import net.minecraft.util.io.netty.buffer.ByteBufInputStream; ++import net.minecraft.util.io.netty.buffer.ByteBufOutputStream; ++import org.spigotmc.SpigotComponentReverter; ++// Spigot end ++ + public class PacketDataSerializer extends ByteBuf { + + private final ByteBuf a; +@@ -31,6 +41,32 @@ public class PacketDataSerializer extends ByteBuf { + this.a = bytebuf; + this.version = version; + } ++ ++ public void writePosition(int x, int y, int z) { ++ writeLong( ( ( (long) x & 0x3FFFFFFL ) << 38 ) ++ | ( ( (long) y & 0xFFFL ) << 26 ) ++ | ( (long) z & 0x3FFFFFFL ) ); ++ } ++ ++ public int readPositionX(long val) ++ { ++ return (int) ( val >> 38 ); ++ } ++ ++ public int readPositionY(long val) ++ { ++ return (int) (val << 26 >> 52); ++ } ++ ++ public int readPositionZ(long val) ++ { ++ return (int) (val << 38 >> 38); ++ } ++ ++ public void writeUUID(UUID uuid) { ++ writeLong( uuid.getMostSignificantBits() ); ++ writeLong( uuid.getLeastSignificantBits() ); ++ } + // Spigot End + + public static int a(int i) { +@@ -63,29 +99,61 @@ public class PacketDataSerializer extends ByteBuf { + this.writeByte(i); + } + +- public void a(NBTTagCompound nbttagcompound) { +- if (nbttagcompound == null) { +- this.writeShort(-1); +- } else { +- byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound); +- +- this.writeShort((short) abyte.length); +- this.writeBytes(abyte); ++ // Spigot start - protocol patch ++ public void a(NBTTagCompound nbttagcompound) ++ { ++ if ( version < 28 ) ++ { ++ if ( nbttagcompound == null ) ++ { ++ this.writeShort( -1 ); ++ } else ++ { ++ byte[] abyte = NBTCompressedStreamTools.a( nbttagcompound ); ++ ++ this.writeShort( (short) abyte.length ); ++ this.writeBytes( abyte ); ++ } ++ } else ++ { ++ if ( nbttagcompound == null ) ++ { ++ this.writeByte( 0 ); ++ } else ++ { ++ ByteBufOutputStream out = new ByteBufOutputStream( Unpooled.buffer() ); ++ NBTCompressedStreamTools.a( nbttagcompound, (java.io.DataOutput) new DataOutputStream( out ) ); ++ writeBytes( out.buffer() ); ++ out.buffer().release(); ++ } + } + } + + public NBTTagCompound b() { +- short short1 = this.readShort(); +- +- if (short1 < 0) { +- return null; ++ if ( version < 28 ) ++ { ++ short short1 = this.readShort(); ++ ++ if ( short1 < 0 ) ++ { ++ return null; ++ } else ++ { ++ byte[] abyte = new byte[ short1 ]; ++ ++ this.readBytes( abyte ); ++ return NBTCompressedStreamTools.a( abyte, new NBTReadLimiter( 2097152L ) ); ++ } + } else { +- byte[] abyte = new byte[short1]; +- +- this.readBytes(abyte); +- return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L)); ++ int index = readerIndex(); ++ if (readByte() == 0) { ++ return null; ++ } ++ readerIndex(index); ++ return NBTCompressedStreamTools.a( new DataInputStream( new ByteBufInputStream( a ) ) ); + } + } ++ // Spigot end + + public void a(ItemStack itemstack) { + if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem() +@@ -104,6 +172,31 @@ public class PacketDataSerializer extends ByteBuf { + nbttagcompound = itemstack.tag; + } + ++ // Spigot start - protocol patch ++ if (nbttagcompound != null && version >= 29 ) ++ { ++ if ( itemstack.getItem() == Items.WRITTEN_BOOK && nbttagcompound.hasKeyOfType("pages", 9) ) ++ { ++ nbttagcompound = (NBTTagCompound) nbttagcompound.clone(); ++ NBTTagList nbttaglist = nbttagcompound.getList( "pages", 8 ); ++ NBTTagList newList = new NBTTagList(); ++ for (int i = 0; i < nbttaglist.size(); ++i) ++ { ++ IChatBaseComponent[] parts = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( nbttaglist.getString( i ) ); ++ IChatBaseComponent root = parts[0]; ++ for ( int i1 = 1; i1 < parts.length; i1++ ) ++ { ++ IChatBaseComponent c = parts[ i1 ]; ++ root.a( "\n" ); ++ root.addSibling( c ); ++ } ++ newList.add( new NBTTagString( ChatSerializer.a( root ) ) ); ++ } ++ nbttagcompound.set( "pages", newList ); ++ } ++ } ++ // Spigot end ++ + this.a(nbttagcompound); + } + } +@@ -120,6 +213,24 @@ public class PacketDataSerializer extends ByteBuf { + itemstack.tag = this.b(); + // CraftBukkit start + if (itemstack.tag != null) { ++ ++ // Spigot start - protocol patch ++ if ( version >= 29 ++ && itemstack.getItem() == Items.WRITTEN_BOOK ++ && itemstack.tag.hasKeyOfType("pages", 9) ) ++ { ++ NBTTagList nbttaglist = itemstack.tag.getList( "pages", 8 ); ++ NBTTagList newList = new NBTTagList(); ++ for (int i = 0; i < nbttaglist.size(); ++i) ++ { ++ IChatBaseComponent s = ChatSerializer.a( nbttaglist.getString( i ) ); ++ String newString = SpigotComponentReverter.toLegacy( s ); ++ newList.add( new NBTTagString( newString ) ); ++ } ++ itemstack.tag.set( "pages", newList ); ++ } ++ // Spigot end ++ + CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java +index 71ec28c..5213f1f 100644 +--- a/src/main/java/net/minecraft/server/PacketDecoder.java ++++ b/src/main/java/net/minecraft/server/PacketDecoder.java +@@ -26,7 +26,7 @@ public class PacketDecoder extends ByteToMessageDecoder { + int i = bytebuf.readableBytes(); + + if (i != 0) { +- PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); ++ PacketDataSerializer packetdataserializer = new PacketDataSerializer( bytebuf, NetworkManager.getVersion( channelhandlercontext.channel() ) ); // Spigot + int j = packetdataserializer.a(); + Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j); + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java +index 91df585..91d9e58 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java +@@ -8,8 +8,15 @@ public class PacketPlayInArmAnimation extends Packet { + public PacketPlayInArmAnimation() {} + + public void a(PacketDataSerializer packetdataserializer) { +- this.a = packetdataserializer.readInt(); +- this.b = packetdataserializer.readByte(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readByte(); ++ } else { ++ b = 1; ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +index 3c5ed45..e85ba8c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +@@ -12,9 +12,20 @@ public class PacketPlayInBlockDig extends Packet { + + public void a(PacketDataSerializer packetdataserializer) { + this.e = packetdataserializer.readUnsignedByte(); +- this.a = packetdataserializer.readInt(); +- this.b = packetdataserializer.readUnsignedByte(); +- this.c = packetdataserializer.readInt(); ++ // Spigot start ++ if ( packetdataserializer.version < 16) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ this.c = packetdataserializer.readInt(); ++ } else ++ { ++ long position = packetdataserializer.readLong(); ++ a = packetdataserializer.readPositionX( position ); ++ b = packetdataserializer.readPositionY( position ); ++ c = packetdataserializer.readPositionZ( position ); ++ } ++ // Spigot end + this.face = packetdataserializer.readUnsignedByte(); + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +index 701b3a2..b9cea4c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +@@ -14,9 +14,20 @@ public class PacketPlayInBlockPlace extends Packet { + public PacketPlayInBlockPlace() {} + + public void a(PacketDataSerializer packetdataserializer) { +- this.a = packetdataserializer.readInt(); +- this.b = packetdataserializer.readUnsignedByte(); +- this.c = packetdataserializer.readInt(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ this.c = packetdataserializer.readInt(); ++ } else ++ { ++ long position = packetdataserializer.readLong(); ++ a = packetdataserializer.readPositionX( position ); ++ b = packetdataserializer.readPositionY( position ); ++ c = packetdataserializer.readPositionZ( position ); ++ } ++ // Spigot end + this.d = packetdataserializer.readUnsignedByte(); + this.e = packetdataserializer.c(); + this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F; +diff --git a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java +index 5df99a4..54ac5b7 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java +@@ -12,7 +12,15 @@ public class PacketPlayInCustomPayload extends Packet { + + public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws + this.tag = packetdataserializer.c(20); +- this.length = packetdataserializer.readShort(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 29 ) ++ { ++ this.length = packetdataserializer.readShort(); ++ } else ++ { ++ this.length = packetdataserializer.readableBytes(); ++ } ++ // Spigot end + if (this.length > 0 && this.length < 32767) { + this.data = new byte[this.length]; + packetdataserializer.readBytes(this.data); +diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +index e05fe07..5e4a377 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +@@ -9,9 +9,19 @@ public class PacketPlayInEntityAction extends Packet { + public PacketPlayInEntityAction() {} + + public void a(PacketDataSerializer packetdataserializer) { +- this.a = packetdataserializer.readInt(); +- this.animation = packetdataserializer.readByte(); +- this.c = packetdataserializer.readInt(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.animation = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readInt(); ++ } else ++ { ++ a = packetdataserializer.a(); ++ animation = packetdataserializer.readUnsignedByte() + 1; ++ c = packetdataserializer.a(); ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java +index 6dab3b9..5c88cf1 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java +@@ -11,7 +11,15 @@ public class PacketPlayInKeepAlive extends Packet { + } + + public void a(PacketDataSerializer packetdataserializer) { +- this.a = packetdataserializer.readInt(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ } else ++ { ++ this.a = packetdataserializer.a(); ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java +index 63b8e4b..2f3a2ec 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInPosition.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java +@@ -8,8 +8,17 @@ public class PacketPlayInPosition extends PacketPlayInFlying { + + public void a(PacketDataSerializer packetdataserializer) { + this.x = packetdataserializer.readDouble(); +- this.y = packetdataserializer.readDouble(); +- this.stance = packetdataserializer.readDouble(); ++ // Spigot start - protocol patch ++ if (packetdataserializer.version < 16) ++ { ++ this.y = packetdataserializer.readDouble(); ++ this.stance = packetdataserializer.readDouble(); ++ } else ++ { ++ this.y = packetdataserializer.readDouble(); ++ this.stance = y + 1.62; ++ } ++ // Spigot end + this.z = packetdataserializer.readDouble(); + super.a(packetdataserializer); + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java +index 9a6b726..0266592 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java +@@ -9,8 +9,17 @@ public class PacketPlayInPositionLook extends PacketPlayInFlying { + + public void a(PacketDataSerializer packetdataserializer) { + this.x = packetdataserializer.readDouble(); +- this.y = packetdataserializer.readDouble(); +- this.stance = packetdataserializer.readDouble(); ++ // Spigot start - protocol patch ++ if (packetdataserializer.version < 16) ++ { ++ this.y = packetdataserializer.readDouble(); ++ this.stance = packetdataserializer.readDouble(); ++ } else ++ { ++ this.y = packetdataserializer.readDouble(); ++ this.stance = y + 1.62; ++ } ++ // Spigot end + this.z = packetdataserializer.readDouble(); + this.yaw = packetdataserializer.readFloat(); + this.pitch = packetdataserializer.readFloat(); +diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java +index 034fd5e..ea51d91 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java +@@ -11,6 +11,11 @@ public class PacketPlayInSettings extends Packet { + private EnumDifficulty e; + private boolean f; + ++ // Spigot start - protocol patch ++ public int version; ++ public int flags; ++ // Spigot end ++ + public PacketPlayInSettings() {} + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +@@ -18,8 +23,17 @@ public class PacketPlayInSettings extends Packet { + this.b = packetdataserializer.readByte(); + this.c = EnumChatVisibility.a(packetdataserializer.readByte()); + this.d = packetdataserializer.readBoolean(); +- this.e = EnumDifficulty.getById(packetdataserializer.readByte()); +- this.f = packetdataserializer.readBoolean(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.e = EnumDifficulty.getById( packetdataserializer.readByte() ); ++ this.f = packetdataserializer.readBoolean(); ++ } else ++ { ++ flags = packetdataserializer.readUnsignedByte(); ++ } ++ version = packetdataserializer.version; ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java +index d304284..c26bf77 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java +@@ -12,8 +12,17 @@ public class PacketPlayInSteerVehicle extends Packet { + public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.readFloat(); + this.b = packetdataserializer.readFloat(); +- this.c = packetdataserializer.readBoolean(); +- this.d = packetdataserializer.readBoolean(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.c = packetdataserializer.readBoolean(); ++ this.d = packetdataserializer.readBoolean(); ++ } else { ++ int flags = packetdataserializer.readUnsignedByte(); ++ c = (flags & 0x1) != 0; ++ d = (flags & 0x2) != 0; ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java +index 476638e..5909876 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java +@@ -16,6 +16,14 @@ public class PacketPlayInTabComplete extends Packet { + + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.c(32767); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 37 ) ++ { ++ if (packetdataserializer.readBoolean()) { ++ long position = packetdataserializer.readLong(); ++ } ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java +index 3458448..f6cf5c8 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java +@@ -12,13 +12,35 @@ public class PacketPlayInUpdateSign extends Packet { + public PacketPlayInUpdateSign() {} + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +- this.a = packetdataserializer.readInt(); +- this.b = packetdataserializer.readShort(); +- this.c = packetdataserializer.readInt(); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readInt(); ++ } else ++ { ++ long position = packetdataserializer.readLong(); ++ a = packetdataserializer.readPositionX( position ); ++ b = packetdataserializer.readPositionY( position ); ++ c = packetdataserializer.readPositionZ( position ); ++ } ++ // Spigot end + this.d = new String[4]; + + for (int i = 0; i < 4; ++i) { +- this.d[i] = packetdataserializer.c(15); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 21 ) ++ { ++ this.d[ i ] = packetdataserializer.c( 15 ); ++ } else ++ { ++ this.d[ i ] = ChatSerializer.a( packetdataserializer.c( Short.MAX_VALUE ) ).c(); ++ } ++ if (this.d[i].length() > 15) { ++ this.d[i] = this.d[i].substring( 0, 15 ); ++ } ++ // Spigot end + } + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +index 39f3037..3f12453 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +@@ -8,8 +8,24 @@ public class PacketPlayInUseEntity extends Packet { + public PacketPlayInUseEntity() {} + + public void a(PacketDataSerializer packetdataserializer) { +- this.a = packetdataserializer.readInt(); +- this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; ++ // Spigot start ++ if ( packetdataserializer.version < 16 ) ++ { ++ this.a = packetdataserializer.readInt(); ++ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; ++ } else { ++ this.a = packetdataserializer.a(); ++ int val = packetdataserializer.a(); ++ if ( val == 2 ) { ++ packetdataserializer.readFloat(); ++ packetdataserializer.readFloat(); ++ packetdataserializer.readFloat(); ++ } else ++ { ++ this.action = EnumEntityUseAction.values()[ val % EnumEntityUseAction.values().length ]; ++ } ++ } ++ // Spigot end + } + + public void b(PacketDataSerializer packetdataserializer) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java +index 2bba639..87daa8e 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java +@@ -3,7 +3,7 @@ package net.minecraft.server; + public class PacketPlayInWindowClick extends Packet { + + private int a; +- private int slot; ++ public int slot; // Spigot + private int button; + private short d; + private ItemStack item; +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +index d7954ff..b361f38 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutBed.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +@@ -24,10 +24,19 @@ public class PacketPlayOutBed extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeInt(this.b); +- packetdataserializer.writeByte(this.c); +- packetdataserializer.writeInt(this.d); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeInt( this.b ); ++ packetdataserializer.writeByte( this.c ); ++ packetdataserializer.writeInt( this.d ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ packetdataserializer.writePosition( b, c, d ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +index cdcdfd6..959d052 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +@@ -30,9 +30,17 @@ public class PacketPlayOutBlockAction extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeShort(this.b); +- packetdataserializer.writeInt(this.c); ++ // Spigot start ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeShort( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ } else ++ { ++ packetdataserializer.writePosition( a, b, c ); ++ } ++ // Spigot end + packetdataserializer.writeByte(this.d); + packetdataserializer.writeByte(this.e); + packetdataserializer.b(Block.getId(this.f) & 4095); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +index c93e8bc..1d70129 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +@@ -28,9 +28,17 @@ public class PacketPlayOutBlockBreakAnimation extends Packet { + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.b(this.a); +- packetdataserializer.writeInt(this.b); +- packetdataserializer.writeInt(this.c); +- packetdataserializer.writeInt(this.d); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ packetdataserializer.writeInt( this.d ); ++ } else ++ { ++ packetdataserializer.writePosition( b, c, d ); ++ } ++ // Spigot end + packetdataserializer.writeByte(this.e); + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java +index 4c622e2..25f45a0 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java +@@ -27,11 +27,22 @@ public class PacketPlayOutBlockChange extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeByte(this.b); +- packetdataserializer.writeInt(this.c); +- packetdataserializer.b(Block.getId(this.block)); +- packetdataserializer.writeByte(this.data); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 25 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeByte( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ packetdataserializer.b( Block.getId( this.block ) ); ++ packetdataserializer.writeByte(this.data); ++ } else ++ { ++ packetdataserializer.writePosition( a, b, c ); ++ int id = Block.getId( this.block ); ++ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( id, data ); ++ packetdataserializer.b( (id << 4) | this.data ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +index f6863bd..fdbdcc6 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -27,6 +27,12 @@ public class PacketPlayOutChat extends Packet { + + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a(ChatSerializer.a(this.a)); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 16 ) ++ { ++ packetdataserializer.writeByte(0); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java +index 0870ac9..8eff9e5 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java +@@ -18,8 +18,17 @@ public class PacketPlayOutCollect extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeInt(this.b); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeInt( this.b ); ++ } else ++ { ++ packetdataserializer.b( this.a ); ++ packetdataserializer.b( this.b ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java +index f2a032e..fda616c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java +@@ -31,8 +31,17 @@ public class PacketPlayOutCustomPayload extends Packet { + + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a(this.tag); +- packetdataserializer.writeShort(this.data.length); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 29 ) ++ { ++ packetdataserializer.writeShort( this.data.length ); ++ } + packetdataserializer.writeBytes(this.data); ++ if ( packetdataserializer.version >= 29 && tag.equals( "MC|AdvCdm" ) ) ++ { ++ packetdataserializer.writeBoolean( true ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +index dc4259d..749b32d 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +@@ -21,7 +21,15 @@ public class PacketPlayOutEntity extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +index 4fa5b82..bef5ae3 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +@@ -19,11 +19,22 @@ public class PacketPlayOutEntityDestroy extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeByte(this.a.length); +- +- for (int i = 0; i < this.a.length; ++i) { +- packetdataserializer.writeInt(this.a[i]); ++ // Spigot start - protocol lib ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeByte( this.a.length ); ++ ++ for ( int i = 0; i < this.a.length; ++i ) ++ { ++ packetdataserializer.writeInt( this.a[ i ] ); ++ } ++ } else { ++ packetdataserializer.b( a.length ); ++ for ( int i : a ) { ++ packetdataserializer.b( i ); ++ } + } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java +index 97752ca..3693850 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java +@@ -28,10 +28,22 @@ public class PacketPlayOutEntityEffect extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeByte(this.b); +- packetdataserializer.writeByte(this.c); +- packetdataserializer.writeShort(this.d); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeByte( this.b ); ++ packetdataserializer.writeByte( this.c ); ++ packetdataserializer.writeShort( this.d ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ packetdataserializer.writeByte( b ); ++ packetdataserializer.writeByte( c ); ++ packetdataserializer.b( d ); ++ packetdataserializer.writeBoolean( false ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +index 736e3fd..1ca4f08 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +@@ -21,7 +21,14 @@ public class PacketPlayOutEntityEquipment extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt(this.a); ++ } else { ++ packetdataserializer.b( this.a ); ++ } ++ // Spigot end + packetdataserializer.writeShort(this.b); + packetdataserializer.a(this.c); + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +index 0204062..2e4abe1 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +@@ -18,7 +18,15 @@ public class PacketPlayOutEntityHeadRotation extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + packetdataserializer.writeByte(this.b); + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java +index 72243ec..238e346 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java +@@ -23,6 +23,12 @@ public class PacketPlayOutEntityLook extends PacketPlayOutEntity { + super.b(packetdataserializer); + packetdataserializer.writeByte(this.e); + packetdataserializer.writeByte(this.f); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 22 ) ++ { ++ packetdataserializer.writeBoolean( true ); ++ } ++ // Spigot end + } + + public String b() { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +index a95877f..c937f59 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +@@ -24,8 +24,16 @@ public class PacketPlayOutEntityMetadata extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- DataWatcher.a(this.b, packetdataserializer); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ DataWatcher.a(this.b, packetdataserializer, packetdataserializer.version); ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +index c988bcc..6a0f882 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +@@ -39,12 +39,26 @@ public class PacketPlayOutEntityTeleport extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + packetdataserializer.writeInt(this.b); + packetdataserializer.writeInt(this.c); + packetdataserializer.writeInt(this.d); + packetdataserializer.writeByte(this.e); + packetdataserializer.writeByte(this.f); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 22 ) ++ { ++ packetdataserializer.writeBoolean( true ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +index 46f2543..170f27f 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +@@ -54,7 +54,15 @@ public class PacketPlayOutEntityVelocity extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + packetdataserializer.writeShort(this.b); + packetdataserializer.writeShort(this.c); + packetdataserializer.writeShort(this.d); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java +index 4038cc8..35788b2 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java +@@ -22,8 +22,17 @@ public class PacketPlayOutExperience extends Packet { + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeFloat(this.a); +- packetdataserializer.writeShort(this.c); +- packetdataserializer.writeShort(this.b); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeShort( this.c ); ++ packetdataserializer.writeShort( this.b ); ++ } else ++ { ++ packetdataserializer.b( c ); ++ packetdataserializer.b( b ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java +index 456532b..e9ff5ee 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java +@@ -19,7 +19,15 @@ public class PacketPlayOutKeepAlive extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start ++ if ( packetdataserializer.version >= 32 ) ++ { ++ packetdataserializer.b( this.a ); ++ } else ++ { ++ packetdataserializer.writeInt( this.a ); ++ } ++ // Spigot end + } + + public boolean a() { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java +index 49e0ff5..9ebf9b5 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java +@@ -54,6 +54,13 @@ public class PacketPlayOutLogin extends Packet { + packetdataserializer.writeByte(this.e.a()); + packetdataserializer.writeByte(this.f); + packetdataserializer.a(this.g.name()); ++ ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 29 ) ++ { ++ packetdataserializer.writeBoolean( false ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java +index 5980c2d..1c69026 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMap.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java +@@ -1,13 +1,19 @@ + package net.minecraft.server; + ++import java.util.Arrays; ++ + public class PacketPlayOutMap extends Packet { + + private int a; + private byte[] b; ++ private byte scale; // Spigot - protocol patch + + public PacketPlayOutMap() {} + +- public PacketPlayOutMap(int i, byte[] abyte) { ++ // Spigot start - protocol patch ++ public PacketPlayOutMap(int i, byte[] abyte, byte scale) { ++ this.scale = scale; ++ // Spigot end + this.a = i; + this.b = abyte; + } +@@ -20,8 +26,35 @@ public class PacketPlayOutMap extends Packet { + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.b(this.a); +- packetdataserializer.writeShort(this.b.length); +- packetdataserializer.writeBytes(this.b); ++ if ( packetdataserializer.version < 27 ) ++ { ++ packetdataserializer.writeShort( this.b.length ); ++ packetdataserializer.writeBytes( this.b ); ++ } else { ++ packetdataserializer.writeByte( scale ); ++ if (b[0] == 1) { ++ int count = (b.length - 1) / 3; ++ packetdataserializer.b( count ); ++ for (int i = 0; i < count; i++) { ++ packetdataserializer.writeByte( b[1 + i * 3] ); ++ packetdataserializer.writeByte( b[2 + i * 3] ); ++ packetdataserializer.writeByte( b[3 + i * 3] ); ++ } ++ } else { ++ packetdataserializer.b( 0 ); ++ } ++ ++ if (b[0] == 0) { ++ packetdataserializer.writeByte( 1 ); ++ int rows = (b.length - 3); ++ packetdataserializer.writeByte( rows ); ++ packetdataserializer.writeByte( b[1] ); ++ packetdataserializer.writeByte( b[2] ); ++ a( packetdataserializer, Arrays.copyOfRange(b, 3, rows) ); ++ } else { ++ packetdataserializer.writeByte( 0 ); ++ } ++ } + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index 7479600..843f4e0 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -17,28 +17,24 @@ public class PacketPlayOutMapChunk extends Packet { + private int h; + private static byte[] i = new byte[196864]; + ++ private Chunk chunk; // Spigot ++ private int mask; // Spigot ++ + public PacketPlayOutMapChunk() {} + +- public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { ++ // Spigot start - protocol patch ++ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i, int version) { ++ this.chunk = chunk; ++ this.mask = i; + this.a = chunk.locX; + this.b = chunk.locZ; + this.g = flag; +- ChunkMap chunkmap = a(chunk, flag, i); +- Deflater deflater = new Deflater(4); // Spigot ++ ChunkMap chunkmap = a(chunk, flag, i, version); + + 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.f = chunkmap.a; +- deflater.setInput(chunkmap.a, 0, chunkmap.a.length); +- deflater.finish(); +- this.e = new byte[chunkmap.a.length]; +- this.h = deflater.deflate(this.e); +- } finally { +- deflater.end(); +- } ++ this.f = chunkmap.a; + } + + public static int c() { +@@ -89,9 +85,28 @@ public class PacketPlayOutMapChunk extends Packet { + packetdataserializer.writeInt(this.b); + packetdataserializer.writeBoolean(this.g); + packetdataserializer.writeShort((short) (this.c & '\uffff')); +- packetdataserializer.writeShort((short) (this.d & '\uffff')); +- packetdataserializer.writeInt(this.h); +- packetdataserializer.writeBytes(this.e, 0, this.h); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 27 ) ++ { ++ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, false); // Spigot ++ Deflater deflater = new Deflater(4); // Spigot ++ try { ++ deflater.setInput(this.f, 0, this.f.length); ++ deflater.finish(); ++ this.e = new byte[this.f.length]; ++ this.h = deflater.deflate(this.e); ++ } finally { ++ deflater.end(); ++ } ++ packetdataserializer.writeShort( (short) ( this.d & '\uffff' ) ); ++ packetdataserializer.writeInt( this.h ); ++ packetdataserializer.writeBytes( this.e, 0, this.h ); ++ } else ++ { ++ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, true); // Spigot ++ a( packetdataserializer, this.f ); ++ } ++ // Spigot end - protocol patch + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +@@ -102,7 +117,8 @@ public class PacketPlayOutMapChunk extends Packet { + 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.g), Integer.valueOf(this.c), Integer.valueOf(this.d), Integer.valueOf(this.h)}); + } + +- public static ChunkMap a(Chunk chunk, boolean flag, int i) { ++ // Spigot start - protocol patch ++ public static ChunkMap a(Chunk chunk, boolean flag, int i, int version) { + int j = 0; + ChunkSection[] achunksection = chunk.getSections(); + int k = 0; +@@ -125,22 +141,59 @@ public class PacketPlayOutMapChunk extends Packet { + } + } + +- for (l = 0; l < achunksection.length; ++l) { +- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { +- byte[] abyte1 = achunksection[l].getIdArray(); ++ if ( version < 24 ) ++ { ++ 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; ++ System.arraycopy( abyte1, 0, abyte, j, abyte1.length ); ++ j += abyte1.length; ++ } ++ } ++ } else { ++ for ( l = 0; l < achunksection.length; ++l ) ++ { ++ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 ) ++ { ++ byte[] abyte1 = achunksection[ l ].getIdArray(); ++ NibbleArray nibblearray = achunksection[ l ].getDataArray(); ++ for ( int ind = 0; ind < abyte1.length; ind++ ) ++ { ++ int id = abyte1[ ind ] & 0xFF; ++ int px = ind & 0xF; ++ int py = ( ind >> 8 ) & 0xF; ++ int pz = ( ind >> 4 ) & 0xF; ++ int data = nibblearray.a( px, py, pz ); ++ if ( id == 90 && data == 0 ) ++ { ++ Blocks.PORTAL.updateShape( chunk.world, ( chunk.locX << 4 ) + px, ( l << 4 ) + py, ( chunk.locZ << 4 ) + pz ); ++ } else ++ { ++ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( id, data ); ++ } ++ char val = (char) ( id << 4 | data ); ++ abyte[ j++ ] = (byte) ( val & 0xFF ); ++ abyte[ j++ ] = (byte) ( ( val >> 8 ) & 0xFF ); ++ } ++ } + } + } + + 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; ++ if ( version < 24 ) ++ { ++ 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; ++ } + } + } + +@@ -162,7 +215,7 @@ public class PacketPlayOutMapChunk extends Packet { + } + } + +- if (k > 0) { ++ if (k > 0 && version < 24) { + 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(); +@@ -183,7 +236,9 @@ public class PacketPlayOutMapChunk extends Packet { + System.arraycopy(abyte, 0, chunkmap.a, 0, j); + return chunkmap; + } ++ // Spigot end - protocol patch + ++ @Override + public void handle(PacketListener packetlistener) { + this.a((PacketPlayOutListener) packetlistener); + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +index 30bf8a7..b9db43c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -30,7 +30,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { + + public PacketPlayOutMapChunkBulk() {} + +- public PacketPlayOutMapChunkBulk(List list) { ++ public PacketPlayOutMapChunkBulk(List list, int version) { + int i = list.size(); + + this.a = new int[i]; +@@ -43,7 +43,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { + + for (int k = 0; k < i; ++k) { + Chunk chunk = (Chunk) list.get(k); +- ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); ++ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff', version); + + // Spigot start + world = chunk.world; +@@ -89,7 +89,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { + int finalBufferSize = 0; + // Obfuscate all sections + for (int i = 0; i < a.length; i++) { +- world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world); ++ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, false); + finalBufferSize += inflatedBuffers[i].length; + } + +@@ -174,17 +174,34 @@ public class PacketPlayOutMapChunkBulk extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - throws IOException +- compress(); // CraftBukkit +- packetdataserializer.writeShort(this.a.length); +- packetdataserializer.writeInt(this.size); +- packetdataserializer.writeBoolean(this.h); +- packetdataserializer.writeBytes(this.buffer, 0, this.size); +- +- for (int i = 0; i < this.a.length; ++i) { +- packetdataserializer.writeInt(this.a[i]); +- packetdataserializer.writeInt(this.b[i]); +- packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); +- packetdataserializer.writeShort((short) (this.d[i] & '\uffff')); ++ if ( packetdataserializer.version < 27 ) ++ { ++ compress(); // CraftBukkit ++ packetdataserializer.writeShort( this.a.length ); ++ packetdataserializer.writeInt( this.size ); ++ packetdataserializer.writeBoolean( this.h ); ++ packetdataserializer.writeBytes( this.buffer, 0, this.size ); ++ ++ for (int i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeInt(this.a[i]); ++ packetdataserializer.writeInt(this.b[i]); ++ packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); ++ packetdataserializer.writeShort( (short) ( this.d[i] & '\uffff' ) ); ++ } ++ } else ++ { ++ packetdataserializer.writeBoolean( this.h ); ++ packetdataserializer.b( this.a.length ); ++ ++ for (int i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeInt(this.a[i]); ++ packetdataserializer.writeInt(this.b[i]); ++ packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); ++ } ++ for (int i = 0; i < this.a.length; ++i) { ++ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, true); ++ packetdataserializer.writeBytes( inflatedBuffers[i] ); ++ } + } + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java +index 0a12db5..0e3419f 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java +@@ -13,26 +13,44 @@ public class PacketPlayOutMultiBlockChange extends Packet { + private ChunkCoordIntPair b; + private byte[] c; + private int d; ++ // Spigot start - protocol patch ++ private short[] ashort; ++ private int[] blocks; ++ private Chunk chunk; ++ // Spigot end + + public PacketPlayOutMultiBlockChange() {} + + public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) { ++ // Spigot start ++ this.ashort = ashort; ++ this.chunk = chunk; ++ // Spigot end + this.b = new ChunkCoordIntPair(chunk.locX, chunk.locZ); + this.d = i; + int j = 4 * i; + +- try { +- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(j); +- DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); ++ try ++ { ++ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream( j ); ++ DataOutputStream dataoutputstream = new DataOutputStream( bytearrayoutputstream ); + ++ // Spigot start ++ blocks = new int[i]; + for (int k = 0; k < i; ++k) { + int l = ashort[k] >> 12 & 15; + int i1 = ashort[k] >> 8 & 15; + int j1 = ashort[k] & 255; + + dataoutputstream.writeShort(ashort[k]); +- dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15)); ++ int blockId = Block.getId( chunk.getType( l, j1, i1 ) ); ++ int data = chunk.getData( l, j1, i1 ); ++ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( blockId, data ); ++ int id = ( blockId & 4095 ) << 4 | data & 15; ++ dataoutputstream.writeShort((short) id); ++ blocks[k] = id; + } ++ // Spigot end + + this.c = bytearrayoutputstream.toByteArray(); + if (this.c.length != j) { +@@ -56,15 +74,31 @@ public class PacketPlayOutMultiBlockChange extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.b.x); +- packetdataserializer.writeInt(this.b.z); +- packetdataserializer.writeShort((short) this.d); +- if (this.c != null) { +- packetdataserializer.writeInt(this.c.length); +- packetdataserializer.writeBytes(this.c); ++ // Spigot start - protocol patch ++ if (packetdataserializer.version < 25) ++ { ++ packetdataserializer.writeInt( this.b.x ); ++ packetdataserializer.writeInt( this.b.z ); ++ packetdataserializer.writeShort( (short) this.d ); ++ if ( this.c != null ) ++ { ++ packetdataserializer.writeInt( this.c.length ); ++ packetdataserializer.writeBytes( this.c ); ++ } else ++ { ++ packetdataserializer.writeInt( 0 ); ++ } + } else { +- packetdataserializer.writeInt(0); ++ packetdataserializer.writeInt( this.b.x ); ++ packetdataserializer.writeInt( this.b.z ); ++ packetdataserializer.b( this.d ); ++ for ( int i = 0; i < d; i++ ) ++ { ++ packetdataserializer.writeShort( ashort[ i ] ); ++ packetdataserializer.b( blocks[ i ] ); ++ } + } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +index ccd4cec..ecc28be 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +@@ -64,8 +64,10 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { + + public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws + packetdataserializer.b(this.a); +- UUID uuid = this.b.getId(); + ++ UUID uuid = this.b.getId(); ++ // Spigot start - protocol patch ++ if (packetdataserializer.version < 20) { + packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot + packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters + if (packetdataserializer.version >= 5 ) { // Spigot +@@ -79,7 +81,12 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { + packetdataserializer.a(property.getValue()); + packetdataserializer.a(property.getSignature()); + } +- } // Spigot ++ } ++ } else ++ { ++ packetdataserializer.writeUUID( uuid ); ++ } ++ // Spigot end + + packetdataserializer.writeInt(this.c); + packetdataserializer.writeInt(this.d); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java +index d67a364..052da02 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java +@@ -25,9 +25,17 @@ public class PacketPlayOutOpenSignEditor extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeInt(this.b); +- packetdataserializer.writeInt(this.c); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeInt( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ } else ++ { ++ packetdataserializer.writePosition( a, b, c ); ++ } ++ // Spigot end + } + + public void handle(PacketListener packetlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +index 860592d..8e9ea33 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +@@ -1,5 +1,7 @@ + package net.minecraft.server; + ++import org.bukkit.craftbukkit.util.CraftChatMessage; ++ + import java.io.IOException; + + public class PacketPlayOutOpenWindow extends Packet { +@@ -43,15 +45,68 @@ public class PacketPlayOutOpenWindow extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.writeByte(this.a); +- packetdataserializer.writeByte(this.b); +- packetdataserializer.a(this.c); +- packetdataserializer.writeByte(this.d); +- packetdataserializer.writeBoolean(this.e); +- if (this.b == 11) { +- packetdataserializer.writeInt(this.f); ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeByte( this.a ); ++ packetdataserializer.writeByte( this.b ); ++ packetdataserializer.a( this.c ); ++ packetdataserializer.writeByte( this.d ); ++ packetdataserializer.writeBoolean( this.e ); ++ if ( this.b == 11 ) ++ { ++ packetdataserializer.writeInt( this.f ); ++ } ++ } else ++ { ++ packetdataserializer.writeByte( a ); ++ packetdataserializer.a( getInventoryString( b ) ); ++ if ( e ) ++ { ++ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( c )[ 0 ] ) ); ++ } else ++ { ++ packetdataserializer.a( ChatSerializer.a( new ChatMessage( c ) ) ); ++ } ++ packetdataserializer.writeByte( d ); ++ if ( this.b == 11 ) ++ { ++ packetdataserializer.writeInt( this.f ); ++ } ++ } ++ } ++ ++ // Spigot start - protocol patch ++ private String getInventoryString(int b) ++ { ++ switch ( b ) { ++ case 0: ++ return "minecraft:chest"; ++ case 1: ++ return "minecraft:crafting_table"; ++ case 2: ++ return "minecraft:furnace"; ++ case 3: ++ return "minecraft:dispenser"; ++ case 4: ++ return "minecraft:enchanting_table"; ++ case 5: ++ return "minecraft:brewing_stand"; ++ case 6: ++ return "minecraft:villager"; ++ case 7: ++ return "minecraft:beacon"; ++ case 8: ++ return "minecraft:anvil"; ++ case 9: ++ return "minecraft:hopper"; ++ case 10: ++ return "minecraft:dropper"; ++ case 11: ++ return "EntityHorse"; + } ++ throw new IllegalArgumentException( "Unknown type " + b ); + } ++ // Spigot end + + public void handle(PacketListener packetlistener) { + this.a((PacketPlayOutListener) packetlistener); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +index 7cae01e..9585615 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +@@ -1,31 +1,138 @@ + package net.minecraft.server; + + import java.io.IOException; ++// Spigot start - protocol patch ++import net.minecraft.util.com.mojang.authlib.GameProfile; ++import net.minecraft.util.com.mojang.authlib.properties.Property; ++import net.minecraft.util.com.mojang.authlib.properties.PropertyMap; ++import org.bukkit.craftbukkit.util.CraftChatMessage; + + public class PacketPlayOutPlayerInfo extends Packet { + +- private String a; +- private boolean b; +- private int c; ++ private static final int ADD_PLAYER = 0; ++ private static final int UPDATE_GAMEMODE = 1; ++ private static final int UPDATE_LATENCY = 2; ++ private static final int UPDATE_DISPLAY_NAME = 3; ++ private static final int REMOVE_PLAYER = 4; ++ ++ private int action; ++ // private int length; We don't batch (yet) ++ private GameProfile player; ++ ++ private int gamemode; ++ private int ping; ++ private String username; + + public PacketPlayOutPlayerInfo() {} + ++ /* removed to force breaking + public PacketPlayOutPlayerInfo(String s, boolean flag, int i) { + this.a = s; + this.b = flag; + this.c = i; + } ++ */ ++ ++ public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) { ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); ++ packet.action = ADD_PLAYER; ++ packet.username = player.listName; ++ packet.player = player.getProfile(); ++ packet.ping = player.ping; ++ packet.gamemode = player.playerInteractManager.getGameMode().getId(); ++ return packet; ++ } ++ ++ public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) { ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); ++ packet.action = UPDATE_LATENCY; ++ packet.username = player.listName; ++ packet.player = player.getProfile(); ++ packet.ping = player.ping; ++ return packet; ++ } ++ ++ public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) { ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); ++ packet.action = UPDATE_LATENCY; ++ packet.username = player.listName; ++ packet.player = player.getProfile(); ++ packet.gamemode = player.playerInteractManager.getGameMode().getId(); ++ return packet; ++ } ++ ++ public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) { ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); ++ packet.action = UPDATE_DISPLAY_NAME; ++ packet.username = player.listName; ++ packet.player = player.getProfile(); ++ return packet; ++ } ++ ++ public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) { ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); ++ packet.action = REMOVE_PLAYER; ++ packet.username = player.listName; ++ packet.player = player.getProfile(); ++ return packet; ++ } + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +- this.a = packetdataserializer.c(16); +- this.b = packetdataserializer.readBoolean(); +- this.c = packetdataserializer.readShort(); ++ // Not needed + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a(this.a); +- packetdataserializer.writeBoolean(this.b); +- packetdataserializer.writeShort(this.c); ++ if ( packetdataserializer.version >= 20 ) ++ { ++ packetdataserializer.b( action ); ++ packetdataserializer.b( 1 ); ++ packetdataserializer.writeUUID( player.getId() ); ++ switch ( action ) ++ { ++ case ADD_PLAYER: ++ packetdataserializer.a( player.getName() ); ++ PropertyMap properties = player.getProperties(); ++ packetdataserializer.b( properties.size() ); ++ for ( Property property : properties.values() ) ++ { ++ packetdataserializer.a( property.getName() ); ++ packetdataserializer.a( property.getValue() ); ++ packetdataserializer.writeBoolean( property.hasSignature() ); ++ if ( property.hasSignature() ) ++ { ++ packetdataserializer.a( property.getSignature() ); ++ } ++ } ++ packetdataserializer.b( gamemode ); ++ packetdataserializer.b( ping ); ++ packetdataserializer.writeBoolean( username != null ); ++ if ( username != null ) ++ { ++ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) ); ++ } ++ break; ++ case UPDATE_GAMEMODE: ++ packetdataserializer.b( gamemode ); ++ break; ++ case UPDATE_LATENCY: ++ packetdataserializer.b( ping ); ++ break; ++ case UPDATE_DISPLAY_NAME: ++ packetdataserializer.writeBoolean( username != null ); ++ if ( username != null ) ++ { ++ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) ); ++ } ++ break; ++ case REMOVE_PLAYER: ++ break; ++ ++ } ++ } else { ++ packetdataserializer.a( username ); ++ packetdataserializer.writeBoolean( action != REMOVE_PLAYER ); ++ packetdataserializer.writeShort( ping ); ++ } + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +@@ -36,3 +143,4 @@ public class PacketPlayOutPlayerInfo extends Packet { + this.a((PacketPlayOutListener) packetlistener); + } + } ++// Spigot end +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java +index f2234f0..b3c0ccf 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java +@@ -30,12 +30,20 @@ public class PacketPlayOutPosition extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { ++ // Spigot start - protocol patch + packetdataserializer.writeDouble(this.a); +- packetdataserializer.writeDouble(this.b); ++ packetdataserializer.writeDouble(this.b - (packetdataserializer.version >= 16 ? 1.62 : 0)); + packetdataserializer.writeDouble(this.c); + packetdataserializer.writeFloat(this.d); + packetdataserializer.writeFloat(this.e); +- packetdataserializer.writeBoolean(this.f); ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeBoolean( this.f ); ++ } else ++ { ++ packetdataserializer.writeByte( 0 ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java +index d83ae7b..7394b72 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java +@@ -23,6 +23,12 @@ public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { + packetdataserializer.writeByte(this.b); + packetdataserializer.writeByte(this.c); + packetdataserializer.writeByte(this.d); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 22 ) ++ { ++ packetdataserializer.writeBoolean( true ); ++ } ++ // Spigot end + } + + public String b() { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java +index 9155c96..165320c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java +@@ -32,6 +32,12 @@ public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { + packetdataserializer.writeByte(this.d); + packetdataserializer.writeByte(this.e); + packetdataserializer.writeByte(this.f); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 22 ) ++ { ++ packetdataserializer.writeBoolean( true ); ++ } ++ // Spigot end + } + + public String b() { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java +index 9041f82..f2c38c5 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java +@@ -18,7 +18,14 @@ public class PacketPlayOutRemoveEntityEffect extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + packetdataserializer.writeByte(this.b); + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +index 7403dbd..a976436 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +@@ -23,9 +23,22 @@ public class PacketPlayOutScoreboardObjective extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a(this.a); +- packetdataserializer.a(this.b); +- packetdataserializer.writeByte(this.c); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.a( this.a ); ++ packetdataserializer.a( this.b ); ++ packetdataserializer.writeByte( this.c ); ++ } else ++ { ++ packetdataserializer.a( a ); ++ packetdataserializer.writeByte( c ); ++ if ( c == 0 || c == 2 ) { ++ packetdataserializer.a( b ); ++ packetdataserializer.a( "hearts" ); ++ } ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +index f50851b..446e308 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +@@ -35,12 +35,25 @@ public class PacketPlayOutScoreboardScore extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a(this.a); +- packetdataserializer.writeByte(this.d); +- if (this.d != 1) { +- packetdataserializer.a(this.b); +- packetdataserializer.writeInt(this.c); ++ packetdataserializer.a( this.a ); ++ packetdataserializer.writeByte( this.d ); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ if ( this.d != 1 ) ++ { ++ packetdataserializer.a( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ } ++ } else ++ { ++ packetdataserializer.a( this.b ); ++ if ( this.d != 1 ) ++ { ++ packetdataserializer.b( c ); ++ } + } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +index e8f0971..abba46c 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +@@ -71,10 +71,25 @@ public class PacketPlayOutScoreboardTeam extends Packet { + packetdataserializer.a(this.c); + packetdataserializer.a(this.d); + packetdataserializer.writeByte(this.g); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 16 ) ++ { ++ packetdataserializer.a( "always" ); ++ packetdataserializer.writeByte( EnumChatFormat.WHITE.ordinal() ); ++ } ++ // Spigot end + } + + if (this.f == 0 || this.f == 3 || this.f == 4) { +- packetdataserializer.writeShort(this.e.size()); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeShort( this.e.size() ); ++ } else ++ { ++ packetdataserializer.b( e.size() ); ++ } ++ // Spigot end + Iterator iterator = this.e.iterator(); + + while (iterator.hasNext()) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +index 5aeb4e3..8893b61 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +@@ -2,8 +2,8 @@ package net.minecraft.server; + + public class PacketPlayOutSetSlot extends Packet { + +- private int a; +- private int b; ++ public int a; // Spigot ++ public int b; // Spigot + private ItemStack c; + + public PacketPlayOutSetSlot() {} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +index 17302e0..dcf1204 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +@@ -84,6 +84,39 @@ public class PacketPlayOutSpawnEntity extends Packet { + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.b(this.a); + packetdataserializer.writeByte(this.j); ++ // Spigot start - protocol patch ++ if ( j == 71 && packetdataserializer.version >= 28 ) ++ { ++ // North: 0 256 ++ // West: 64 192 ++ // South: 128 128 ++ // East: 192 320 ++ switch ( k ) { ++ case 0: ++ d += 32; ++ i = 0; ++ break; ++ case 1: ++ b -= 32; ++ i = 64; ++ break; ++ case 2: ++ d -= 32; ++ i = 128; ++ break; ++ case 3: ++ b += 32; ++ i = 192; ++ break; ++ } ++ } ++ if ( j == 70 && packetdataserializer.version >= 36 ) ++ { ++ int id = k & 0xFFFF; ++ int data = k >> 16; ++ k = id | ( data << 12 ); ++ } ++ // Spigot end + packetdataserializer.writeInt(this.b); + packetdataserializer.writeInt(this.c); + packetdataserializer.writeInt(this.d); +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +index 435fe8d..98b4d97 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +@@ -91,7 +91,7 @@ public class PacketPlayOutSpawnEntityLiving extends Packet { + packetdataserializer.writeShort(this.f); + packetdataserializer.writeShort(this.g); + packetdataserializer.writeShort(this.h); +- this.l.a(packetdataserializer); ++ this.l.a(packetdataserializer, packetdataserializer.version); // Spigot + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java +index 2c86b81..47efb16 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java +@@ -34,10 +34,40 @@ public class PacketPlayOutSpawnEntityPainting extends Packet { + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.b(this.a); + packetdataserializer.a(this.f); +- packetdataserializer.writeInt(this.b); +- packetdataserializer.writeInt(this.c); +- packetdataserializer.writeInt(this.d); +- packetdataserializer.writeInt(this.e); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version >= 28 ) ++ { ++ // North: 0 256 ++ // West: 64 192 ++ // South: 128 128 ++ // East: 192 320 ++ switch ( e ) { ++ case 0: ++ d += 1; ++ break; ++ case 1: ++ b -= 1; ++ break; ++ case 2: ++ d -= 1; ++ break; ++ case 3: ++ b += 1; ++ break; ++ } ++ } ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ packetdataserializer.writeInt( this.d ); ++ packetdataserializer.writeInt( this.e ); ++ } else ++ { ++ packetdataserializer.writePosition( b, c, d ); ++ packetdataserializer.writeByte( e ); ++ } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java +index 92e4036..191d213 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java +@@ -21,9 +21,16 @@ public class PacketPlayOutSpawnPosition extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.x); +- packetdataserializer.writeInt(this.y); +- packetdataserializer.writeInt(this.z); ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.x ); ++ packetdataserializer.writeInt( this.y ); ++ packetdataserializer.writeInt( this.z ); ++ ++ } else ++ { ++ packetdataserializer.writePosition( x, y, z ); ++ } + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java +index 3887d15..ed54ddd 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java +@@ -27,9 +27,17 @@ public class PacketPlayOutTileEntityData extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) { +- packetdataserializer.writeInt(this.a); +- packetdataserializer.writeShort(this.b); +- packetdataserializer.writeInt(this.c); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.a ); ++ packetdataserializer.writeShort( this.b ); ++ packetdataserializer.writeInt( this.c ); ++ } else ++ { ++ packetdataserializer.writePosition( a, b, c ); ++ } ++ // Spigot end + packetdataserializer.writeByte((byte) this.d); + packetdataserializer.a(this.e); + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +index 7b288ad..0c38297 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +@@ -46,7 +46,15 @@ public class PacketPlayOutUpdateAttributes extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.writeInt(this.a); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16) ++ { ++ packetdataserializer.writeInt( this.a ); ++ } else ++ { ++ packetdataserializer.b( a ); ++ } ++ // Spigot end + packetdataserializer.writeInt(this.b.size()); + Iterator iterator = this.b.iterator(); + +@@ -55,7 +63,14 @@ public class PacketPlayOutUpdateAttributes extends Packet { + + packetdataserializer.a(attributesnapshot.a()); + packetdataserializer.writeDouble(attributesnapshot.b()); +- packetdataserializer.writeShort(attributesnapshot.c().size()); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeShort( attributesnapshot.c().size() ); ++ } else { ++ packetdataserializer.b( attributesnapshot.c().size() ); ++ } ++ // Spigot end + Iterator iterator1 = attributesnapshot.c().iterator(); + + while (iterator1.hasNext()) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +index 72b3219..37ede05 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +@@ -22,7 +22,15 @@ public class PacketPlayOutUpdateHealth extends Packet { + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeFloat(this.a); +- packetdataserializer.writeShort(this.b); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeShort( this.b ); ++ } else ++ { ++ packetdataserializer.b( this.b ); ++ } ++ // Spigot end + packetdataserializer.writeFloat(this.c); + } + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java +index 7c5d2eb..e68fc18 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java +@@ -2,6 +2,8 @@ package net.minecraft.server; + + import java.io.IOException; + ++import org.bukkit.craftbukkit.util.CraftChatMessage; // Spigot - protocol patch ++ + public class PacketPlayOutUpdateSign extends Packet { + + private int x; +@@ -30,13 +32,28 @@ public class PacketPlayOutUpdateSign extends Packet { + } + + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.writeInt(this.x); +- packetdataserializer.writeShort(this.y); +- packetdataserializer.writeInt(this.z); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.x ); ++ packetdataserializer.writeShort( this.y ); ++ packetdataserializer.writeInt( this.z ); ++ } else ++ { ++ packetdataserializer.writePosition( x, y, z ); ++ } + + for (int i = 0; i < 4; ++i) { +- packetdataserializer.a(this.lines[i]); ++ if ( packetdataserializer.version < 21 ) ++ { ++ packetdataserializer.a( this.lines[ i ] ); ++ } else ++ { ++ String line = ChatSerializer.a( CraftChatMessage.fromString( this.lines[ i ] )[ 0 ] ); ++ packetdataserializer.a( line ); ++ } + } ++ // Spigot end + } + + public void a(PacketPlayOutListener packetplayoutlistener) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +index 7ea6702..2a96e2d 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +@@ -4,8 +4,8 @@ import java.util.List; + + public class PacketPlayOutWindowItems extends Packet { + +- private int a; +- private ItemStack[] b; ++ public int a; // Spigot ++ public ItemStack[] b; // Spigot + + public PacketPlayOutWindowItems() {} + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java +index f1001c6..a9577b8 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java +@@ -31,9 +31,17 @@ public class PacketPlayOutWorldEvent extends Packet { + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeInt(this.a); +- packetdataserializer.writeInt(this.c); +- packetdataserializer.writeByte(this.d & 255); +- packetdataserializer.writeInt(this.e); ++ // Spigot start - protocol patch ++ if ( packetdataserializer.version < 16 ) ++ { ++ packetdataserializer.writeInt( this.c ); ++ packetdataserializer.writeByte( this.d & 255 ); ++ packetdataserializer.writeInt( this.e ); ++ } else ++ { ++ packetdataserializer.writePosition( c, d, e ); ++ } ++ // Spigot end + packetdataserializer.writeInt(this.b); + packetdataserializer.writeBoolean(this.f); + } +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java +index 29f0c99..d708000 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java +@@ -1,6 +1,7 @@ + package net.minecraft.server; + + import java.io.IOException; ++import java.util.HashMap; // Spigot + + public class PacketPlayOutWorldParticles extends Packet { + +@@ -40,8 +41,19 @@ public class PacketPlayOutWorldParticles extends Packet { + this.i = packetdataserializer.readInt(); + } + ++ // Spigot start - protocol patch + public void b(PacketDataSerializer packetdataserializer) throws IOException { +- packetdataserializer.a(this.a); ++ String[] parts = this.a.split( "_" ); ++ Particle particle = Particle.find( parts[ 0 ] ); ++ if (particle == null) particle = Particle.CRIT; ++ if ( packetdataserializer.version < 17 ) ++ { ++ packetdataserializer.a( this.a ); ++ } else ++ { ++ packetdataserializer.writeInt( particle.ordinal() ); ++ packetdataserializer.writeBoolean( false ); ++ } + packetdataserializer.writeFloat(this.b); + packetdataserializer.writeFloat(this.c); + packetdataserializer.writeFloat(this.d); +@@ -50,7 +62,31 @@ public class PacketPlayOutWorldParticles extends Packet { + packetdataserializer.writeFloat(this.g); + packetdataserializer.writeFloat(this.h); + packetdataserializer.writeInt(this.i); ++ if ( packetdataserializer.version >= 17 ) ++ { ++ for ( int i = 0; i < particle.extra; i++ ) ++ { ++ int toWrite = 0; ++ if ( parts.length - 1 > i ) ++ { ++ try ++ { ++ toWrite = Integer.parseInt( parts[i + 1] ); ++ if ( particle.extra == 1 && parts.length == 3 ) ++ { ++ i++; ++ toWrite = toWrite | (Integer.parseInt( parts[i + 1] ) << 12); ++ } ++ } catch ( NumberFormatException e ) ++ { ++ ++ } ++ } ++ packetdataserializer.b( toWrite ); ++ } ++ } + } ++ // Spigot end + + public void a(PacketPlayOutListener packetplayoutlistener) { + packetplayoutlistener.a(this); +@@ -59,4 +95,79 @@ public class PacketPlayOutWorldParticles extends Packet { + public void handle(PacketListener packetlistener) { + this.a((PacketPlayOutListener) packetlistener); + } ++ ++ // Spigot start - protocol patch ++ private enum Particle ++ { ++ EXPLOSION_NORMAL( "explode" ), ++ EXPLOSION_LARGE( "largeexplode" ), ++ EXPLOSION_HUGE( "hugeexplosion" ), ++ FIREWORKS_SPARK( "fireworksSpark" ), ++ WATER_BUBBLE( "bubble" ), ++ WATER_SPLASH( "splash" ), ++ WATER_WAKE( "wake" ), ++ SUSPENDED( "suspended" ), ++ SUSPENDED_DEPTH( "depthsuspend" ), ++ CRIT( "crit" ), ++ CRIT_MAGIC( "magicCrit" ), ++ SMOKE_NORMAL( "smoke" ), ++ SMOKE_LARGE( "largesmoke" ), ++ SPELL( "spell" ), ++ SPELL_INSTANT( "instantSpell" ), ++ SPELL_MOB( "mobSpell" ), ++ SPELL_MOB_AMBIENT( "mobSpellAmbient" ), ++ SPELL_WITCH( "witchMagic" ), ++ DRIP_WATER( "dripWater" ), ++ DRIP_LAVA( "dripLava" ), ++ VILLAGER_ANGRY( "angryVillager" ), ++ VILLAGER_HAPPY( "happyVillager" ), ++ TOWN_AURA( "townaura" ), ++ NOTE( "note" ), ++ PORTAL( "portal" ), ++ ENCHANTMENT_TABLE( "enchantmenttable" ), ++ FLAME( "flame" ), ++ LAVA( "lava" ), ++ FOOTSTEP( "footstep" ), ++ CLOUD( "cloud" ), ++ REDSTONE( "reddust" ), ++ SNOWBALL( "snowballpoof" ), ++ SNOW_SHOVEL( "snowshovel" ), ++ SLIME( "slime" ), ++ HEART( "heart" ), ++ BARRIER( "barrier" ), ++ ICON_CRACK( "iconcrack", 1 ), ++ BLOCK_CRACK( "blockcrack", 1 ), ++ BLOCK_DUST( "blockdust", 2 ), ++ WATER_DROP( "droplet" ), ++ ITEM_TAKE( "take" ); ++ ++ public final String name; ++ public final int extra; ++ private final static HashMap particleMap = new HashMap(); ++ ++ Particle(String name) ++ { ++ this( name, 0 ); ++ } ++ ++ Particle(String name, int extra) ++ { ++ this.name = name; ++ this.extra = extra; ++ } ++ ++ public static Particle find(String part) ++ { ++ return particleMap.get( part ); ++ } ++ ++ static ++ { ++ for ( Particle particle : values() ) ++ { ++ particleMap.put( particle.name, particle ); ++ } ++ } ++ } ++ // Spigot end + } +diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +index f5afcb7..07b9d35 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/PlayerChunk.java +@@ -85,7 +85,7 @@ class PlayerChunk { + Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); + + if (chunk.isReady()) { +- entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0)); ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0, entityplayer.playerConnection.networkManager.getVersion())); // Spigot - protocol patch + } + + this.players.remove(entityplayer); // CraftBukkit +@@ -164,8 +164,21 @@ class PlayerChunk { + if (this.dirtyCount == 64) { + i = this.location.x * 16; + j = this.location.z * 16; +- this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged ++ // Spigot start - protocol patch ++ //this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged + ++ Chunk chunk = PlayerChunkMap.a( this.playerChunkMap ).getChunkAt( this.location.x, this.location.z ); ++ for (int idx = 0; idx < this.b.size(); ++idx) { ++ EntityPlayer entityplayer = (EntityPlayer) this.b.get(idx); ++ ++ if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) { ++ entityplayer.playerConnection.sendPacket( ++ new PacketPlayOutMapChunk( chunk, (this.f == 0xFFFF), this.f, entityplayer.playerConnection.networkManager.getVersion()) ++ ); ++ } ++ } ++ ++ // Spigot end - protocol patch + for (k = 0; k < 16; ++k) { + if ((this.f & 1 << k) != 0) { + l = k << 4; +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 188393c..10faa8c 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -747,6 +747,36 @@ public class PlayerConnection implements PacketPlayInListener { + } + + public void sendPacket(Packet packet) { ++ // Spigot start - protocol patch ++ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 ) ++ { ++ if ( packet instanceof PacketPlayOutWindowItems ) ++ { ++ PacketPlayOutWindowItems items = (PacketPlayOutWindowItems) packet; ++ if ( player.activeContainer instanceof ContainerEnchantTable ++ && player.activeContainer.windowId == items.a ) ++ { ++ ItemStack[] old = items.b; ++ items.b = new ItemStack[ old.length + 1 ]; ++ items.b[ 0 ] = old[ 0 ]; ++ System.arraycopy( old, 1, items.b, 2, old.length - 1 ); ++ items.b[ 1 ] = new ItemStack( Items.INK_SACK, 3, 4 ); ++ ++ } ++ } else if ( packet instanceof PacketPlayOutSetSlot ) ++ { ++ PacketPlayOutSetSlot items = (PacketPlayOutSetSlot) packet; ++ if ( player.activeContainer instanceof ContainerEnchantTable ++ && player.activeContainer.windowId == items.a ) ++ { ++ if ( items.b >= 1 ) ++ { ++ items.b++; ++ } ++ } ++ } ++ } ++ // Spigot end + if (packet instanceof PacketPlayOutChat) { + PacketPlayOutChat packetplayoutchat = (PacketPlayOutChat) packet; + EnumChatVisibility enumchatvisibility = this.player.getChatFlags(); +@@ -1108,6 +1138,7 @@ public class PlayerConnection implements PacketPlayInListener { + } + + public void a(PacketPlayInUseEntity packetplayinuseentity) { ++ if ( packetplayinuseentity.c() == null ) return; // Spigot - protocol patch + if (this.player.dead) return; // CraftBukkit + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + Entity entity = packetplayinuseentity.a((World) worldserver); +@@ -1237,6 +1268,21 @@ public class PlayerConnection implements PacketPlayInListener { + } + + InventoryView inventory = this.player.activeContainer.getBukkitView(); ++ // Spigot start - protocol patch ++ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 ) ++ { ++ if ( player.activeContainer instanceof ContainerEnchantTable ) ++ { ++ if ( packetplayinwindowclick.slot == 1 ) ++ { ++ return; ++ } else if ( packetplayinwindowclick.slot > 1 ) ++ { ++ packetplayinwindowclick.slot--; ++ } ++ } ++ } ++ // Spigot end + SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.d()); + + InventoryClickEvent event = null; +@@ -1587,7 +1633,20 @@ public class PlayerConnection implements PacketPlayInListener { + if (entityitem != null) { + entityitem.e(); + } ++ // Spigot start - protocol patch ++ } else ++ { ++ if ( flag1 ) ++ { ++ player.playerConnection.sendPacket( ++ new PacketPlayOutSetSlot( 0, ++ packetplayinsetcreativeslot.c(), ++ player.defaultContainer.getSlot( packetplayinsetcreativeslot.c() ).getItem() ++ ) ++ ); ++ } + } ++ // Spigot end + } + } + +@@ -1721,7 +1780,7 @@ public class PlayerConnection implements PacketPlayInListener { + // CraftBukkit end + + if ("MC|BEdit".equals(packetplayincustompayload.c())) { +- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e())); ++ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch + + try { + itemstack = packetdataserializer.c(); +@@ -1753,7 +1812,7 @@ public class PlayerConnection implements PacketPlayInListener { + + return; + } else if ("MC|BSign".equals(packetplayincustompayload.c())) { +- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e())); ++ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch + + try { + itemstack = packetdataserializer.c(); +diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +index b4461b9..036be30 100644 +--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +@@ -328,6 +328,13 @@ public class PlayerInteractManager { + int j = itemstack.getData(); + ItemStack itemstack1 = itemstack.a(world, entityhuman); + ++ // Spigot start - protocol patch ++ if ( itemstack1 != null && itemstack1.getItem() == Items.WRITTEN_BOOK ) ++ { ++ player.playerConnection.sendPacket( new PacketPlayOutCustomPayload( "MC|BOpen", new byte[0] ) ); ++ } ++ // Spigot end ++ + if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i && itemstack1.n() <= 0 && itemstack1.getData() == j)) { + return false; + } else { +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 75ea5c9..0359cb3 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -284,7 +284,7 @@ public abstract class PlayerList { + // CraftBukkit end + + // CraftBukkit start - sendAll above replaced with this loop +- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, true, 1000); ++ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer( entityplayer ); // Spigot - protocol patch + for (int i = 0; i < this.players.size(); ++i) { + EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); + +@@ -302,7 +302,7 @@ public abstract class PlayerList { + continue; + } + // .name -> .listName +- entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(entityplayer1.listName, true, entityplayer1.ping)); ++ entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch + // CraftBukkit end + } + } +@@ -338,7 +338,7 @@ public abstract class PlayerList { + + // CraftBukkit start - .name -> .listName, replace sendAll with loop + // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), false, 9999)); +- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, false, 9999); ++ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.removePlayer( entityplayer ); // Spigot - protocol patch + for (int i = 0; i < this.players.size(); ++i) { + EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); + +@@ -830,7 +830,7 @@ public abstract class PlayerList { + EntityPlayer player = (EntityPlayer) this.players.get( currentPing ); + if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 ) + { +- Packet packet = new PacketPlayOutPlayerInfo( player.listName, true, player.ping ); ++ Packet packet = PacketPlayOutPlayerInfo.updatePing( player ); // Spigot - protocol patch + for ( EntityPlayer splayer : (List) this.players ) + { + if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) ) +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index e5f73fc..0c4976d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -1,13 +1,16 @@ + package org.bukkit.craftbukkit; + +-import java.io.BufferedReader; + import java.io.File; + import java.io.IOException; +-import java.io.InputStreamReader; ++import java.net.URL; + import java.text.SimpleDateFormat; + import java.util.Arrays; ++import java.util.Calendar; ++import java.util.Date; ++import java.util.Enumeration; + import java.util.List; + import java.util.concurrent.TimeUnit; ++import java.util.jar.Manifest; + import java.util.logging.Level; + import java.util.logging.Logger; + import joptsimple.OptionParser; +@@ -18,7 +21,7 @@ public class Main { + public static boolean useJline = true; + public static boolean useConsole = true; + +- public static void main(String[] args) throws IOException { ++ public static void main(String[] args) throws Exception { + // Spigot Start + File lock = new File( ".update-lock" ); + if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) +@@ -39,6 +42,32 @@ public class Main { + { + } + } ++ ++ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" ++ + "*** It is imperative that backups be taken before running this build on your server! ***\n" ++ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" ++ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); ++ ++ Enumeration resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" ); ++ while ( resources.hasMoreElements() ) ++ { ++ Manifest manifest = new Manifest( resources.nextElement().openStream() ); ++ String ts = manifest.getMainAttributes().getValue( "Timestamp" ); ++ if ( ts != null ) ++ { ++ Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts ); ++ ++ Calendar cal = Calendar.getInstance(); ++ cal.add( Calendar.DAY_OF_YEAR, -2 ); ++ if ( buildDate.before(cal.getTime() ) ) ++ { ++ System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" ); ++ System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" ); ++ System.err.println( "The server will start in 10 seconds!" ); ++ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); ++ } ++ } ++ } + // Spigot End + // Todo: Installation script + OptionParser parser = new OptionParser() { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index e7569c6..35f2bfa 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -203,17 +203,29 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + getHandle().listName = name; + + // Change the name on the client side +- PacketPlayOutPlayerInfo oldpacket = new PacketPlayOutPlayerInfo(oldName, false, 9999); +- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(name, true, getHandle().ping); ++ // Spigot start - protocol patch ++ String temp = getHandle().listName; ++ getHandle().listName = oldName; ++ PacketPlayOutPlayerInfo oldpacket = PacketPlayOutPlayerInfo.removePlayer(getHandle()); ++ getHandle().listName = temp; ++ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer(getHandle()); ++ PacketPlayOutPlayerInfo newPacket = PacketPlayOutPlayerInfo.updateDisplayName(getHandle()); + for (int i = 0; i < server.getHandle().players.size(); ++i) { + EntityPlayer entityplayer = (EntityPlayer) server.getHandle().players.get(i); + if (entityplayer.playerConnection == null) continue; + + if (entityplayer.getBukkitEntity().canSee(this)) { +- entityplayer.playerConnection.sendPacket(oldpacket); +- entityplayer.playerConnection.sendPacket(packet); ++ if (entityplayer.playerConnection.networkManager.getVersion() < 28) ++ { ++ entityplayer.playerConnection.sendPacket( oldpacket ); ++ entityplayer.playerConnection.sendPacket( packet ); ++ } else { ++ entityplayer.playerConnection.sendPacket( newPacket ); ++ } + } + } ++ ++ // Spigot end + } + + @Override +@@ -442,7 +454,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + for (int y = 0; y < 128; ++y) { + bytes[y + 3] = data.buffer[y * 128 + x]; + } +- PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes); ++ PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes, map.getScale().getValue()); // Spigot - protocol patch + getHandle().playerConnection.sendPacket(packet); + } + } +@@ -894,7 +906,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + //remove the hidden player from this player user list +- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), false, 9999)); ++ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.removePlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch + } + + public void showPlayer(Player player) { +@@ -911,7 +923,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + entry.updatePlayer(getHandle()); + } + +- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), true, getHandle().ping)); ++ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch + } + + public void removeDisconnectingPlayer(Player player) { +diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java +index fad22e2..80e538c 100644 +--- a/src/main/java/org/spigotmc/AntiXray.java ++++ b/src/main/java/org/spigotmc/AntiXray.java +@@ -65,7 +65,7 @@ public class AntiXray + if ( world.spigotConfig.antiXray ) + { + obfuscate.startTiming(); +- obfuscate( chunkX, chunkY, bitmask, buffer, world ); ++ obfuscate( chunkX, chunkY, bitmask, buffer, world, false ); + obfuscate.stopTiming(); + } + } +@@ -73,7 +73,7 @@ public class AntiXray + /** + * Removes all non exposed ores from the chunk buffer. + */ +- public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) ++ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, boolean newFormat) + { + // If the world is marked as obfuscated + if ( world.spigotConfig.antiXray ) +@@ -120,11 +120,22 @@ public class AntiXray + if ( index >= buffer.length ) + { + index++; ++ if ( newFormat ) index++; + continue; + } + // Grab the block ID in the buffer. + // TODO: extended IDs are not yet supported +- int blockId = buffer[index] & 0xFF; ++ int blockId; ++ int data = 0; ++ if ( newFormat ) ++ { ++ blockId = (buffer[ index ] & 0xFF) | ( ( buffer[ index + 1 ] & 0xFF ) << 8 ); ++ data = blockId & 0xF; ++ blockId >>>= 4; // Remove data value ++ } else ++ { ++ blockId = buffer[ index ] & 0xFF; ++ } + // Check if the block should be obfuscated + if ( obfuscateBlocks[blockId] ) + { +@@ -132,6 +143,7 @@ public class AntiXray + if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) + { + index++; ++ if ( newFormat ) index++; + continue; + } + // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate +@@ -141,7 +153,15 @@ public class AntiXray + { + case 1: + // Replace with replacement material +- buffer[index] = replaceWithTypeId; ++ if ( newFormat ) ++ { ++ char replace = (char) ((replaceWithTypeId << 4) | data); ++ buffer[ index ] = (byte) ( replace & 0xFF ); ++ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF ); ++ } else ++ { ++ buffer[ index ] = replaceWithTypeId; ++ } + break; + case 2: + // Replace with random ore. +@@ -149,13 +169,23 @@ public class AntiXray + { + randomOre = 0; + } +- buffer[index] = replacementOres[randomOre++]; ++ if ( newFormat ) ++ { ++ char replace = (char) (replacementOres[ randomOre++ ] & 0xFF); ++ replace = (char) ((replace << 4) | data); ++ buffer[ index ] = (byte) ( replace & 0xFF ); ++ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF ); ++ } else ++ { ++ buffer[ index ] = replacementOres[ randomOre++ ]; ++ } + break; + } + } + } + + index++; ++ if (newFormat) index++; + } + } + } +diff --git a/src/main/java/org/spigotmc/ProtocolData.java b/src/main/java/org/spigotmc/ProtocolData.java +new file mode 100644 +index 0000000..ff93cbe +--- /dev/null ++++ b/src/main/java/org/spigotmc/ProtocolData.java +@@ -0,0 +1,190 @@ ++package org.spigotmc; ++ ++public class ProtocolData ++{ ++ public static class ByteShort extends Number ++ { ++ ++ private short value; ++ ++ public ByteShort(short value) ++ { ++ this.value = value; ++ } ++ ++ @Override ++ public int intValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public long longValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public float floatValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public double doubleValue() ++ { ++ return value; ++ } ++ } ++ ++ public static class DualByte extends Number ++ { ++ ++ public byte value; ++ public byte value2; ++ ++ public DualByte(byte value, byte value2) ++ { ++ this.value = value; ++ this.value2 = value2; ++ } ++ ++ @Override ++ public int intValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public long longValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public float floatValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public double doubleValue() ++ { ++ return value; ++ } ++ } ++ ++ public static class HiddenByte extends Number ++ { ++ ++ private byte value; ++ ++ public HiddenByte(byte value) ++ { ++ this.value = value; ++ } ++ ++ @Override ++ public int intValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public long longValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public float floatValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public double doubleValue() ++ { ++ return value; ++ } ++ } ++ public static class IntByte extends Number ++ { ++ ++ public int value; ++ public byte value2; ++ ++ public IntByte(int value, byte value2) ++ { ++ this.value = value; ++ this.value2 = value2; ++ } ++ ++ @Override ++ public byte byteValue() ++ { ++ return value2; ++ } ++ ++ @Override ++ public int intValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public long longValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public float floatValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public double doubleValue() ++ { ++ return value; ++ } ++ } ++ ++ public static class DualInt extends Number ++ { ++ ++ public int value; ++ public int value2; ++ ++ public DualInt(int value, int value2) ++ { ++ this.value = value; ++ this.value2 = value2; ++ } ++ ++ @Override ++ public int intValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public long longValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public float floatValue() ++ { ++ return value; ++ } ++ ++ @Override ++ public double doubleValue() ++ { ++ return value; ++ } ++ } ++} +diff --git a/src/main/java/org/spigotmc/ProtocolInjector.java b/src/main/java/org/spigotmc/ProtocolInjector.java +new file mode 100644 +index 0000000..0e30463 +--- /dev/null ++++ b/src/main/java/org/spigotmc/ProtocolInjector.java +@@ -0,0 +1,129 @@ ++package org.spigotmc; ++ ++import net.minecraft.server.EnumProtocol; ++import net.minecraft.server.Packet; ++import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.server.PacketListener; ++import net.minecraft.util.com.google.common.collect.BiMap; ++ ++import java.io.IOException; ++import java.lang.reflect.Field; ++import java.util.Map; ++ ++public class ProtocolInjector ++{ ++ public static void inject() ++ { ++ try ++ { ++ addPacket( EnumProtocol.LOGIN, true, 0x3, PacketLoginCompression.class ); ++ ++ addPacket( EnumProtocol.PLAY, true, 0x48, PacketPlayResourcePackSend.class ); ++ addPacket( EnumProtocol.PLAY, false, 0x19, PacketPlayResourcePackStatus.class ); ++ } catch ( NoSuchFieldException e ) ++ { ++ e.printStackTrace(); ++ } catch ( IllegalAccessException e ) ++ { ++ e.printStackTrace(); ++ } ++ } ++ ++ private static void addPacket(EnumProtocol protocol, boolean clientbound, int id, Class packet) throws NoSuchFieldException, IllegalAccessException ++ { ++ Field packets; ++ if (!clientbound) { ++ packets = EnumProtocol.class.getDeclaredField( "h" ); ++ } else { ++ packets = EnumProtocol.class.getDeclaredField( "i" ); ++ } ++ packets.setAccessible( true ); ++ BiMap> pMap = (BiMap>) packets.get( protocol ); ++ pMap.put( id, packet ); ++ Field map = EnumProtocol.class.getDeclaredField( "f" ); ++ map.setAccessible( true ); ++ Map, EnumProtocol> protocolMap = (Map, EnumProtocol>) map.get( null ); ++ protocolMap.put( packet, protocol ); ++ } ++ ++ public static class PacketPlayResourcePackStatus extends Packet { ++ ++ @Override ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.c( 255 ); // Hash ++ packetdataserializer.a(); // Result ++ } ++ ++ @Override ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) ++ { ++ ++ } ++ } ++ ++ public static class PacketPlayResourcePackSend extends Packet { ++ ++ private String url; ++ private String hash; ++ ++ public PacketPlayResourcePackSend(String url, String hash) ++ { ++ this.url = url; ++ this.hash = hash; ++ } ++ ++ @Override ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ ++ } ++ ++ @Override ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.a( url ); ++ packetdataserializer.a( hash ); ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) ++ { ++ ++ } ++ } ++ ++ public static class PacketLoginCompression extends Packet { ++ ++ private int threshold; ++ ++ public PacketLoginCompression(int threshold) ++ { ++ this.threshold = threshold; ++ } ++ ++ @Override ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ ++ } ++ ++ @Override ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.b( threshold ); ++ } ++ ++ @Override ++ public void handle(PacketListener packetlistener) ++ { ++ ++ } ++ } ++} +diff --git a/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java b/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java +new file mode 100644 +index 0000000..8479c09 +--- /dev/null ++++ b/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java +@@ -0,0 +1,60 @@ ++package org.spigotmc; ++ ++import com.google.common.base.Charsets; ++import com.google.gson.JsonArray; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonParser; ++ ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.InputStreamReader; ++import java.util.Arrays; ++ ++public class SpigotBlockDebreakifier ++{ ++ ++ private static final boolean[] validBlocks = new boolean[ 198 << 4 ]; ++ private static final int[] correctedValues = new int[ 198 ]; ++ ++ static ++ { ++ Arrays.fill( correctedValues, -1 ); ++ InputStream in = SpigotBlockDebreakifier.class.getResourceAsStream( "/blocks.json" ); ++ try ++ { ++ JsonArray e = new JsonParser().parse( new InputStreamReader( in, Charsets.UTF_8 ) ).getAsJsonArray(); ++ for ( JsonElement entry : e ) ++ { ++ String[] parts = entry.getAsString().split( ":" ); ++ int id = Integer.parseInt( parts[ 0 ] ); ++ int data = Integer.parseInt( parts[ 1 ] ); ++ validBlocks[ ( id << 4 ) | data ] = true; ++ if ( correctedValues[ id ] == -1 || data < correctedValues[ id ] ) ++ { ++ correctedValues[ id ] = data; ++ } ++ } ++ } finally ++ { ++ try ++ { ++ in.close(); ++ } catch ( IOException e ) ++ { ++ throw new RuntimeException( e ); ++ } ++ } ++ } ++ ++ public static int getCorrectedData(int id, int data) ++ { ++ if ( id > 197 ) return data; ++ if ( validBlocks[ ( id << 4 ) | data ] ) ++ { ++ return data; ++ } else ++ { ++ return correctedValues[ id ] & 0xF; ++ } ++ } ++} +diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java +new file mode 100644 +index 0000000..6093d62 +--- /dev/null ++++ b/src/main/java/org/spigotmc/SpigotComponentReverter.java +@@ -0,0 +1,105 @@ ++package org.spigotmc; ++ ++import net.minecraft.server.ChatComponentText; ++import net.minecraft.server.ChatModifier; ++import net.minecraft.server.EnumChatFormat; ++import net.minecraft.server.IChatBaseComponent; ++import org.bukkit.ChatColor; ++ ++import java.util.Iterator; ++import java.util.List; ++ ++public class SpigotComponentReverter ++{ ++ public static String toLegacy(IChatBaseComponent s) ++ { ++ StringBuilder builder = new StringBuilder(); ++ legacy( builder, s ); ++ return builder.toString(); ++ } ++ ++ private static void legacy(StringBuilder builder, IChatBaseComponent s) ++ { ++ ChatModifier modifier = s.getChatModifier(); ++ colorize( builder, modifier ); ++ if ( s instanceof ChatComponentText ) ++ { ++ builder.append( s.e() ); ++ } else { ++ throw new RuntimeException( "Unhandled type: " + s.getClass().getSimpleName() ); ++ } ++ ++ for ( IChatBaseComponent c : getExtra( s ) ) { ++ legacy( builder, c ); ++ } ++ } ++ ++ private static void colorize(StringBuilder builder, ChatModifier modifier) ++ { ++ if ( modifier == null ) return; ++ // Color first ++ EnumChatFormat color = getColor( modifier ); ++ if ( color == null ) ++ { ++ color = EnumChatFormat.BLACK; ++ } ++ builder.append( color.toString() ); ++ ++ if ( isBold( modifier ) ) ++ { ++ builder.append( ChatColor.BOLD ); ++ } ++ if ( isItalic( modifier ) ) ++ { ++ builder.append( ChatColor.ITALIC ); ++ } ++ if ( isRandom( modifier ) ) ++ { ++ builder.append( ChatColor.MAGIC ); ++ } ++ if ( isStrikethrough( modifier ) ) ++ { ++ builder.append( ChatColor.STRIKETHROUGH ); ++ } ++ if ( isUnderline( modifier ) ) ++ { ++ builder.append( ChatColor.UNDERLINE ); ++ } ++ } ++ ++ // Helpers ++ private static List getExtra(IChatBaseComponent c) ++ { ++ return c.a(); ++ } ++ ++ private static EnumChatFormat getColor(ChatModifier c) ++ { ++ return c.a(); ++ } ++ ++ private static boolean isBold(ChatModifier c) ++ { ++ return c.b(); ++ } ++ ++ private static boolean isItalic(ChatModifier c) ++ { ++ return c.c(); ++ } ++ ++ private static boolean isStrikethrough(ChatModifier c) ++ { ++ return c.d(); ++ } ++ ++ private static boolean isUnderline(ChatModifier c) ++ { ++ return c.e(); ++ } ++ ++ private static boolean isRandom(ChatModifier c) ++ { ++ return c.f(); ++ } ++} +diff --git a/src/main/java/org/spigotmc/SpigotCompressor.java b/src/main/java/org/spigotmc/SpigotCompressor.java +new file mode 100644 +index 0000000..2e0857e +--- /dev/null ++++ b/src/main/java/org/spigotmc/SpigotCompressor.java +@@ -0,0 +1,43 @@ ++package org.spigotmc; ++ ++import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.util.io.netty.buffer.ByteBuf; ++import net.minecraft.util.io.netty.channel.ChannelHandlerContext; ++import net.minecraft.util.io.netty.handler.codec.MessageToByteEncoder; ++ ++import java.util.zip.Deflater; ++ ++public class SpigotCompressor extends MessageToByteEncoder ++{ ++ ++ private final byte[] buffer = new byte[8192]; ++ private final Deflater deflater = new Deflater(); ++ ++ @Override ++ protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception ++ { ++ ByteBuf in = (ByteBuf) msg; ++ int origSize = in.readableBytes(); ++ PacketDataSerializer serializer = new PacketDataSerializer( out ); ++ ++ if ( origSize < 256 ) ++ { ++ serializer.b( 0 ); ++ serializer.writeBytes( in ); ++ } else ++ { ++ byte[] data = new byte[ origSize ]; ++ in.readBytes( data ); ++ ++ serializer.b( data.length ); ++ ++ deflater.setInput( data ); ++ deflater.finish(); ++ while (!deflater.finished()) { ++ int count = deflater.deflate( buffer ); ++ serializer.writeBytes( buffer, 0, count ); ++ } ++ deflater.reset(); ++ } ++ } ++} +diff --git a/src/main/java/org/spigotmc/SpigotDecompressor.java b/src/main/java/org/spigotmc/SpigotDecompressor.java +new file mode 100644 +index 0000000..ffebf5d +--- /dev/null ++++ b/src/main/java/org/spigotmc/SpigotDecompressor.java +@@ -0,0 +1,42 @@ ++package org.spigotmc; ++ ++import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.util.io.netty.buffer.ByteBuf; ++import net.minecraft.util.io.netty.buffer.Unpooled; ++import net.minecraft.util.io.netty.channel.ChannelHandlerContext; ++import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder; ++ ++import java.util.List; ++import java.util.zip.Inflater; ++ ++public class SpigotDecompressor extends ByteToMessageDecoder ++{ ++ ++ private final Inflater inflater = new Inflater(); ++ ++ @Override ++ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List objects) throws Exception ++ { ++ if ( byteBuf.readableBytes() == 0 ) ++ { ++ return; ++ } ++ ++ PacketDataSerializer serializer = new PacketDataSerializer( byteBuf ); ++ int size = serializer.a(); ++ if ( size == 0 ) ++ { ++ objects.add( serializer.readBytes( serializer.readableBytes() ) ); ++ } else ++ { ++ byte[] compressedData = new byte[ serializer.readableBytes() ]; ++ serializer.readBytes( compressedData ); ++ inflater.setInput( compressedData ); ++ ++ byte[] data = new byte[ size ]; ++ inflater.inflate( data ); ++ objects.add( Unpooled.wrappedBuffer( data ) ); ++ inflater.reset(); ++ } ++ } ++} +diff --git a/src/main/resources/blocks.json b/src/main/resources/blocks.json +new file mode 100644 +index 0000000..8dd484d +--- /dev/null ++++ b/src/main/resources/blocks.json +@@ -0,0 +1 @@ ++["0:0","1:0","1:1","1:2","1:3","1:4","1:5","1:6","2:0","3:0","3:1","3:2","4:0","5:0","5:1","5:2","5:3","5:4","5:5","6:0","6:1","6:2","6:3","6:4","6:5","6:8","6:9","6:10","6:11","6:12","6:13","7:0","8:0","8:1","8:2","8:3","8:4","8:5","8:6","8:7","8:8","8:9","8:10","8:11","8:12","8:13","8:14","8:15","9:0","9:1","9:2","9:3","9:4","9:5","9:6","9:7","9:8","9:9","9:10","9:11","9:12","9:13","9:14","9:15","10:0","10:1","10:2","10:3","10:4","10:5","10:6","10:7","10:8","10:9","10:10","10:11","10:12","10:13","10:14","10:15","11:0","11:1","11:2","11:3","11:4","11:5","11:6","11:7","11:8","11:9","11:10","11:11","11:12","11:13","11:14","11:15","12:0","12:1","13:0","14:0","15:0","16:0","17:0","17:1","17:2","17:3","17:4","17:5","17:6","17:7","17:8","17:9","17:10","17:11","17:12","17:13","17:14","17:15","18:0","18:1","18:2","18:3","18:4","18:5","18:6","18:7","18:8","18:9","18:10","18:11","18:12","18:13","18:14","18:15","19:0","19:1","20:0","21:0","22:0","23:0","23:1","23:2","23:3","23:4","23:5","23:8","23:9","23:10","23:11","23:12","23:13","24:0","24:1","24:2","25:0","26:0","26:1","26:2","26:3","26:8","26:9","26:10","26:11","26:12","26:13","26:14","26:15","27:0","27:1","27:2","27:3","27:4","27:5","27:8","27:9","27:10","27:11","27:12","27:13","28:0","28:1","28:2","28:3","28:4","28:5","28:8","28:9","28:10","28:11","28:12","28:13","29:0","29:1","29:2","29:3","29:4","29:5","29:8","29:9","29:10","29:11","29:12","29:13","30:0","31:0","31:1","31:2","32:0","33:0","33:1","33:2","33:3","33:4","33:5","33:8","33:9","33:10","33:11","33:12","33:13","34:0","34:1","34:2","34:3","34:4","34:5","34:8","34:9","34:10","34:11","34:12","34:13","35:0","35:1","35:2","35:3","35:4","35:5","35:6","35:7","35:8","35:9","35:10","35:11","35:12","35:13","35:14","35:15","36:0","36:1","36:2","36:3","36:4","36:5","36:8","36:9","36:10","36:11","36:12","36:13","37:0","38:0","38:1","38:2","38:3","38:4","38:5","38:6","38:7","38:8","39:0","40:0","41:0","42:0","43:0","43:1","43:2","43:3","43:4","43:5","43:6","43:7","43:8","43:9","43:10","43:11","43:12","43:13","43:14","43:15","44:0","44:1","44:2","44:3","44:4","44:5","44:6","44:7","44:8","44:9","44:10","44:11","44:12","44:13","44:14","44:15","45:0","46:0","46:1","47:0","48:0","49:0","50:1","50:2","50:3","50:4","50:5","51:0","51:1","51:2","51:3","51:4","51:5","51:6","51:7","51:8","51:9","51:10","51:11","51:12","51:13","51:14","51:15","52:0","53:0","53:1","53:2","53:3","53:4","53:5","53:6","53:7","54:2","54:3","54:4","54:5","55:0","55:1","55:2","55:3","55:4","55:5","55:6","55:7","55:8","55:9","55:10","55:11","55:12","55:13","55:14","55:15","56:0","57:0","58:0","59:0","59:1","59:2","59:3","59:4","59:5","59:6","59:7","60:0","60:1","60:2","60:3","60:4","60:5","60:6","60:7","61:2","61:3","61:4","61:5","62:2","62:3","62:4","62:5","63:0","63:1","63:2","63:3","63:4","63:5","63:6","63:7","63:8","63:9","63:10","63:11","63:12","63:13","63:14","63:15","64:0","64:1","64:2","64:3","64:4","64:5","64:6","64:7","64:8","64:9","64:10","64:11","65:2","65:3","65:4","65:5","66:0","66:1","66:2","66:3","66:4","66:5","66:6","66:7","66:8","66:9","67:0","67:1","67:2","67:3","67:4","67:5","67:6","67:7","68:2","68:3","68:4","68:5","69:0","69:1","69:2","69:3","69:4","69:5","69:6","69:7","69:8","69:9","69:10","69:11","69:12","69:13","69:14","69:15","70:0","70:1","71:0","71:1","71:2","71:3","71:4","71:5","71:6","71:7","71:8","71:9","71:10","71:11","72:0","72:1","73:0","74:0","75:1","75:2","75:3","75:4","75:5","76:1","76:2","76:3","76:4","76:5","77:0","77:1","77:2","77:3","77:4","77:5","77:8","77:9","77:10","77:11","77:12","77:13","78:0","78:1","78:2","78:3","78:4","78:5","78:6","78:7","79:0","80:0","81:0","81:1","81:2","81:3","81:4","81:5","81:6","81:7","81:8","81:9","81:10","81:11","81:12","81:13","81:14","81:15","82:0","83:0","83:1","83:2","83:3","83:4","83:5","83:6","83:7","83:8","83:9","83:10","83:11","83:12","83:13","83:14","83:15","84:0","84:1","85:0","86:0","86:1","86:2","86:3","87:0","88:0","89:0","90:1","90:2","91:0","91:1","91:2","91:3","92:0","92:1","92:2","92:3","92:4","92:5","92:6","93:0","93:1","93:2","93:3","93:4","93:5","93:6","93:7","93:8","93:9","93:10","93:11","93:12","93:13","93:14","93:15","94:0","94:1","94:2","94:3","94:4","94:5","94:6","94:7","94:8","94:9","94:10","94:11","94:12","94:13","94:14","94:15","95:0","95:1","95:2","95:3","95:4","95:5","95:6","95:7","95:8","95:9","95:10","95:11","95:12","95:13","95:14","95:15","96:0","96:1","96:2","96:3","96:4","96:5","96:6","96:7","96:8","96:9","96:10","96:11","96:12","96:13","96:14","96:15","97:0","97:1","97:2","97:3","97:4","97:5","98:0","98:1","98:2","98:3","99:0","99:1","99:2","99:3","99:4","99:5","99:6","99:7","99:8","99:9","99:10","99:14","99:15","100:0","100:1","100:2","100:3","100:4","100:5","100:6","100:7","100:8","100:9","100:10","100:14","100:15","101:0","102:0","103:0","104:0","104:1","104:2","104:3","104:4","104:5","104:6","104:7","105:0","105:1","105:2","105:3","105:4","105:5","105:6","105:7","106:0","106:1","106:2","106:3","106:4","106:5","106:6","106:7","106:8","106:9","106:10","106:11","106:12","106:13","106:14","106:15","107:0","107:1","107:2","107:3","107:4","107:5","107:6","107:7","107:8","107:9","107:10","107:11","107:12","107:13","107:14","107:15","108:0","108:1","108:2","108:3","108:4","108:5","108:6","108:7","109:0","109:1","109:2","109:3","109:4","109:5","109:6","109:7","110:0","111:0","112:0","113:0","114:0","114:1","114:2","114:3","114:4","114:5","114:6","114:7","115:0","115:1","115:2","115:3","116:0","117:0","117:1","117:2","117:3","117:4","117:5","117:6","117:7","118:0","118:1","118:2","118:3","119:0","120:0","120:1","120:2","120:3","120:4","120:5","120:6","120:7","121:0","122:0","123:0","124:0","125:0","125:1","125:2","125:3","125:4","125:5","126:0","126:1","126:2","126:3","126:4","126:5","126:8","126:9","126:10","126:11","126:12","126:13","127:0","127:1","127:2","127:3","127:4","127:5","127:6","127:7","127:8","127:9","127:10","127:11","128:0","128:1","128:2","128:3","128:4","128:5","128:6","128:7","129:0","130:2","130:3","130:4","130:5","131:0","131:1","131:2","131:3","131:4","131:5","131:6","131:7","131:8","131:9","131:10","131:11","131:12","131:13","131:14","131:15","132:0","132:1","132:2","132:3","132:4","132:5","132:6","132:7","132:8","132:9","132:10","132:11","132:12","132:13","132:14","132:15","133:0","134:0","134:1","134:2","134:3","134:4","134:5","134:6","134:7","135:0","135:1","135:2","135:3","135:4","135:5","135:6","135:7","136:0","136:1","136:2","136:3","136:4","136:5","136:6","136:7","137:0","137:1","138:0","139:0","139:1","140:0","140:1","140:2","140:3","140:4","140:5","140:6","140:7","140:8","140:9","140:10","140:11","140:12","140:13","140:14","140:15","141:0","141:1","141:2","141:3","141:4","141:5","141:6","141:7","142:0","142:1","142:2","142:3","142:4","142:5","142:6","142:7","143:0","143:1","143:2","143:3","143:4","143:5","143:8","143:9","143:10","143:11","143:12","143:13","144:0","144:1","144:2","144:3","144:4","144:5","144:8","144:9","144:10","144:11","144:12","144:13","145:0","145:1","145:2","145:3","145:4","145:5","145:6","145:7","145:8","145:9","145:10","145:11","146:2","146:3","146:4","146:5","147:0","147:1","147:2","147:3","147:4","147:5","147:6","147:7","147:8","147:9","147:10","147:11","147:12","147:13","147:14","147:15","148:0","148:1","148:2","148:3","148:4","148:5","148:6","148:7","148:8","148:9","148:10","148:11","148:12","148:13","148:14","148:15","149:0","149:1","149:2","149:3","149:4","149:5","149:6","149:7","149:8","149:9","149:10","149:11","149:12","149:13","149:14","149:15","150:0","150:1","150:2","150:3","150:4","150:5","150:6","150:7","150:8","150:9","150:10","150:11","150:12","150:13","150:14","150:15","151:0","151:1","151:2","151:3","151:4","151:5","151:6","151:7","151:8","151:9","151:10","151:11","151:12","151:13","151:14","151:15","152:0","153:0","154:0","154:2","154:3","154:4","154:5","154:8","154:10","154:11","154:12","154:13","155:0","155:1","155:2","155:3","155:4","156:0","156:1","156:2","156:3","156:4","156:5","156:6","156:7","157:0","157:1","157:2","157:3","157:4","157:5","157:8","157:9","157:10","157:11","157:12","157:13","158:0","158:1","158:2","158:3","158:4","158:5","158:8","158:9","158:10","158:11","158:12","158:13","159:0","159:1","159:2","159:3","159:4","159:5","159:6","159:7","159:8","159:9","159:10","159:11","159:12","159:13","159:14","159:15","160:0","160:1","160:2","160:3","160:4","160:5","160:6","160:7","160:8","160:9","160:10","160:11","160:12","160:13","160:14","160:15","161:0","161:1","161:4","161:5","161:8","161:9","161:12","161:13","162:0","162:1","162:4","162:5","162:8","162:9","162:12","162:13","163:0","163:1","163:2","163:3","163:4","163:5","163:6","163:7","164:0","164:1","164:2","164:3","164:4","164:5","164:6","164:7","165:0","166:0","167:0","167:1","167:2","167:3","167:4","167:5","167:6","167:7","167:8","167:9","167:10","167:11","167:12","167:13","167:14","167:15","168:0","168:1","168:2","169:0","170:0","170:4","170:8","171:0","171:1","171:2","171:3","171:4","171:5","171:6","171:7","171:8","171:9","171:10","171:11","171:12","171:13","171:14","171:15","172:0","173:0","174:0","175:0","175:1","175:2","175:3","175:4","175:5","175:8","176:0","176:1","176:2","176:3","176:4","176:5","176:6","176:7","176:8","176:9","176:10","176:11","176:12","176:13","176:14","176:15","177:2","177:3","177:4","177:5","178:0","178:1","178:2","178:3","178:4","178:5","178:6","178:7","178:8","178:9","178:10","178:11","178:12","178:13","178:14","178:15","179:0","179:1","179:2","180:0","180:1","180:2","180:3","180:4","180:5","180:6","180:7","181:0","181:8","182:0","182:8","183:0","183:1","183:2","183:3","183:4","183:5","183:6","183:7","183:8","183:9","183:10","183:11","183:12","183:13","183:14","183:15","184:0","184:1","184:2","184:3","184:4","184:5","184:6","184:7","184:8","184:9","184:10","184:11","184:12","184:13","184:14","184:15","185:0","185:1","185:2","185:3","185:4","185:5","185:6","185:7","185:8","185:9","185:10","185:11","185:12","185:13","185:14","185:15","186:0","186:1","186:2","186:3","186:4","186:5","186:6","186:7","186:8","186:9","186:10","186:11","186:12","186:13","186:14","186:15","187:0","187:1","187:2","187:3","187:4","187:5","187:6","187:7","187:8","187:9","187:10","187:11","187:12","187:13","187:14","187:15","188:0","189:0","190:0","191:0","192:0","193:0","193:1","193:2","193:3","193:4","193:5","193:6","193:7","193:8","193:9","193:10","193:11","194:0","194:1","194:2","194:3","194:4","194:5","194:6","194:7","194:8","194:9","194:10","194:11","195:0","195:1","195:2","195:3","195:4","195:5","195:6","195:7","195:8","195:9","195:10","195:11","196:0","196:1","196:2","196:3","196:4","196:5","196:6","196:7","196:8","196:9","196:10","196:11","197:0","197:1","197:2","197:3","197:4","197:5","197:6","197:7","197:8","197:9","197:10","197:11"] +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch b/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch index fb9c667710..f144ef97fb 100644 --- a/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch +++ b/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch @@ -1,4 +1,4 @@ -From 18e6a6b6a2d1234d946d8ffaa2e7b00b8d40b551 Mon Sep 17 00:00:00 2001 +From a53609af81b9c93f55ae5cf419f392c92f9f0333 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 17 May 2014 02:12:39 -0500 Subject: [PATCH] Teleport passenger/vehicle with player @@ -43,10 +43,10 @@ index dea5e19..5dc7e95 100644 if (j == 1 && i == 1) { ChunkCoordinates chunkcoordinates = worldserver1.getSpawn(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e7569c6..770f1d1 100644 +index 35f2bfa..7026f83 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -479,6 +479,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -491,6 +491,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // If this player is riding another entity, we must dismount before teleporting. entity.mount(null); @@ -73,7 +73,7 @@ index e7569c6..770f1d1 100644 // Update the From Location from = event.getFrom(); // Grab the new To Location dependent on whether the event was cancelled. -@@ -498,6 +518,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -510,6 +530,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } else { server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true); } diff --git a/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch b/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch index c655bf8d06..c98b3ca5a2 100644 --- a/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch +++ b/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch @@ -1,14 +1,14 @@ -From f1e2e7c6fc2053e68ea7903d20fef3e6ab342e68 Mon Sep 17 00:00:00 2001 +From 3e2e1768b7a5673c56438b14adff27392fa82f1c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 5 Aug 2014 16:21:03 -0500 Subject: [PATCH] Configurable damage multiplier for PvP blocking diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index f3e4328..c0355bc 100644 +index 5bb7295..a0e4855 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -824,7 +824,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -826,7 +826,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen // CraftBukkit end if (!this.isInvulnerable()) { if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { diff --git a/Spigot-Server-Patches/0020-Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/0020-Allow-nerfed-mobs-to-jump.patch index a1d694c16d..a61d960db9 100644 --- a/Spigot-Server-Patches/0020-Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/0020-Allow-nerfed-mobs-to-jump.patch @@ -1,14 +1,14 @@ -From 83a26547cdc879226ad2e8c996ce54e21b56b040 Mon Sep 17 00:00:00 2001 +From 0bc7b3848e091aca58db8afe01c02943ca3bd8c0 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 29 Jun 2014 13:32:36 -0500 Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index f6c4788..2915f4a 100644 +index 617f7d4..963b6e9 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -403,6 +403,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -407,6 +407,12 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) { diff --git a/Spigot-Server-Patches/0022-Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/0022-Player-Exhaustion-Multipliers.patch index 8f4271a606..aa5e7b1708 100644 --- a/Spigot-Server-Patches/0022-Player-Exhaustion-Multipliers.patch +++ b/Spigot-Server-Patches/0022-Player-Exhaustion-Multipliers.patch @@ -1,4 +1,4 @@ -From b602c24185643022a5ccdb755ebd3667b467d1ec Mon Sep 17 00:00:00 2001 +From 413a2db4e6968e7c3f618f7abdc6aa7c6641340b Mon Sep 17 00:00:00 2001 From: gsand Date: Sun, 17 Aug 2014 16:40:54 -0500 Subject: [PATCH] Player Exhaustion Multipliers @@ -18,10 +18,10 @@ index 0893a6f..24e84d6 100644 ItemStack itemstack = this.j(l); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0054f18..22776ad 100644 +index a0e4855..35b5cfb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1304,13 +1304,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -1314,13 +1314,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); if (i > 0) { this.a(StatisticList.m, i); diff --git a/Spigot-Server-Patches/0023-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0023-Add-configurable-despawn-distances-for-living-entiti.patch index ff532f4130..dceb87368e 100644 --- a/Spigot-Server-Patches/0023-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/0023-Add-configurable-despawn-distances-for-living-entiti.patch @@ -1,14 +1,14 @@ -From f6eb14ae1bb9955b7f74c46cecb138c78b49cd3f Mon Sep 17 00:00:00 2001 +From e9a962e921cbf95753c1e4297a8b40dc53557a6b Mon Sep 17 00:00:00 2001 From: Suddenly Date: Mon, 7 Jul 2014 04:11:34 +0100 Subject: [PATCH] Add configurable despawn distances for living entities diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 2915f4a..d0f7033 100644 +index 963b6e9..ab2c4c8 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -382,13 +382,13 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -386,13 +386,13 @@ public abstract class EntityInsentient extends EntityLiving { double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; diff --git a/Spigot-Server-Patches/0030-Player-affects-spawning-API.patch b/Spigot-Server-Patches/0030-Player-affects-spawning-API.patch index e90469e9d8..a75a1632b5 100644 --- a/Spigot-Server-Patches/0030-Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/0030-Player-affects-spawning-API.patch @@ -1,14 +1,14 @@ -From 328d91df5c7c81402790341523d4a4dbe17e46e9 Mon Sep 17 00:00:00 2001 +From 94cf09556e71988186d6621fbc206075452d59b7 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Fri, 8 Aug 2014 22:51:26 -0500 Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 22776ad..67745b1 100644 +index 35b5cfb..114f406 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -41,6 +41,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -42,6 +42,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public boolean sleeping; // protected -> public public boolean fauxSleeping; public String spawnWorld = ""; @@ -17,10 +17,10 @@ index 22776ad..67745b1 100644 @Override public CraftHumanEntity getBukkitEntity() { diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index d0f7033..99664db 100644 +index ab2c4c8..f133a24 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -374,7 +374,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -378,7 +378,7 @@ public abstract class EntityInsentient extends EntityLiving { if (this.persistent) { this.aU = 0; } else { @@ -106,10 +106,10 @@ index 717be3b..33c228b 100644 for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman = (EntityHuman) this.players.get(i); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 770f1d1..542508c 100644 +index 7026f83..873f3be 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1420,6 +1420,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1432,6 +1432,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return java.util.Collections.unmodifiableSet( ret ); } diff --git a/Spigot-Server-Patches/0031-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch b/Spigot-Server-Patches/0031-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch index 02b36e5be2..89fcde26fa 100644 --- a/Spigot-Server-Patches/0031-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch +++ b/Spigot-Server-Patches/0031-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch @@ -1,4 +1,4 @@ -From 5c5e8954b5e7d29be492b59ddbdc182739df6133 Mon Sep 17 00:00:00 2001 +From f37e6f3216b169882a186764475131f3af1481ab Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 19 Aug 2014 14:21:37 -0500 Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and @@ -6,10 +6,10 @@ Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b905c6e..ef695c2 100644 +index 8c3950a..fa10ea1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -987,7 +987,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -988,7 +988,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } public String getServerModName() {