fixes to java UI and Minecraft.cpp

This commit is contained in:
Tropical
2026-03-22 04:14:58 -05:00
parent 58cdba39f3
commit 1c5311f058
5 changed files with 45 additions and 40 deletions

View File

@@ -5,6 +5,7 @@
#include "../GameState/Options.h"
#include "../Player/MultiPlayerLocalPlayer.h"
#include "../Textures/Textures.h"
#include "../Textures/TextureAtlas.h"
#include "../GameState/GameMode.h"
#include "../Rendering/Lighting.h"
#include "Screens/ChatScreen.h"
@@ -28,6 +29,9 @@
#include "../../Minecraft.World/Level/LevelChunk.h"
#include "../../Minecraft.World/WorldGen/Biomes/Biome.h"
ResourceLocation Gui::PUMPKIN_BLUR_LOCATION =
ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR);
#ifdef ENABLE_JAVA_GUIS
#define RENDER_HUD 1
#else
@@ -636,7 +640,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
(displayCrouch || displaySprint || displayFlying)) {
EntityRenderDispatcher::instance->prepare(
minecraft->level, minecraft->textures, minecraft->font,
minecraft->cameraTargetPlayer, minecraft->options, a);
minecraft->cameraTargetPlayer, minecraft->crosshairPickMob,
minecraft->options, a);
glEnable(GL_RESCALE_NORMAL);
glEnable(GL_COLOR_MATERIAL);
@@ -1116,38 +1121,38 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
// Moved to the xui base scene
void Gui::renderBossHealth(void) {
if (EnderDragonRenderer::bossInstance == NULL) return;
// if (EnderDragonRenderer::bossInstance == NULL) return;
std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
EnderDragonRenderer::bossInstance = NULL;
// std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
// EnderDragonRenderer::bossInstance = NULL;
Minecraft* pMinecraft = Minecraft::GetInstance();
// Minecraft* pMinecraft = Minecraft::GetInstance();
Font* font = pMinecraft->font;
// Font* font = pMinecraft->font;
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
pMinecraft->height_phys);
int screenWidth = ssc.getWidth();
// ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
// pMinecraft->height_phys);
// int screenWidth = ssc.getWidth();
int w = 182;
int xLeft = screenWidth / 2 - w / 2;
// int w = 182;
// int xLeft = screenWidth / 2 - w / 2;
int progress = (int)(boss->getSynchedHealth() /
(float)boss->getMaxHealth() * (float)(w + 1));
// 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);
}
// 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"));
// 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) {
@@ -1158,8 +1163,7 @@ void Gui::renderPumpkin(int w, int h) {
glDisable(GL_ALPHA_TEST);
MemSect(31);
minecraft->textures->bindTexture(
TN__BLUR__MISC_PUMPKINBLUR); // L"%blur%/misc/pumpkinblur.png"));
minecraft->textures->bindTexture(&PUMPKIN_BLUR_LOCATION);
MemSect(0);
Tesselator* t = Tesselator::getInstance();
t->begin();
@@ -1217,7 +1221,7 @@ void Gui::renderTp(float br, int w, int h) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1, 1, 1, br);
MemSect(31);
minecraft->textures->bindTexture(TN_TERRAIN); // L"/terrain.png"));
minecraft->textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png"));
MemSect(0);
Icon* slot = Tile::portalTile->getTexture(Facing::UP);