diff --git a/build-data/paper.at b/build-data/paper.at index 26cdb6eafe..cf91314d93 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -186,6 +186,7 @@ public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String; public net.minecraft.world.entity.Entity getFireImmuneTicks()I public net.minecraft.world.entity.Entity getSharedFlag(I)Z public net.minecraft.world.entity.Entity hasVisualFire +public net.minecraft.world.entity.Entity isAffectedByBlocks()Z public net.minecraft.world.entity.Entity isInBubbleColumn()Z public net.minecraft.world.entity.Entity isInRain()Z public net.minecraft.world.entity.Entity isInvulnerableToBase(Lnet/minecraft/world/damagesource/DamageSource;)Z diff --git a/paper-server/patches/features/0031-Do-not-record-movement-for-vehicles-players-unaffect.patch b/paper-server/patches/features/0031-Do-not-record-movement-for-vehicles-players-unaffect.patch new file mode 100644 index 0000000000..0e1eece0f4 --- /dev/null +++ b/paper-server/patches/features/0031-Do-not-record-movement-for-vehicles-players-unaffect.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 2 Feb 2025 10:57:48 -0800 +Subject: [PATCH] Do not record movement for vehicles/players unaffected by + blocks + +If the player is not affected by movement through blocks, then +storing the movement would eventually invoke logic to apply effects +caused by moving through such blocks. For example, moving through +a portal in spectator mode and then later switching to creative mode +would portal the player. + +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 5738709f5fa6fee2ed88ba41a7718c976b780e96..882dbb1276c548316938bbc50f5f7e01f8547ff8 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -657,7 +657,7 @@ public class ServerGamePacketListenerImpl + // CraftBukkit end + + this.player.serverLevel().getChunkSource().move(this.player); +- rootVehicle.recordMovementThroughBlocks(new Vec3(x, y, z), rootVehicle.position()); ++ if (!rootVehicle.isSpectator() && rootVehicle.isAffectedByBlocks()) rootVehicle.recordMovementThroughBlocks(new Vec3(x, y, z), rootVehicle.position()); + Vec3 vec3 = new Vec3(rootVehicle.getX() - x, rootVehicle.getY() - y, rootVehicle.getZ() - z); + this.handlePlayerKnownMovement(vec3); + rootVehicle.setOnGroundWithMovement(packet.onGround(), vec3); +@@ -1574,7 +1574,7 @@ public class ServerGamePacketListenerImpl + Vec3 vec3 = new Vec3(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z); + this.player.setOnGroundWithMovement(packet.isOnGround(), packet.horizontalCollision(), vec3); + this.player.doCheckFallDamage(vec3.x, vec3.y, vec3.z, packet.isOnGround()); +- this.player.recordMovementThroughBlocks(new Vec3(x, y, z), this.player.position()); ++ if (!this.player.isSpectator() && this.player.isAffectedByBlocks()) this.player.recordMovementThroughBlocks(new Vec3(x, y, z), this.player.position()); + this.handlePlayerKnownMovement(vec3); + if (flag) { + this.player.resetFallDistance();