diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 9e4c4cbb48..7e42902e28 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -495,7 +495,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -669,10 +971,76 @@ +@@ -669,10 +971,60 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -521,22 +521,6 @@ + double z = d2; + float yaw = f; + float pitch = f1; -+ if (set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X)) { -+ x += from.getX(); -+ } -+ if (set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y)) { -+ y += from.getY(); -+ } -+ if (set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z)) { -+ z += from.getZ(); -+ } -+ if (set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y_ROT)) { -+ yaw += from.getYaw(); -+ } -+ if (set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X_ROT)) { -+ pitch += from.getPitch(); -+ } -+ + + Location to = new Location(this.getPlayer().getWorld(), x, y, z, yaw, pitch); + PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause); @@ -573,7 +557,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; -@@ -684,6 +1052,14 @@ +@@ -684,6 +1036,14 @@ this.teleportAwait = 0; } @@ -588,7 +572,7 @@ this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); -@@ -691,6 +1067,7 @@ +@@ -691,6 +1051,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); @@ -596,7 +580,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.b(); -@@ -700,13 +1077,45 @@ +@@ -700,13 +1061,45 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -644,7 +628,7 @@ this.player.a(false); } -@@ -737,7 +1146,15 @@ +@@ -737,7 +1130,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c()); } else { @@ -660,7 +644,7 @@ } } else { if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -756,10 +1173,12 @@ +@@ -756,10 +1157,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -673,7 +657,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.d(); ItemStack itemstack = this.player.b(enumhand); -@@ -772,6 +1191,13 @@ +@@ -772,6 +1175,13 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO)); } else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { @@ -687,7 +671,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g()); } -@@ -781,13 +1207,52 @@ +@@ -781,13 +1191,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); @@ -741,7 +725,7 @@ } } -@@ -807,13 +1272,18 @@ +@@ -807,13 +1256,18 @@ } if (entity != null) { @@ -762,7 +746,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer()); -@@ -826,11 +1296,26 @@ +@@ -826,11 +1280,26 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -790,7 +774,7 @@ if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -856,6 +1341,15 @@ +@@ -856,6 +1325,15 @@ } } @@ -806,7 +790,7 @@ try { this.networkManager.sendPacket(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -871,17 +1365,37 @@ +@@ -871,17 +1349,37 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); @@ -846,7 +830,7 @@ this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED))); } else { this.player.resetIdleTimer(); -@@ -891,39 +1405,255 @@ +@@ -891,39 +1389,255 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1109,7 +1093,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -986,6 +1716,7 @@ +@@ -986,6 +1700,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); @@ -1117,7 +1101,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -1001,20 +1732,74 @@ +@@ -1001,20 +1716,74 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1193,7 +1177,7 @@ } } } -@@ -1030,7 +1815,8 @@ +@@ -1030,7 +1799,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1203,7 +1187,7 @@ CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -1052,14 +1838,20 @@ +@@ -1052,14 +1822,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); @@ -1226,7 +1210,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { -@@ -1068,8 +1860,274 @@ +@@ -1068,8 +1844,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1238,7 +1222,7 @@ + + InventoryView inventory = this.player.activeContainer.getBukkitView(); + SlotType type = inventory.getSlotType(packetplayinwindowclick.c()); - ++ + InventoryClickEvent event; + ClickType click = ClickType.UNKNOWN; + InventoryAction action = InventoryAction.UNKNOWN; @@ -1435,7 +1419,7 @@ + if (this.player.activeContainer != oldContainer) { + return; + } -+ + + switch (event.getResult()) { + case ALLOW: + case DEFAULT: @@ -1502,7 +1486,7 @@ if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true)); this.player.f = true; -@@ -1112,6 +2170,7 @@ +@@ -1112,6 +2154,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); @@ -1510,7 +1494,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.c()); -@@ -1143,6 +2202,43 @@ +@@ -1143,6 +2186,43 @@ boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1554,7 +1538,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1166,6 +2262,7 @@ +@@ -1166,6 +2246,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer()); @@ -1562,7 +1546,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -1176,6 +2273,7 @@ +@@ -1176,6 +2257,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer()); @@ -1570,7 +1554,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.b(); -@@ -1192,14 +2290,30 @@ +@@ -1192,14 +2274,30 @@ if (!tileentitysign.d() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign"); @@ -1602,7 +1586,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1208,6 +2322,7 @@ +@@ -1208,6 +2306,7 @@ } public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1610,7 +1594,7 @@ if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); -@@ -1221,7 +2336,17 @@ +@@ -1221,7 +2320,17 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); @@ -1629,7 +1613,7 @@ } public void a(PacketPlayInSettings packetplayinsettings) { -@@ -1229,5 +2354,47 @@ +@@ -1229,5 +2338,47 @@ this.player.a(packetplayinsettings); }