better ui

This commit is contained in:
Leo Codes
2025-02-24 14:13:21 +01:00
parent 3058748b0c
commit c5b98a99ee
7 changed files with 12 additions and 10 deletions
@@ -23,8 +23,6 @@ public class CloakSelector extends AuraUi {
for (int i = 0; i < AuraClient.list.size(); i++) {
String cloak = AuraClient.list.get(i);
ImageButton img = new ImageButton(Identifier.of("auraclient", "textures/gui/cloaks/"+cloak.replaceAll("\\.(gif|png)", "")+".prev.png"), x, y, 32, 92);
img.textureHeight = 16;
img.textureWidth = 16;
img.onClick = () -> {
AuraClient.cape = cloak;
};
@@ -1,13 +1,19 @@
package org.auraclient.auraclient.ui;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier;
public class Box extends AuraWidget {
public static Identifier BOX = Identifier.of("auraclient", "textures/gui/box/box.png");
public Box(int x, int y, int width, int height) {
super(x, y, width, height);
}
public void render(DrawContext context, boolean hover) {
context.fill(x1, y1, x2, y2, background);
int width = x2 - x1;
int height = y2 - y1;
context.drawTexture(RenderLayer::getGuiTextured, Box.BOX, x1, y1, 0, 0, width, height, width, height);
}
}
@@ -1,6 +1,8 @@
package org.auraclient.auraclient.ui;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier;
public class Button extends AuraWidget {
public Runnable onClick;
@@ -14,7 +16,9 @@ public class Button extends AuraWidget {
}
public void render(DrawContext context, boolean hover) {
context.fill(x1, y1, x2, y2, background);
int width = x2 - x1;
int height = y2 - y1;
context.drawTexture(RenderLayer::getGuiTextured, Box.BOX, x1, y1, 0, 0, width, height, width, height);
context.drawText(client.textRenderer, text, (((x2 - x1) - client.textRenderer.getWidth(text)) / 2) + x1, (((y2 - y1) - 6) / 2) + y1, foreground, false);
@@ -7,23 +7,17 @@ import net.minecraft.util.Identifier;
public class ImageButton extends AuraWidget {
private final Identifier sprite;
public int hoverBorder = 0xFFFFFFFF;
public int textureWidth;
public int textureHeight;
public Runnable onClick;
public ImageButton(Identifier sprite_, int x, int y, int width, int height) {
super(x, y, width, height);
this.sprite = sprite_;
this.textureWidth = width;
this.textureHeight = height;
this.onClick = () -> {};
}
public ImageButton(Identifier sprite_, int x, int y, int width, int height, int textureWidth, int textureHeight) {
super(x, y, width, height);
this.sprite = sprite_;
this.textureWidth = textureWidth;
this.textureHeight = textureHeight;
this.onClick = () -> {};
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 57 KiB