diff options
Diffstat (limited to 'nms-patches/PlayerConnection.patch')
-rw-r--r-- | nms-patches/PlayerConnection.patch | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index e67b4538..0f7ec312 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -219,7 +219,17 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -231,6 +367,62 @@ +@@ -223,14 +359,72 @@ + } + + entity.setLocation(d3, d4, d5, f, f1); ++ player.setLocation(d3, d4, d5, f, f1); // CraftBukkit + boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty(); + + if (flag && (flag1 || !flag2)) { + entity.setLocation(d0, d1, d2, f, f1); ++ player.setLocation(d0, d1, d2, f, f1); // CraftBukkit + this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; } @@ -282,7 +292,7 @@ this.minecraftServer.getPlayerList().d(this.player); this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2); this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.c(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -244,7 +436,7 @@ +@@ -244,7 +438,7 @@ public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.x()); @@ -291,7 +301,7 @@ this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); if (this.player.L()) { this.o = this.teleportPos.x; -@@ -289,7 +481,7 @@ +@@ -289,7 +483,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -300,7 +310,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -299,13 +491,21 @@ +@@ -299,13 +493,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -323,7 +333,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -330,15 +530,33 @@ +@@ -330,15 +532,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -359,7 +369,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -384,6 +602,69 @@ +@@ -384,6 +604,69 @@ } } @@ -429,7 +439,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cP() && !worldserver.c(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -401,10 +682,76 @@ +@@ -401,10 +684,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -507,7 +517,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; -@@ -421,6 +768,14 @@ +@@ -421,6 +770,14 @@ f3 = f1 + this.player.pitch; } @@ -522,7 +532,7 @@ if (++this.teleportAwait == Integer.MAX_VALUE) { this.teleportAwait = 0; } -@@ -432,6 +787,7 @@ +@@ -432,6 +789,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); @@ -530,7 +540,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); -@@ -441,7 +797,15 @@ +@@ -441,7 +799,15 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -547,7 +557,7 @@ this.player.a(EnumHand.MAIN_HAND, itemstack); } -@@ -449,6 +813,21 @@ +@@ -449,6 +815,21 @@ case DROP_ITEM: if (!this.player.isSpectator()) { @@ -569,7 +579,7 @@ this.player.a(false); } -@@ -482,7 +861,15 @@ +@@ -482,7 +863,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -585,7 +595,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -502,10 +889,12 @@ +@@ -502,10 +891,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -598,7 +608,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); -@@ -519,6 +908,13 @@ +@@ -519,6 +910,13 @@ chatmessage.getChatModifier().setColor(EnumChatFormat.RED); this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, 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)) { @@ -612,7 +622,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f()); } -@@ -528,13 +924,52 @@ +@@ -528,13 +926,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); @@ -666,7 +676,7 @@ } } -@@ -545,8 +980,8 @@ +@@ -545,8 +982,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -677,7 +687,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -559,6 +994,8 @@ +@@ -559,6 +996,8 @@ if (entity != null) { this.player.setSpectatorTarget(this.player); this.player.stopRiding(); @@ -686,7 +696,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -584,12 +1021,20 @@ +@@ -584,12 +1023,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -708,7 +718,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -602,14 +1047,29 @@ +@@ -602,14 +1049,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -739,7 +749,7 @@ if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -631,6 +1091,15 @@ +@@ -631,6 +1093,15 @@ } } @@ -755,7 +765,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -652,17 +1121,37 @@ +@@ -652,17 +1123,37 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -795,7 +805,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -675,39 +1164,249 @@ +@@ -675,39 +1166,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1052,7 +1062,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -779,6 +1478,7 @@ +@@ -779,6 +1480,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1060,7 +1070,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -794,20 +1494,68 @@ +@@ -794,20 +1496,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1130,7 +1140,7 @@ } } } -@@ -823,7 +1571,8 @@ +@@ -823,7 +1573,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1140,7 +1150,7 @@ CriterionTriggers.u.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { -@@ -846,14 +1595,20 @@ +@@ -846,14 +1597,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1163,7 +1173,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { -@@ -862,8 +1617,274 @@ +@@ -862,8 +1619,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1439,7 +1449,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -900,6 +1921,7 @@ +@@ -900,6 +1923,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1447,7 +1457,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.b()); -@@ -933,7 +1955,45 @@ +@@ -933,7 +1957,45 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1494,7 +1504,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -957,6 +2017,7 @@ +@@ -957,6 +2019,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1502,7 +1512,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()) { -@@ -967,6 +2028,7 @@ +@@ -967,6 +2030,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1510,7 +1520,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -983,14 +2045,30 @@ +@@ -983,14 +2047,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1542,7 +1552,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -999,6 +2077,7 @@ +@@ -999,6 +2079,7 @@ } public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1550,7 +1560,7 @@ if (this.g && packetplayinkeepalive.a() == this.h) { int i = (int) (this.d() - this.f); -@@ -1016,11 +2095,27 @@ +@@ -1016,11 +2097,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1579,7 +1589,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1046,6 +2141,13 @@ +@@ -1046,6 +2143,13 @@ ItemStack itemstack1; if ("MC|BEdit".equals(s)) { @@ -1593,7 +1603,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1065,14 +2167,23 @@ +@@ -1065,14 +2169,23 @@ if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); @@ -1617,7 +1627,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1106,10 +2217,11 @@ +@@ -1106,10 +2219,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1630,7 +1640,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1121,6 +2233,7 @@ +@@ -1121,6 +2235,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1638,7 +1648,7 @@ } } else { TileEntity tileentity; -@@ -1170,6 +2283,7 @@ +@@ -1170,6 +2285,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1646,7 +1656,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1237,6 +2351,7 @@ +@@ -1237,6 +2353,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1654,7 +1664,7 @@ } } else { int k; -@@ -1260,6 +2375,7 @@ +@@ -1260,6 +2377,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1662,7 +1672,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1346,6 +2462,7 @@ +@@ -1346,6 +2464,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1670,7 +1680,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1358,11 +2475,49 @@ +@@ -1358,11 +2477,49 @@ this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); |