From fc2609dbbe82a8ef4027ba492fce2cd7f6383c31 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 13:52:34 +1100 Subject: [PATCH] SPIGOT-1540: Treat clicking on player model with ItemStack as none. --- nms-patches/PlayerConnection.patch | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 94b73e6223..c00bc0ccb6 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -402,11 +402,11 @@ + f = to.getYaw(); + f1 = to.getPitch(); + } - -- this.teleportPos = new Vec3D(d0 + d3, d1 + d4, d2 + d5); ++ + this.internalTeleport(d0, d1, d2, f, f1, set); + } -+ + +- this.teleportPos = new Vec3D(d0 + d3, d1 + d4, d2 + d5); + public void teleport(Location dest) { + internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet()); + } @@ -1121,7 +1121,7 @@ ArrayList arraylist = Lists.newArrayList(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -851,8 +1535,273 @@ +@@ -851,8 +1535,275 @@ this.player.a(this.player.activeContainer, (List) arraylist); } else { @@ -1153,6 +1153,8 @@ + if (player.inventory.getCarried() != null) { + action = packetplayinwindowclick.c() == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR; + } ++ } else if (packetplayinwindowclick.b() < 0) { ++ action = InventoryAction.NOTHING; + } else { + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.b()); + if (slot != null) { @@ -1396,7 +1398,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -915,8 +1864,48 @@ +@@ -915,8 +1866,48 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1446,7 +1448,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) { -@@ -940,6 +1929,7 @@ +@@ -940,6 +1931,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1454,7 +1456,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -950,6 +1940,7 @@ +@@ -950,6 +1942,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1462,7 +1464,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -966,14 +1957,30 @@ +@@ -966,14 +1959,30 @@ if (!tileentitysign.b() || tileentitysign.c() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1494,7 +1496,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -996,11 +2003,27 @@ +@@ -996,11 +2005,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1523,7 +1525,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1334,12 +2357,34 @@ +@@ -1334,12 +2359,34 @@ packetdataserializer.release(); } }