From 7732ce986fb73be94434335d21e34fbb0d17e067 Mon Sep 17 00:00:00 2001 From: socksprox Date: Tue, 27 Oct 2026 02:31:11 +0100 Subject: [PATCH] Drop a client's remembered effects when it joins a world A rejoining player kept the previous session's effect list, so the HUD could show effects the server no longer had (nothing applied in combat, no icon was earned). Vanilla's new LocalPlayer starts empty and gets its effects from UpdateMobEffect; match that, and let the client-side tick drop effects whose duration ran out, as its removeIf does. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/game/potions.rs | 6 ++++-- crates/horizon-client/src/game/remote.rs | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/potions.rs b/crates/horizon-client/src/game/potions.rs index 2ccfd4116..6334ff5ad 100644 --- a/crates/horizon-client/src/game/potions.rs +++ b/crates/horizon-client/src/game/potions.rs @@ -427,9 +427,11 @@ impl Game<'_> { /// `MobEffectInstance.tickClient`): they count down, and the server /// removes them. Their modifiers and flags move the predicted player. pub(super) fn tick_client_effects(&mut self) { - for e in &mut self.potions.effects.list { + // LivingEntity.tickEffects (client): an exhausted effect drops. + self.potions.effects.list.retain_mut(|e| { e.tick_client(); - } + e.duration != 0 + }); self.apply_effect_status(); } /// Add an active effect to the player and update attributes / absorption. diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 945af4585..47846735a 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -394,6 +394,9 @@ impl Game<'_> { self.carried = None; self.using = None; self.clicks.miss_time = 0; + // A new LocalPlayer has no effects: the server sends what it has + // (ClientboundUpdateMobEffectPacket on placement). + self.potions = Default::default(); self.set_mode_id(0); self.experience = Experience { level: 0,