From 0382295653ffe81ea5075efc2c62c053524dc37b Mon Sep 17 00:00:00 2001 From: Purdze Date: Wed, 1 Jul 2026 18:22:30 +0100 Subject: [PATCH 1/2] Hide health/food/armor/air bars outside survival --- pomme-client/src/ui/hud.rs | 68 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/pomme-client/src/ui/hud.rs b/pomme-client/src/ui/hud.rs index 059fde2c..9323c958 100644 --- a/pomme-client/src/ui/hud.rs +++ b/pomme-client/src/ui/hud.rs @@ -143,45 +143,49 @@ pub fn build_hud( } let status_bar_y = (hotbar_y - (XP_BAR_H + 1.0 + 2.0) * gs).round(); - build_status_bar( - elements, - hotbar_x, - status_bar_y, - health, - false, - SpriteId::HeartContainer, - SpriteId::HeartFull, - SpriteId::HeartHalf, - gs, - ); - build_status_bar( - elements, - hotbar_x + hotbar_w, - status_bar_y, - food as f32, - true, - SpriteId::FoodEmpty, - SpriteId::FoodFull, - SpriteId::FoodHalf, - gs, - ); - - if armor > 0 { - let armor_y = (status_bar_y - (ICON_SIZE + 1.0) * gs).round(); + // Vanilla shows the status/air/xp bars only in Survival (0) and Adventure (2). + let is_survival = game_mode == 0 || game_mode == 2; + if is_survival { build_status_bar( elements, hotbar_x, - armor_y, - armor as f32, + status_bar_y, + health, false, - SpriteId::ArmorEmpty, - SpriteId::ArmorFull, - SpriteId::ArmorHalf, + SpriteId::HeartContainer, + SpriteId::HeartFull, + SpriteId::HeartHalf, gs, ); + build_status_bar( + elements, + hotbar_x + hotbar_w, + status_bar_y, + food as f32, + true, + SpriteId::FoodEmpty, + SpriteId::FoodFull, + SpriteId::FoodHalf, + gs, + ); + + if armor > 0 { + let armor_y = (status_bar_y - (ICON_SIZE + 1.0) * gs).round(); + build_status_bar( + elements, + hotbar_x, + armor_y, + armor as f32, + false, + SpriteId::ArmorEmpty, + SpriteId::ArmorFull, + SpriteId::ArmorHalf, + gs, + ); + } } - if game_mode == 0 || game_mode == 2 { + if is_survival { let xp_w = XP_BAR_W * gs; let xp_h = XP_BAR_H * gs; let xp_x = (cx - xp_w / 2.0).round(); @@ -253,7 +257,7 @@ pub fn build_hud( } let max_air = crate::player::MAX_AIR_SUPPLY; - if eyes_in_water || air_supply < max_air { + if is_survival && (eyes_in_water || air_supply < max_air) { let air = air_supply.clamp(0, max_air); let bubble_count = |offset: i32| -> i32 { (((air + offset) * 10 + max_air - 1) / max_air).clamp(0, 10) }; From 0872561e17b02c7062a6b594bc6d936121702c88 Mon Sep 17 00:00:00 2001 From: Purdze Date: Thu, 2 Jul 2026 18:50:59 +0100 Subject: [PATCH 2/2] cleanup --- pomme-client/src/player/mod.rs | 7 +++++++ pomme-client/src/ui/hud.rs | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pomme-client/src/player/mod.rs b/pomme-client/src/player/mod.rs index dbe0447f..53f0fd74 100644 --- a/pomme-client/src/player/mod.rs +++ b/pomme-client/src/player/mod.rs @@ -16,6 +16,13 @@ const DROWN_DAMAGE_THRESHOLD: i32 = -20; const DROWN_DAMAGE: f32 = 2.0; const AIR_RECOVERY_RATE: i32 = 4; +// TODO: migrate the remaining raw `game_mode == N` checks to shared constants +// or an enum. +/// Matches vanilla GameType.isSurvival(): Survival (0) or Adventure (2). +pub fn is_survival(game_mode: u8) -> bool { + game_mode == 0 || game_mode == 2 +} + fn is_water_block(state: azalea_block::BlockState) -> bool { if state.is_air() { return false; diff --git a/pomme-client/src/ui/hud.rs b/pomme-client/src/ui/hud.rs index 9323c958..ce5108ce 100644 --- a/pomme-client/src/ui/hud.rs +++ b/pomme-client/src/ui/hud.rs @@ -143,8 +143,7 @@ pub fn build_hud( } let status_bar_y = (hotbar_y - (XP_BAR_H + 1.0 + 2.0) * gs).round(); - // Vanilla shows the status/air/xp bars only in Survival (0) and Adventure (2). - let is_survival = game_mode == 0 || game_mode == 2; + let is_survival = crate::player::is_survival(game_mode); if is_survival { build_status_bar( elements, @@ -183,9 +182,7 @@ pub fn build_hud( gs, ); } - } - if is_survival { let xp_w = XP_BAR_W * gs; let xp_h = XP_BAR_H * gs; let xp_x = (cx - xp_w / 2.0).round();