9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Correctly update isEyeInFluid cache

This commit is contained in:
Dreeam
2025-06-29 01:13:54 +08:00
parent 35471da55b
commit 9d2cc999a9
3 changed files with 10 additions and 9 deletions

View File

@@ -92,7 +92,7 @@ index 373059fcccdab0a918aa1d1a4a613fb62fef8a18..7d0a1181ac64eabd54395cff8e1b9356
if (rounded > 0) {
this.awardStat(Stats.WALK_UNDER_WATER_ONE_CM, rounded);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be822cd935 100644
index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..069a3a46bf2f699210234a4096642d1b6e82b5f1 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -268,7 +268,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -111,17 +111,18 @@ index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be
public int invulnerableTime;
protected boolean firstTick = true;
protected final SynchedEntityData entityData;
@@ -2014,8 +2021,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2014,8 +2021,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
private void updateFluidOnEyes() {
- this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER);
- this.fluidOnEyes.clear();
+ this.wasEyeInWater = this.isInWaterOrLava == 1; // Leaf - Optimize isEyeInFluid
+ this.isInWaterOrLava = 0; // Leaf - Optimize isEyeInFluid - reset cache
double eyeY = this.getEyeY();
if (!(
this.getVehicle() instanceof AbstractBoat abstractBoat
@@ -2027,7 +2033,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2027,7 +2034,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
FluidState fluidState = this.level().getFluidState(blockPos);
double d = blockPos.getY() + fluidState.getHeight(this.level(), blockPos);
if (d > eyeY) {
@@ -133,7 +134,7 @@ index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be
}
}
}
@@ -2107,9 +2116,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2107,9 +2117,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}

View File

@@ -149,7 +149,7 @@ index 07f6da45a88e1630ca4249bb134fce1f95d2c39c..9fbaafaf5df6e003742cdea55da732cc
private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44bfd4978d5 100644
index 069a3a46bf2f699210234a4096642d1b6e82b5f1..616a8959bbdea5919fca34f54f2678a4d2f744ab 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1148,16 +1148,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -200,7 +200,7 @@ index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44b
}
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) {
@@ -4856,9 +4830,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4857,9 +4831,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setDeltaMovement(Vec3 deltaMovement) {
@@ -210,7 +210,7 @@ index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44b
}
public void addDeltaMovement(Vec3 addend) {
@@ -4966,9 +4938,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4967,9 +4939,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
// Paper end - Fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {

View File

@@ -15,10 +15,10 @@ Currently, this is not an issue for (all) hanging blocks since they have a fix i
Note however the client does not nicely support moving these entities anyways.
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 5bdc73dd410877a7d84cb6c01323b44bfd4978d5..eaec674d1059916943fe4d810b91990df106ef55 100644
index 616a8959bbdea5919fca34f54f2678a4d2f744ab..d72c679cc9fe059d89011d9c75345b01689680da 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4951,6 +4951,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4952,6 +4952,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
this.levelCallback.onMove();