From 04b76893ca1fdd08aabb483e262c5560c71a9901 Mon Sep 17 00:00:00 2001 From: Sally Knight Date: Fri, 13 Mar 2026 20:53:41 +0300 Subject: [PATCH] feat: re-enable boss health bar --- Minecraft.Client/UI/Gui.cpp | 70 +++++++++++++++++++------------------ Minecraft.Client/UI/Gui.h | 2 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index 83893d4a9..6dad298c4 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -365,7 +365,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // if (false) //(true) // { -// renderBossHealth(); +#ifdef ENABLE_JAVA_GUIS + renderBossHealth(); +#endif // } ///////////////////////////////////////////////////////////////////////////////////// @@ -1028,39 +1030,39 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) } // Moved to the xui base scene -// void Gui::renderBossHealth(void) -// { -// if (EnderDragonRenderer::bossInstance == NULL) return; -// -// std::shared_ptr boss = EnderDragonRenderer::bossInstance; -// EnderDragonRenderer::bossInstance = NULL; -// -// Minecraft *pMinecraft=Minecraft::GetInstance(); -// -// Font *font = pMinecraft->font; -// -// ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); -// int screenWidth = ssc.getWidth(); -// -// int w = 182; -// int xLeft = screenWidth / 2 - w / 2; -// -// int progress = (int) (boss->getSynchedHealth() / (float) boss->getMaxHealth() * (float) (w + 1)); -// -// int yo = 12; -// blit(xLeft, yo, 0, 74, w, 5); -// blit(xLeft, yo, 0, 74, w, 5); -// if (progress > 0) -// { -// blit(xLeft, yo, 0, 79, progress, 5); -// } -// -// std::wstring msg = L"Boss health - NON LOCALISED"; -// font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff); -// glColor4f(1, 1, 1, 1); -// glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png")); -// -// } +void Gui::renderBossHealth(void) +{ + if (EnderDragonRenderer::bossInstance == NULL) return; + + std::shared_ptr boss = EnderDragonRenderer::bossInstance; + EnderDragonRenderer::bossInstance = NULL; + + Minecraft *pMinecraft=Minecraft::GetInstance(); + + Font *font = pMinecraft->font; + + ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); + int screenWidth = ssc.getWidth(); + + int w = 182; + int xLeft = screenWidth / 2 - w / 2; + + int progress = (int) (boss->getSynchedHealth() / (float) boss->getMaxHealth() * (float) (w + 1)); + + int yo = 12; + blit(xLeft, yo, 0, 74, w, 5); + blit(xLeft, yo, 0, 74, w, 5); + if (progress > 0) + { + blit(xLeft, yo, 0, 79, progress, 5); + } + + std::wstring msg = L"Boss health"/*L"Boss health - NON LOCALISED"*/; + font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png")); + +} void Gui::renderPumpkin(int w, int h) { diff --git a/Minecraft.Client/UI/Gui.h b/Minecraft.Client/UI/Gui.h index 725a3b4c6..0e7df22c9 100644 --- a/Minecraft.Client/UI/Gui.h +++ b/Minecraft.Client/UI/Gui.h @@ -43,7 +43,7 @@ public: float tbr; private: - //void renderBossHealth(void); + void renderBossHealth(void); void renderPumpkin(int w, int h); void renderVignette(float br, int w, int h); void renderTp(float br, int w, int h);