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

@ -1121,7 +1121,7 @@ std::shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(
localplayers[idx]->setOnlineXuid(playerXUIDOnline); localplayers[idx]->setOnlineXuid(playerXUIDOnline);
localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx)); localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx));
localplayers[idx]->displayName = ProfileManager.GetDisplayName(idx); localplayers[idx]->m_displayName = ProfileManager.GetDisplayName(idx);
localplayers[idx]->m_iScreenSection = tempScreenSection; localplayers[idx]->m_iScreenSection = tempScreenSection;
@ -2025,7 +2025,7 @@ void Minecraft::run_middle() {
PIXBeginNamedEvent(0, "Light update"); PIXBeginNamedEvent(0, "Light update");
if (level != NULL) level->updateLights(); // if (level != NULL) level->updateLights();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
PIXEndNamedEvent(); PIXEndNamedEvent();
@ -4529,7 +4529,7 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/,
player->setXuid(playerXUIDOffline); player->setXuid(playerXUIDOffline);
player->setOnlineXuid(playerXUIDOnline); player->setOnlineXuid(playerXUIDOnline);
player->displayName = ProfileManager.GetDisplayName(iPrimaryPlayer); player->m_displayName = ProfileManager.GetDisplayName(iPrimaryPlayer);
player->resetPos(); player->resetPos();
gameMode->initPlayer(player); gameMode->initPlayer(player);
@ -4638,9 +4638,9 @@ void Minecraft::prepareLevel(int title) {
this->progressRenderer->progressStagePercentage((pp++) * 100 / this->progressRenderer->progressStagePercentage((pp++) * 100 /
max); max);
level->getTile(spawnPos->x + x, 64, spawnPos->z + z); level->getTile(spawnPos->x + x, 64, spawnPos->z + z);
if (!gameMode->isCutScene()) { // if (!gameMode->isCutScene()) {
while (level->updateLights()); // while (level->updateLights());
} // }
} }
} }
delete spawnPos; delete spawnPos;
@ -4721,7 +4721,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) {
player->setOnlineXuid(playerXUIDOnline); player->setOnlineXuid(playerXUIDOnline);
player->setIsGuest(ProfileManager.IsGuest(iTempPad)); player->setIsGuest(ProfileManager.IsGuest(iTempPad));
player->displayName = ProfileManager.GetDisplayName(iPad); player->m_displayName = ProfileManager.GetDisplayName(iPad);
player->SetXboxPad(iTempPad); player->SetXboxPad(iTempPad);

View file

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

View file

@ -8,6 +8,7 @@ class ItemRenderer;
class Gui : public GuiComponent { class Gui : public GuiComponent {
private: private:
static ResourceLocation PUMPKIN_BLUR_LOCATION;
// 4J-PB - this doesn't account for the safe zone, and the indent applied to // 4J-PB - this doesn't account for the safe zone, and the indent applied to
// messages // messages
// static const int MAX_MESSAGE_WIDTH = 320; // static const int MAX_MESSAGE_WIDTH = 320;

View file

@ -78,12 +78,12 @@ std::shared_ptr<ItemInstance> CreativeInventoryScreen::ContainerCreative::clicke
} }
// Validate slot index // Validate slot index
if (slotIndex < 0 || slotIndex >= (int)slots->size()) if (slotIndex < 0 || slotIndex >= (int)slots.size())
{ {
return std::shared_ptr<ItemInstance>(); return std::shared_ptr<ItemInstance>();
} }
Slot* slot = slots->at(slotIndex); Slot* slot = slots.at(slotIndex);
// Handle creative inventory slots (0-44) // Handle creative inventory slots (0-44)
if (slotIndex >= 0 && slotIndex < ITEMS_PER_PAGE) if (slotIndex >= 0 && slotIndex < ITEMS_PER_PAGE)
@ -282,11 +282,11 @@ void CreativeInventoryScreen::mouseClicked(int x, int y, int buttonNum)
int slotId = -1; int slotId = -1;
if (slot != NULL) slotId = slot->index; if (slot != NULL) slotId = slot->index;
if (clickedOutside) slotId = AbstractContainerMenu::CLICKED_OUTSIDE; if (clickedOutside) slotId = AbstractContainerMenu::SLOT_CLICKED_OUTSIDE;
if (slotId == -1) return; if (slotId == -1) return;
bool quickKey = slotId != AbstractContainerMenu::CLICKED_OUTSIDE && bool quickKey = slotId != AbstractContainerMenu::SLOT_CLICKED_OUTSIDE &&
(Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT)); (Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
int clickType = quickKey ? AbstractContainerMenu::CLICK_QUICK_MOVE : AbstractContainerMenu::CLICK_PICKUP; int clickType = quickKey ? AbstractContainerMenu::CLICK_QUICK_MOVE : AbstractContainerMenu::CLICK_PICKUP;

View file

@ -11,7 +11,7 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h"
const std::wstring TextEditScreen::allowedChars = const std::wstring TextEditScreen::allowedChars =
SharedConstants::readAcceptableChars(); SharedConstants::acceptableLetters;
TextEditScreen::TextEditScreen(std::shared_ptr<SignTileEntity> sign) { TextEditScreen::TextEditScreen(std::shared_ptr<SignTileEntity> sign) {
// 4J - added initialisers // 4J - added initialisers