From b640363f36ecc753893d8370d4d83696bd4c8d91 Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername <73719631+ThisIsALegitUsername@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:25:29 -0600 Subject: [PATCH] Gui scale warning --- .../java/dev/resent/module/impl/hud/BPS.java | 2 +- .../java/dev/resent/visual/ui/PreVideo.java | 37 +++++++++++++++++++ .../ui/clickgui/rewrite/ClickGuiRewrite.java | 12 +++--- .../net/minecraft/client/gui/GuiOptions.java | 5 ++- .../net/minecraft/client/gui/GuiScreen.java | 5 +++ 5 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 src/main/java/dev/resent/visual/ui/PreVideo.java diff --git a/src/main/java/dev/resent/module/impl/hud/BPS.java b/src/main/java/dev/resent/module/impl/hud/BPS.java index ce6cd75f..d60d30e3 100644 --- a/src/main/java/dev/resent/module/impl/hud/BPS.java +++ b/src/main/java/dev/resent/module/impl/hud/BPS.java @@ -17,7 +17,7 @@ public class BPS extends RenderMod{ } public String getText(){ - return "[BPS: " + new DecimalFormat("0.##").format(getBPS() + "]"); + return "[BPS: " + new DecimalFormat("0.##").format(getBPS()) + "]"; } public void draw(){ diff --git a/src/main/java/dev/resent/visual/ui/PreVideo.java b/src/main/java/dev/resent/visual/ui/PreVideo.java new file mode 100644 index 00000000..8aa027c4 --- /dev/null +++ b/src/main/java/dev/resent/visual/ui/PreVideo.java @@ -0,0 +1,37 @@ +package dev.resent.visual.ui; + +import dev.resent.util.render.Color; +import dev.resent.util.render.RenderUtils; +import net.minecraft.client.gui.GuiOptions; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiVideoSettings; + +public class PreVideo extends GuiScreen{ + + public GuiScreen uwu; + + public PreVideo(GuiScreen from) { + uwu = from; + } + + @Override + protected void mouseClicked(int parInt1, int parInt2, int parInt3) { + if(isMouseInside(parInt1, parInt2, width/2-50, height/2+40, width/2+50, height/2+70)) { + this.mc.displayGuiScreen(new GuiOptions(uwu, mc.gameSettings)); + }else { + this.mc.displayGuiScreen(new GuiVideoSettings(this, mc.gameSettings)); + } + } + + @Override + public void drawScreen(int i, int j, float var3) { + this.drawDefaultBackground(); + drawCenteredString(mc.fontRendererObj, "Don't use Auto gui scale! Resent looks best with normal or large gui scales.", width/2, height/2, -1); + drawCenteredString(mc.fontRendererObj, "Press anywhere to continue. Or, go", width/2, height/2+19, -1); + RenderUtils.drawRoundedRect(width/2-50, height/2+40, width/2+50, height/2+70, 4, isMouseInside(i, j, width/2-50, height/2+40, width/2+50, height/2+70) ? new Color(40, 40, 40).getRGB() : new Color(21, 21, 21).getRGB()); + drawCenteredString(mc.fontRendererObj, "Back", width/2, height/2+51, -1); + } + + + +} diff --git a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java index b86ab4b7..1276f1a7 100644 --- a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java +++ b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java @@ -124,7 +124,6 @@ public class ClickGuiRewrite extends GuiScreen { mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/gear2.png")); Gui.drawModalRectWithCustomSizedTexture(x+width-60, (int) y+140+offset+scrollOffset, 0, 0, 20, 20, 20, 20); } - //RenderUtils.drawRoundedRect(x+width-60, y+140+offset, x+width-40, y+160+offset, 4, -1); //Toggle RenderUtils.drawRoundedRect(x+100, y+135+offset+scrollOffset, x+130, y+165+offset+scrollOffset, 8, m.isEnabled() ? onSurfaceColor : new Color(66, 66, 66).getRGB()); @@ -301,12 +300,13 @@ public class ClickGuiRewrite extends GuiScreen { } super.handleMouseInput(); } - - public boolean isMouseInside(double mouseX, double mouseY, double x, double y, double width, double height) { - return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height); - } - + public int getMaxScroll() { return Resent.INSTANCE.modManager.modules.size() * -53; } + + @Override + public void onGuiClosed() { + mc.gameSettings.saveOptions(); + } } \ No newline at end of file diff --git a/src/main/java/net/minecraft/client/gui/GuiOptions.java b/src/main/java/net/minecraft/client/gui/GuiOptions.java index 5c3ee9e1..96826846 100644 --- a/src/main/java/net/minecraft/client/gui/GuiOptions.java +++ b/src/main/java/net/minecraft/client/gui/GuiOptions.java @@ -1,5 +1,6 @@ package net.minecraft.client.gui; +import dev.resent.visual.ui.PreVideo; import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.vfs.SYS; import net.minecraft.client.audio.PositionedSoundRecord; @@ -34,7 +35,7 @@ public class GuiOptions extends GuiScreen implements GuiYesNoCallback { private static final GameSettings.Options[] field_146440_f = new GameSettings.Options[] { GameSettings.Options.FOV }; private final GuiScreen field_146441_g; - private final GameSettings game_settings_1; + public final GameSettings game_settings_1; private GuiButton field_175357_i; private GuiLockIconButton field_175356_r; protected String field_146442_a = "Options"; @@ -161,7 +162,7 @@ public class GuiOptions extends GuiScreen implements GuiYesNoCallback { if (parGuiButton.id == 101) { this.mc.gameSettings.saveOptions(); - this.mc.displayGuiScreen(new GuiVideoSettings(this, this.game_settings_1)); + this.mc.displayGuiScreen(new PreVideo(field_146441_g)); } if (parGuiButton.id == 100) { diff --git a/src/main/java/net/minecraft/client/gui/GuiScreen.java b/src/main/java/net/minecraft/client/gui/GuiScreen.java index a605207b..58cbfa02 100644 --- a/src/main/java/net/minecraft/client/gui/GuiScreen.java +++ b/src/main/java/net/minecraft/client/gui/GuiScreen.java @@ -558,6 +558,11 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback { private void openWebLink(String parURI) { EagRuntime.openLink(parURI); } + + public boolean isMouseInside(double mouseX, double mouseY, double x, double y, double width, double height) { + return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height); + } + /**+ * Returns true if either windows ctrl key is down or if either