Skip to content

Commit 9d2cc99

Browse files
committed
Correctly update isEyeInFluid cache
1 parent 35471da commit 9d2cc99

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

leaf-server/minecraft-patches/features/0258-Optimize-isEyeInFluid.patch

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ index 373059fcccdab0a918aa1d1a4a613fb62fef8a18..7d0a1181ac64eabd54395cff8e1b9356
9292
if (rounded > 0) {
9393
this.awardStat(Stats.WALK_UNDER_WATER_ONE_CM, rounded);
9494
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
95-
index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be822cd935 100644
95+
index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..069a3a46bf2f699210234a4096642d1b6e82b5f1 100644
9696
--- a/net/minecraft/world/entity/Entity.java
9797
+++ b/net/minecraft/world/entity/Entity.java
9898
@@ -268,7 +268,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -111,17 +111,18 @@ index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be
111111
public int invulnerableTime;
112112
protected boolean firstTick = true;
113113
protected final SynchedEntityData entityData;
114-
@@ -2014,8 +2021,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
114+
@@ -2014,8 +2021,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
115115
}
116116

117117
private void updateFluidOnEyes() {
118118
- this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER);
119119
- this.fluidOnEyes.clear();
120120
+ this.wasEyeInWater = this.isInWaterOrLava == 1; // Leaf - Optimize isEyeInFluid
121+
+ this.isInWaterOrLava = 0; // Leaf - Optimize isEyeInFluid - reset cache
121122
double eyeY = this.getEyeY();
122123
if (!(
123124
this.getVehicle() instanceof AbstractBoat abstractBoat
124-
@@ -2027,7 +2033,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
125+
@@ -2027,7 +2034,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
125126
FluidState fluidState = this.level().getFluidState(blockPos);
126127
double d = blockPos.getY() + fluidState.getHeight(this.level(), blockPos);
127128
if (d > eyeY) {
@@ -133,7 +134,7 @@ index 3bba6cd29f85bec2e98ce97313f1158e2836c6b9..0cad980ff4198615621a4dacf07127be
133134
}
134135
}
135136
}
136-
@@ -2107,9 +2116,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
137+
@@ -2107,9 +2117,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
137138
}
138139
}
139140

leaf-server/minecraft-patches/features/0278-Paw-optimization.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ index 07f6da45a88e1630ca4249bb134fce1f95d2c39c..9fbaafaf5df6e003742cdea55da732cc
149149

150150
private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2
151151
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
152-
index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44bfd4978d5 100644
152+
index 069a3a46bf2f699210234a4096642d1b6e82b5f1..616a8959bbdea5919fca34f54f2678a4d2f744ab 100644
153153
--- a/net/minecraft/world/entity/Entity.java
154154
+++ b/net/minecraft/world/entity/Entity.java
155155
@@ -1148,16 +1148,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -200,7 +200,7 @@ index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44b
200200
}
201201

202202
private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) {
203-
@@ -4856,9 +4830,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
203+
@@ -4857,9 +4831,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
204204
}
205205

206206
public void setDeltaMovement(Vec3 deltaMovement) {
@@ -210,7 +210,7 @@ index 0cad980ff4198615621a4dacf07127be822cd935..5bdc73dd410877a7d84cb6c01323b44b
210210
}
211211

212212
public void addDeltaMovement(Vec3 addend) {
213-
@@ -4966,9 +4938,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
213+
@@ -4967,9 +4939,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
214214
}
215215
// Paper end - Fix MC-4
216216
if (this.position.x != x || this.position.y != y || this.position.z != z) {

leaf-server/minecraft-patches/features/0279-Paper-Improve-Fix-MC-44654.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Currently, this is not an issue for (all) hanging blocks since they have a fix i
1515
Note however the client does not nicely support moving these entities anyways.
1616

1717
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
18-
index 5bdc73dd410877a7d84cb6c01323b44bfd4978d5..eaec674d1059916943fe4d810b91990df106ef55 100644
18+
index 616a8959bbdea5919fca34f54f2678a4d2f744ab..d72c679cc9fe059d89011d9c75345b01689680da 100644
1919
--- a/net/minecraft/world/entity/Entity.java
2020
+++ b/net/minecraft/world/entity/Entity.java
21-
@@ -4951,6 +4951,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
21+
@@ -4952,6 +4952,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2222
}
2323

2424
this.levelCallback.onMove();

0 commit comments

Comments
 (0)