From 27e9e7b90a76bb662fd7a5f8fe1d7fbec17a8cb9 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:10:12 -0400 Subject: Refactor fancy auction house - Add color and center rarity filter text - Use ItemUtils.getNbtTooltips - Use longs for item prices --- .../utils/render/gui/AbstractPopupScreen.java | 60 ++++++++++++++++++++++ .../utils/render/gui/BarebonesPopupScreen.java | 56 -------------------- 2 files changed, 60 insertions(+), 56 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/utils/render/gui/AbstractPopupScreen.java delete mode 100644 src/main/java/de/hysky/skyblocker/utils/render/gui/BarebonesPopupScreen.java (limited to 'src/main/java/de/hysky/skyblocker/utils/render/gui') diff --git a/src/main/java/de/hysky/skyblocker/utils/render/gui/AbstractPopupScreen.java b/src/main/java/de/hysky/skyblocker/utils/render/gui/AbstractPopupScreen.java new file mode 100644 index 00000000..2bd15955 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/utils/render/gui/AbstractPopupScreen.java @@ -0,0 +1,60 @@ +package de.hysky.skyblocker.utils.render.gui; + +import com.mojang.blaze3d.platform.GlConst; +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +/** + * A more bare-bones version of Vanilla's Popup Screen. Meant to be extended. + */ +public class AbstractPopupScreen extends Screen { + private static final Identifier BACKGROUND_TEXTURE = new Identifier("popup/background"); + private final Screen backgroundScreen; + + protected AbstractPopupScreen(Text title, Screen backgroundScreen) { + super(title); + this.backgroundScreen = backgroundScreen; + } + + @Override + public void close() { + assert this.client != null; + this.client.setScreen(this.backgroundScreen); + } + + @Override + public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { + this.backgroundScreen.render(context, -1, -1, delta); + context.draw(); + RenderSystem.clear(GlConst.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC); + this.renderInGameBackground(context); + } + + /** + * These are the inner positions and size of the popup, not outer + */ + public static void drawPopupBackground(DrawContext context, int x, int y, int width, int height) { + context.drawGuiTexture(BACKGROUND_TEXTURE, x - 18, y - 18, width + 36, height + 36); + } + + @Override + protected void init() { + super.init(); + initTabNavigation(); + } + + @Override + protected void initTabNavigation() { + this.backgroundScreen.resize(this.client, this.width, this.height); + } + + @Override + public void onDisplayed() { + super.onDisplayed(); + this.backgroundScreen.blur(); + } +} \ No newline at end of file diff --git a/src/main/java/de/hysky/skyblocker/utils/render/gui/BarebonesPopupScreen.java b/src/main/java/de/hysky/skyblocker/utils/render/gui/BarebonesPopupScreen.java deleted file mode 100644 index 56b07966..00000000 --- a/src/main/java/de/hysky/skyblocker/utils/render/gui/BarebonesPopupScreen.java +++ /dev/null @@ -1,56 +0,0 @@ -package de.hysky.skyblocker.utils.render.gui; - -import com.mojang.blaze3d.platform.GlConst; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -/** - * A more bare-bones version of Vanilla's Popup Screen. Meant to be extended. - */ -public class BarebonesPopupScreen extends Screen { - private static final Identifier BACKGROUND_TEXTURE = new Identifier("popup/background"); - private final Screen backgroundScreen; - - protected BarebonesPopupScreen(Text title, Screen backgroundScreen) { - super(title); - this.backgroundScreen = backgroundScreen; - } - - @Override - public void close() { - assert this.client != null; - this.client.setScreen(this.backgroundScreen); - } - - @Override - public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { - this.backgroundScreen.render(context, -1, -1, delta); - context.draw(); - RenderSystem.clear(GlConst.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC); - this.renderInGameBackground(context); - } - - /** - * These are the inner positions and size of the popup, not outer - */ - public static void drawPopupBackground(DrawContext context, int x, int y, int width, int height) { - context.drawGuiTexture(BACKGROUND_TEXTURE, x - 18, y - 18, width + 36, height + 36); - } - - @Override - protected void init() { - super.init(); - this.backgroundScreen.resize(this.client, width, height); - - } - - @Override - public void onDisplayed() { - super.onDisplayed(); - this.backgroundScreen.blur(); - } -} \ No newline at end of file -- cgit