From 5b198d7b315bcf3af323c2f343321640ae1c7d6c Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Sat, 26 Sep 2026 14:46:10 -0400 Subject: [PATCH] feat: Java Crosshair Inversion --- Minecraft.Client/Gui.cpp | 81 +++++++++++++++++++--------------------- Minecraft.Client/Gui.h | 2 +- README.md | 2 +- 3 files changed, 41 insertions(+), 44 deletions(-) diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 5b54e0e1..90b78535 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -331,7 +331,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) glEnable(GL_BLEND); RenderManager.StateSetBlendFactor(0xffffff |(((unsigned int)fVal)<<24)); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); - //glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); // 4J Stu - We don't want to adjust the cursor by the safezone, we want it centred if(bTwoPlayerSplitscreen) { @@ -341,7 +341,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { blit(screenWidth / 2 - 7, screenHeight / 2 - 7, 0, 0, 16, 16); } - glDisable(GL_BLEND); // if(bTwoPlayerSplitscreen) // { @@ -356,10 +355,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) int iLastHealth = minecraft->player->lastHealth; random->setSeed(tickCount * 312871); -// if (false) //(true) -// { -// renderBossHealth(); -// } + if (EnderDragonRenderer::bossInstance != NULL) + { + renderBossHealth(); + } ///////////////////////////////////////////////////////////////////////////////////// // Display the experience, food, armour, health and the air bubbles @@ -473,8 +472,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) //////////////////////////// if(bDisplayGui) { - // glDisable(GL_BLEND); 4J - removed - we want to be able to fade our gui - glEnable(GL_RESCALE_NORMAL); Lighting::turnOnGui(); @@ -962,40 +959,40 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) glEnable(GL_ALPHA_TEST); } -// Moved to the xui base scene -// void Gui::renderBossHealth(void) -// { -// if (EnderDragonRenderer::bossInstance == NULL) return; -// -// 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); -// } -// -// 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")); -// -// } +#if RENDER_HUD +void Gui::renderBossHealth(void) +{ + if (EnderDragonRenderer::bossInstance == NULL) return; + + 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); + } + + wstring msg = app.GetString(IDS_BOSS_ENDERDRAGON_HEALTH); + 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")); +} +#endif void Gui::renderPumpkin(int w, int h) { diff --git a/Minecraft.Client/Gui.h b/Minecraft.Client/Gui.h index 41762016..287e3408 100644 --- a/Minecraft.Client/Gui.h +++ b/Minecraft.Client/Gui.h @@ -42,7 +42,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); diff --git a/README.md b/README.md index a526e661..17365784 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Bringing the October 10th 2014 Source Leak back down to TU0 ## C++ Rendering - [x] Hotbar Rendering -- [ ] Java Crosshair +- [x] Java Crosshair Inversion ## b1.6.6 Features - [ ] Beta Lighting