From ef2b574c6ad58a5105e64b4e6204ef6a5369efc5 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 8 Aug 2023 13:00:17 +1000 Subject: [PATCH] Clone location in PlayerFailMoveEvent getters --- patches/api/0423-Add-PlayerFailMoveEvent.patch | 6 +++--- .../0994-Implement-PlayerFailMoveEvent.patch | 14 +++++++------- ...y-erase-allay-memory-on-non-item-targets.patch} | 0 ...0996-API-for-updating-recipes-on-clients.patch} | 0 ... => 0997-Only-capture-actual-tree-growth.patch} | 0 5 files changed, 10 insertions(+), 10 deletions(-) rename patches/server/{0994-Only-erase-allay-memory-on-non-item-targets.patch => 0995-Only-erase-allay-memory-on-non-item-targets.patch} (100%) rename patches/server/{0995-API-for-updating-recipes-on-clients.patch => 0996-API-for-updating-recipes-on-clients.patch} (100%) rename patches/server/{0996-Only-capture-actual-tree-growth.patch => 0997-Only-capture-actual-tree-growth.patch} (100%) diff --git a/patches/api/0423-Add-PlayerFailMoveEvent.patch b/patches/api/0423-Add-PlayerFailMoveEvent.patch index cc555c1074..62ca61644a 100644 --- a/patches/api/0423-Add-PlayerFailMoveEvent.patch +++ b/patches/api/0423-Add-PlayerFailMoveEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerFailMoveEvent diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99822e51bb +index 0000000000000000000000000000000000000000..48610aa5eaacfe55e6931aac6f1a6644fb1718ef --- /dev/null +++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java @@ -0,0 +1,109 @@ @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99 + */ + @NotNull + public Location getFrom() { -+ return from; ++ return from.clone(); + } + + /** @@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..bb0be7376d068fa94f68d139c616bd99 + */ + @NotNull + public Location getTo() { -+ return to; ++ return to.clone(); + } + + /** diff --git a/patches/server/0994-Implement-PlayerFailMoveEvent.patch b/patches/server/0994-Implement-PlayerFailMoveEvent.patch index 956ede9dce..6d03ed35db 100644 --- a/patches/server/0994-Implement-PlayerFailMoveEvent.patch +++ b/patches/server/0994-Implement-PlayerFailMoveEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerFailMoveEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd2660d7cf21 100644 +index 75bd92e1d40588d3bc40fa7837943eec9f2062a6..80e050603e36134754136a8ee2bd14624f976e91 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1404,8 +1404,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1406,8 +1406,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER @@ -19,7 +19,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26 if (this.player.isPassenger()) { this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); -@@ -1471,8 +1471,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1473,8 +1473,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper start - Prevent moving into unloaded chunks if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { @@ -34,7 +34,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26 } // Paper end -@@ -1481,9 +1487,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1483,9 +1489,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end @@ -51,7 +51,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26 } } -@@ -1548,8 +1561,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1550,8 +1563,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean flag2 = false; if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot @@ -67,7 +67,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26 } // Paper start - optimise out extra getCubes -@@ -1562,6 +1582,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1564,6 +1584,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (didCollide || !axisalignedbb.equals(newBox)) { // note: only call after setLocation, or else getBoundingBox is wrong teleportBack = this.hasNewCollision(worldserver, this.player, axisalignedbb, newBox); @@ -83,7 +83,7 @@ index 316740b2ba4c85828f544249c8cdd6fa1b525d3f..f14f498203169797434a113c73a0dd26 } // else: no collision at all detected, why do we care? } if (!this.player.noPhysics && !this.player.isSleeping() && teleportBack) { // Paper end - optimise out extra getCubes -@@ -1650,6 +1679,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1652,6 +1681,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } diff --git a/patches/server/0994-Only-erase-allay-memory-on-non-item-targets.patch b/patches/server/0995-Only-erase-allay-memory-on-non-item-targets.patch similarity index 100% rename from patches/server/0994-Only-erase-allay-memory-on-non-item-targets.patch rename to patches/server/0995-Only-erase-allay-memory-on-non-item-targets.patch diff --git a/patches/server/0995-API-for-updating-recipes-on-clients.patch b/patches/server/0996-API-for-updating-recipes-on-clients.patch similarity index 100% rename from patches/server/0995-API-for-updating-recipes-on-clients.patch rename to patches/server/0996-API-for-updating-recipes-on-clients.patch diff --git a/patches/server/0996-Only-capture-actual-tree-growth.patch b/patches/server/0997-Only-capture-actual-tree-growth.patch similarity index 100% rename from patches/server/0996-Only-capture-actual-tree-growth.patch rename to patches/server/0997-Only-capture-actual-tree-growth.patch