mirror of
https://github.com/PaperMC/Paper.git
synced 2025-04-05 22:05:20 +02:00
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.
This commit is contained in:
parent
e0711af5d5
commit
8927091a08
2 changed files with 35 additions and 0 deletions
build-data
paper-server/patches/features
|
@ -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
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
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();
|
Loading…
Add table
Reference in a new issue