Fixed a few issues

This commit is contained in:
2026-02-21 19:46:40 +01:00
parent 2f93822996
commit 52f80281bd
5 changed files with 10 additions and 10 deletions
@@ -25,7 +25,6 @@ public class Theme {
// UI metrics
public static Property<Integer> BG_RADIUS = Property.integer(12);
public static Property<Integer> WIDGET_RADIUS = Property.integer(10);
public static Property<Integer> PADDING = Property.integer(14);
// Font (keeping your current system)
public static Property<Integer> FONT = Property.font(1);
@@ -9,8 +9,7 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier;
public class CosmeticPreview extends Element {
static {
}
static int padding = 14;
Identifier sprite;
private Runnable onClick;
@@ -32,10 +31,10 @@ public class CosmeticPreview extends Element {
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
int texWidth = width - Theme.PADDING.value;
int texHeight = height - Theme.PADDING.value;
int texWidth = width - padding;
int texHeight = height - padding;
renderScope.drawTexture(sprite, Theme.PADDING.value / 2, Theme.PADDING.value / 2, 0, 0, texWidth, texHeight,
renderScope.drawTexture(sprite, padding / 2, padding / 2, 0, 0, texWidth, texHeight,
Theme.FOREGROUND.value);
}
@@ -13,6 +13,7 @@ public class Button extends Element {
public Button(String text, Runnable onClick) {
this.text = text;
this.onClick = onClick;
this.dimensions(Fonts.getWidth(text, Theme.FONT.value) + 50, 38);
}
@Override
@@ -11,6 +11,7 @@ import net.minecraft.util.Identifier;
public class TextureButton extends Element {
Identifier sprite;
private Runnable onClick;
static int padding = 14;
public TextureButton(Identifier sprite, Runnable onClick) {
this.sprite = sprite;
@@ -24,10 +25,10 @@ public class TextureButton extends Element {
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
int texWidth = width - Theme.PADDING.value;
int texHeight = height - Theme.PADDING.value;
int texWidth = width - padding;
int texHeight = height - padding;
renderScope.drawTexture(sprite, Theme.PADDING.value / 2, Theme.PADDING.value / 2, 0, 0, texWidth, texHeight,
renderScope.drawTexture(sprite, padding / 2, padding / 2, 0, 0, texWidth, texHeight,
ctx.isHovering() ? Theme.ACCENT_FG.value : Theme.PRIMARY_FG.value);
}
@@ -25,7 +25,7 @@ public class ShiftMenu extends SaturnScreen {
Element button = new Button("Settings", () -> {
SaturnClient.client.setScreen(new ModMenu());
}).center(width, height);
}).center(width, height);
draw(button);