Merge pull request #219 from realffqq/feat/restore-java-gui

(java gui) feat: re-enable boss health bar
This commit is contained in:
DecalOverdose 2026-03-13 21:58:03 +04:00 committed by GitHub
commit 604a9b103e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 35 deletions

View file

@ -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<EnderDragon> 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<EnderDragon> 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)
{

View file

@ -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);