Merge pull request #2374 from kacpherek/fix/effect-icons-over-screens

🤖 Agent: Proven in union R1 (branch union/cg19-r1, main + 83 of kacpherek's PRs): the 98 harnesses it can affect, clippy -D warnings, tests, lan_e2e in-frame and on the server thread.
This commit is contained in:
Ludovic Marie
2026-10-27 15:17:28 +01:00
committed by GitHub
+21 -2
View File
@@ -1215,9 +1215,28 @@ impl Game<'_> {
}
}
}
/// `Hud.extractEffects`: icons top-right, beneficial row then harmful row.
/// `Screen.showsActiveEffects`: the survival and creative inventories
/// draw their own effect list when `EffectsInInventory.canSeeEffects`
/// (32 or more pixels right of the screen).
fn screen_shows_active_effects(&self, batch: &HudBatch) -> bool {
let (ox, image_width) = match self.screen {
Screen::Inventory
if self.container.is_none() && self.craft_size == 2 && !self.mount_active() =>
{
(self.inventory_origin(batch).0, 176)
}
Screen::Creative => (
Self::creative_origin(batch).0,
horizon_client::creative::Creative::WIDTH as i32,
),
_ => return false,
};
batch.width as i32 - (ox as i32 + image_width + 2) >= 32
}
/// `Hud.extractEffects`: icons top-right, beneficial row then harmful row;
/// every screen but the inventories keeps them.
pub(super) fn draw_effect_icons(&self, batch: &mut HudBatch) {
if self.screen != Screen::Playing || self.potions.effects.list.is_empty() {
if self.potions.effects.list.is_empty() || self.screen_shows_active_effects(batch) {
return;
}
let icons: Vec<hud_overlays::EffectIcon> = self