Square Buttons for Menu

This commit is contained in:
Kam committed 2025-02-06 18:08:38 -05:00
1 parent 328a3d4186
commit 5de68934eb
4 files changed
+10 -5

No files matched your search

@@ -70,14 +70,18 @@ public class GuiNpcSquareButton extends GuiNpcButton {
GL11.glPushMatrix();
// Disable lighting so the icon is drawn at full brightness.
RenderHelper.disableStandardItemLighting();
// Reset color to white.
GL11.glColor4f(1F, 1F, 1F, 1F);
// Compute center of icon area.
float centerX = xPosition + size / 2.0F;
float centerY = yPosition + iconAreaHeight / 2.0F;
GL11.glTranslatef(centerX, centerY, 0F);
// Scale so that original icon height maps to the icon area height.
float scale = (float) iconAreaHeight / (float) iconHeight; // iconHeight should be 24 now.
// Use an internal padding so the icon doesn't touch the borders.
int iconPadding = 2; // adjust as needed
// Compute scale: available space is (iconAreaHeight - 2 * iconPadding)
float scale = (float) (iconAreaHeight - 2 * iconPadding) / (float) iconHeight;
GL11.glScalef(scale, scale, 1F);
// Center the icon (assuming iconWidth and iconHeight are the texture's dimensions)
GL11.glTranslatef(-iconWidth / 2.0F, -iconHeight / 2.0F, 0F);
this.drawTexturedModalRect(0, 0, iconPosX, iconPosY, iconWidth, iconHeight);
GL11.glPopMatrix();
@@ -87,6 +91,7 @@ public class GuiNpcSquareButton extends GuiNpcButton {
textButton.drawButton(mc, mouseX, mouseY);
}
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (!this.visible)
@@ -346,7 +346,7 @@ global.banks=Banken
global.transport=Transport
global.playerdata=PlayerData
global.recipes=Rezepte
global.naturalspawn=Natural Spawns
global.naturalspawn=Spawns
bank.slot=Slot
bank.unlock=Freischalten
@@ -521,7 +521,7 @@ global.banks=Banks
global.transport=Transport
global.playerdata=PlayerData
global.recipes=Recipes
global.naturalspawn=Natural Spawns
global.naturalspawn=Spawns
global.linked=Linked
bank.slot=Slot
@@ -362,7 +362,7 @@ global.banks=Сберегатели
global.transport=Транспортёры
global.playerdata=Данные игроков
global.recipes=Рецепты
global.naturalspawn=Естественные спауны
global.naturalspawn=Спавнится
global.linked=Связи
bank.slot=Слот