refactor(jui): specify overrides, resourcelocations, and localization

This commit is contained in:
Sally Knight
2026-03-27 20:33:41 +03:00
committed by Tropical
parent c512bcb19c
commit 1a478c8a5b
40 changed files with 218 additions and 201 deletions

View File

@@ -2,11 +2,18 @@
#include "CraftingScreen.h"
#include "../../Textures/Textures.h"
#include "../../Player/MultiPlayerLocalPlayer.h"
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
#ifdef ENABLE_JAVA_GUIS
ResourceLocation GUI_CRAFTING_LOCATION = ResourceLocation(TN_GUI_CRAFTING);
#endif
CraftingScreen::CraftingScreen(std::shared_ptr<Inventory> inventory,
Level* level, int x, int y, int z)
: AbstractContainerScreen(new CraftingMenu(inventory, level, x, y, z)) {}
: AbstractContainerScreen(new CraftingMenu(inventory, level, x, y, z)) {
this->inventory = inventory;
}
void CraftingScreen::removed() {
AbstractContainerScreen::removed();
@@ -14,16 +21,15 @@ void CraftingScreen::removed() {
}
void CraftingScreen::renderLabels() {
font->draw(L"Crafting", 8 + 16 + 4, 2 + 2 + 2, 0x404040);
font->draw(L"Inventory", 8, imageHeight - 96 + 2, 0x404040);
font->draw(Language::getInstance()->getElement(L"container.crafting"), 8 + 16 + 4, 2 + 2 + 2, 0x404040);
font->draw(inventory->getName(), 8, imageHeight - 96 + 2, 0x404040);
}
void CraftingScreen::renderBg(float a) {
// 4J Unused
#ifdef ENABLE_JAVA_GUIS
int tex = minecraft->textures->loadTexture(TN_GUI_CRAFTING);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
minecraft->textures->bindTexture(&GUI_CRAFTING_LOCATION);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
this->blit(xo, yo, 0, 0, imageWidth, imageHeight);