mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 14:06:17 +01:00
2641c02193
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 69fa4695 Add some missing deprecation annotations f850da2e Update Maven plugins/versions 8d8400db Use regular compiler seeing as ECJ doesn't support Java 21 JRE c29e1688 Revert "BUILDTOOLS-676: Downgrade Maven compiler version" 07bce714 SPIGOT-7355: More field renames and fixes 6a8ea764 Fix bad merge in penultimate commit 50a7920c Fix imports in previous commit 83640dd1 PR-995: Add required feature to MinecraftExperimental for easy lookups fc1f96cf BUILDTOOLS-676: Downgrade Maven compiler version CraftBukkit Changes: 90f1059ba Fix item placement 661afb43c SPIGOT-7633: Clearer error message for missing particle data 807b465b3 SPIGOT-7634: Armadillo updates infrequently 590cf09a8 Fix unit tests always seeing Mojang server as unavailable 7c7ac5eb2 SPIGOT-7636: Fix clearing ItemMeta 4a72905cf SPIGOT-7635: Fix Player#transfer and cookie methods ebb50e136 Fix incorrect Vault implementation b33fed8b7 Update Maven plugins/versions 6f00f0608 SPIGOT-7632: Control middle clicking chest does not copy contents db821f405 Use regular compiler seeing as ECJ doesn't support Java 21 JRE 8a2976737 Revert "BUILDTOOLS-676: Downgrade Maven compiler version" 0297f87bb SPIGOT-7355: More field renames and fixes 2d03bdf6a SPIGOT-7629: Fix loading banner patterns e77951fac Fix equality of deserialized display names c66f3e4fd SPIGOT-7631: Fix deserialisation of BlockStateMeta 9c2c7be8d SPIGOT-7630: Fix crash saving unticked leashed entities 8c1e7c841 PR-1384: Disable certain PlayerProfile tests, if Mojang's services or internet are not available ced93d572 SPIGOT-7626: sendSignChange() has no effect c77362cae SPIGOT-7625: ItemStack with lore cannot be serialized in 1.20.5 ff2004387 SPIGOT-7620: Fix server crash when hoppers transfer items to double chests 8b4abeb03 BUILDTOOLS-676: Downgrade Maven compiler version
87 lines
6.0 KiB
Diff
87 lines
6.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 17 May 2020 23:47:33 -0700
|
|
Subject: [PATCH] Fix for large move vectors crashing server
|
|
|
|
Check movement distance also based on current position.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 6d47fb4c90d506c72d111f66ee2c46ee74265a37..132f28f5fdb08357f70270f0b4453597387c86ea 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -492,9 +492,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
float prevYaw = this.player.getYRot();
|
|
float prevPitch = this.player.getXRot();
|
|
// CraftBukkit end
|
|
- double d0 = entity.getX();
|
|
- double d1 = entity.getY();
|
|
- double d2 = entity.getZ();
|
|
+ double d0 = entity.getX();final double fromX = d0; // Paper - OBFHELPER
|
|
+ double d1 = entity.getY();final double fromY = d1; // Paper - OBFHELPER
|
|
+ double d2 = entity.getZ();final double fromZ = d2; // Paper - OBFHELPER
|
|
double d3 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX()); final double toX = d3; // Paper - OBFHELPER
|
|
double d4 = ServerGamePacketListenerImpl.clampVertical(packet.getY()); final double toY = d4; // Paper - OBFHELPER
|
|
double d5 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ()); final double toZ = d5; // Paper - OBFHELPER
|
|
@@ -504,7 +504,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
double d7 = d4 - this.vehicleFirstGoodY;
|
|
double d8 = d5 - this.vehicleFirstGoodZ;
|
|
double d9 = entity.getDeltaMovement().lengthSqr();
|
|
- double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
|
+ // Paper start - fix large move vectors killing the server
|
|
+ double currDeltaX = toX - fromX;
|
|
+ double currDeltaY = toY - fromY;
|
|
+ double currDeltaZ = toZ - fromZ;
|
|
+ double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
|
|
+ double otherFieldX = d3 - this.vehicleLastGoodX;
|
|
+ double otherFieldY = d4 - this.vehicleLastGoodY - 1.0E-6D;
|
|
+ double otherFieldZ = d5 - this.vehicleLastGoodZ;
|
|
+ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
|
|
+ // Paper end - fix large move vectors killing the server
|
|
|
|
// CraftBukkit start - handle custom speeds and skipped ticks
|
|
this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
|
|
@@ -550,9 +559,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
|
|
boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D));
|
|
|
|
- d6 = d3 - this.vehicleLastGoodX;
|
|
- d7 = d4 - this.vehicleLastGoodY - 1.0E-6D;
|
|
- d8 = d5 - this.vehicleLastGoodZ;
|
|
+ d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above
|
|
+ d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above
|
|
+ d8 = d5 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above
|
|
boolean flag1 = entity.verticalCollisionBelow;
|
|
|
|
if (entity instanceof LivingEntity) {
|
|
@@ -1259,7 +1268,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
double d7 = d1 - this.firstGoodY;
|
|
double d8 = d2 - this.firstGoodZ;
|
|
double d9 = this.player.getDeltaMovement().lengthSqr();
|
|
- double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
|
+ // Paper start - fix large move vectors killing the server
|
|
+ double currDeltaX = toX - prevX;
|
|
+ double currDeltaY = toY - prevY;
|
|
+ double currDeltaZ = toZ - prevZ;
|
|
+ double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
|
|
+ double otherFieldX = d0 - this.lastGoodX;
|
|
+ double otherFieldY = d1 - this.lastGoodY;
|
|
+ double otherFieldZ = d2 - this.lastGoodZ;
|
|
+ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
|
|
+ // Paper end - fix large move vectors killing the server
|
|
|
|
if (this.player.isSleeping()) {
|
|
if (d10 > 1.0D) {
|
|
@@ -1315,9 +1333,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
|
|
AABB axisalignedbb = this.player.getBoundingBox();
|
|
|
|
- d6 = d0 - this.lastGoodX;
|
|
- d7 = d1 - this.lastGoodY;
|
|
- d8 = d2 - this.lastGoodZ;
|
|
+ d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
|
|
+ d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
|
|
+ d8 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above
|
|
boolean flag1 = d7 > 0.0D;
|
|
|
|
if (this.player.onGround() && !packet.isOnGround() && flag1) {
|