Merge pull request #2194 from kacpherek/fix/turtle-helmet-water-breathing

🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: the turtle helmet gives Water Breathing for 200 ticks while the eyes are out of water (`Player.turtleHelmetTick`). Gate: this wave's 55 PRs merged on main in one tree: clippy `-D warnings` clean, 1186 horizon-client and 163 horizon-world tests pass, and of the 101 harnesses `parity.py --changed-files` picked, 100 pass (`block_removal` failed on one spawner case from #2199's orb merging, fixed there). `lan_e2e.py` passes 24 checks with the host on its server thread and in-frame (chest, xp, pvp, doors, villagers, beds, frames, projectiles, arrows, fishing, damage, mobs, blast, drops, elytra, breath, predict, cracks, barter, kills, hurt, contacts, underwater, plates), plus forced-levels on the server thread. Thanks @kacpherek!
This commit is contained in:
Ludovic Marie
2026-10-26 20:08:08 +01:00
committed by GitHub
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ impl Game<'_> {
})
}
/// `isEyeInFluid(WATER)`: the eye inside the water of its block column.
fn eye_in_water(&self, x: f64, eye_y: f64, z: f64) -> bool {
pub(super) fn eye_in_water(&self, x: f64, eye_y: f64, z: f64) -> bool {
let (bx, by, bz) = (x.floor() as i32, eye_y.floor() as i32, z.floor() as i32);
let f = self.res.facts().get(self.world.block(bx, by, bz));
if f.fluid != Fluid::Water {
+20
View File
@@ -400,8 +400,28 @@ impl Game<'_> {
for action in actions {
self.apply_effect_action(action);
}
self.turtle_helmet_tick();
self.apply_effect_status();
}
/// `Player.tick` -> `turtleHelmetTick`: with a turtle helmet on the head
/// and the eyes out of the water, Water Breathing for 200 ticks (no
/// particles, an icon).
fn turtle_helmet_tick(&mut self) {
let Some(p) = self.player.as_ref() else {
return;
};
let eye_y = p.position.y + f64::from(p.dimensions.eye_height);
if !p.health.dead_or_dying()
&& self.armor[0]
.as_ref()
.is_some_and(|s| &*s.item == "minecraft:turtle_helmet")
&& !self.eye_in_water(p.position.x, eye_y, p.position.z)
{
let mut effect = EffectInstance::new("water_breathing", 200, 0);
effect.visible = false;
self.potions.effects.add(effect);
}
}
/// A client's own effects (`LivingEntity.tickEffects` on the client,
/// `MobEffectInstance.tickClient`): they count down, and the server
/// removes them. Their modifiers and flags move the predicted player.