From 458f28ebc402f1af30f4e41d92e71aa5b52103a5 Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername Date: Tue, 7 Mar 2023 22:22:39 +0000 Subject: [PATCH] w --- .../java/dev/resent/client/ClientInfo.java | 7 +- .../visual/ui/{ => clickgui}/ClickGUI.java | 10 +-- .../ui/{ => clickgui}/HUDConfigScreen.java | 2 +- .../visual/ui/{ => clickgui}/PreGUI.java | 2 +- .../ui/clickgui/rewrite/ClickGuiRewrite.java | 65 +++++++++++++++++++ .../visual/ui/clickgui/rewrite/comp/Comp.java | 9 +++ .../java/net/minecraft/client/Minecraft.java | 2 +- .../v1_8/internal/teavm/MainClass.java | 4 +- 8 files changed, 89 insertions(+), 12 deletions(-) rename src/main/java/dev/resent/visual/ui/{ => clickgui}/ClickGUI.java (98%) rename src/main/java/dev/resent/visual/ui/{ => clickgui}/HUDConfigScreen.java (95%) rename src/main/java/dev/resent/visual/ui/{ => clickgui}/PreGUI.java (98%) create mode 100644 src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java create mode 100644 src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/Comp.java diff --git a/src/main/java/dev/resent/client/ClientInfo.java b/src/main/java/dev/resent/client/ClientInfo.java index 32602930..f4b21102 100644 --- a/src/main/java/dev/resent/client/ClientInfo.java +++ b/src/main/java/dev/resent/client/ClientInfo.java @@ -1,11 +1,16 @@ package dev.resent.client; +import dev.resent.util.render.Color; + public class ClientInfo { public static final String name = "Resent"; public static final String version = "3.6"; public static final String author = "Nitwit"; - public static final String release = Release.BETA.name; + public static final String release = Release.STABLE.name; + + public static final int primaryColor = new Color(66, 66, 66).getRGB(); + public static final int secondaryColor = new Color(117, 117, 117).getRGB(); public enum Release { BETA("Beta"), diff --git a/src/main/java/dev/resent/visual/ui/ClickGUI.java b/src/main/java/dev/resent/visual/ui/clickgui/ClickGUI.java similarity index 98% rename from src/main/java/dev/resent/visual/ui/ClickGUI.java rename to src/main/java/dev/resent/visual/ui/clickgui/ClickGUI.java index aee07c6b..1b1e485f 100644 --- a/src/main/java/dev/resent/visual/ui/ClickGUI.java +++ b/src/main/java/dev/resent/visual/ui/clickgui/ClickGUI.java @@ -1,4 +1,4 @@ -package dev.resent.visual.ui; +package dev.resent.visual.ui.clickgui; import java.io.IOException; import java.util.Comparator; @@ -16,6 +16,7 @@ import dev.resent.module.base.setting.Setting; import dev.resent.util.misc.GlUtils; import dev.resent.util.render.Color; import dev.resent.util.render.RenderUtils; +import dev.resent.visual.ui.Theme; import dev.resent.visual.ui.animation.Animation; import dev.resent.visual.ui.animation.Direction; import net.lax1dude.eaglercraft.v1_8.Keyboard; @@ -238,7 +239,7 @@ public class ClickGUI extends GuiScreen { NumberSetting ss = ((NumberSetting)s); fr.drawStringWithShadow(s.name + ": sof " + sliderOffset + ", val: " + ((NumberSetting)s).getValue(), this.x+24, height+41+var, -1); drawRect(width-150, height+43+var, width-45, height+47+var, -1); - RenderUtils.drawRoundedRect(width-150+sliderOffset, height+41+var, width-141+sliderOffset, height+50+var, 4, Color.RED.getRGB()); + RenderUtils.drawRoundedRect(width-150+sliderOffset, height+40+var, width-140+sliderOffset, height+50+var, 4, Color.RED.getRGB()); if(dragging) { sliderOffset = mouseX-(width-150); @@ -251,11 +252,6 @@ public class ClickGUI extends GuiScreen { dragging = false; sliderOffset = 0; } - - if(sliderOffset > 101) { - dragging = false; - sliderOffset = 100; - } } if (s instanceof BooleanSetting) { diff --git a/src/main/java/dev/resent/visual/ui/HUDConfigScreen.java b/src/main/java/dev/resent/visual/ui/clickgui/HUDConfigScreen.java similarity index 95% rename from src/main/java/dev/resent/visual/ui/HUDConfigScreen.java rename to src/main/java/dev/resent/visual/ui/clickgui/HUDConfigScreen.java index b0822951..cc0cb48f 100644 --- a/src/main/java/dev/resent/visual/ui/HUDConfigScreen.java +++ b/src/main/java/dev/resent/visual/ui/clickgui/HUDConfigScreen.java @@ -1,4 +1,4 @@ -package dev.resent.visual.ui; +package dev.resent.visual.ui.clickgui; import dev.resent.client.Resent; import dev.resent.module.base.RenderMod; diff --git a/src/main/java/dev/resent/visual/ui/PreGUI.java b/src/main/java/dev/resent/visual/ui/clickgui/PreGUI.java similarity index 98% rename from src/main/java/dev/resent/visual/ui/PreGUI.java rename to src/main/java/dev/resent/visual/ui/clickgui/PreGUI.java index 81371403..8f382ce4 100644 --- a/src/main/java/dev/resent/visual/ui/PreGUI.java +++ b/src/main/java/dev/resent/visual/ui/clickgui/PreGUI.java @@ -1,4 +1,4 @@ -package dev.resent.visual.ui; +package dev.resent.visual.ui.clickgui; import dev.resent.module.base.ModManager; import dev.resent.util.render.Color; 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 new file mode 100644 index 00000000..a578f0bf --- /dev/null +++ b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java @@ -0,0 +1,65 @@ +package dev.resent.visual.ui.clickgui.rewrite; + +import dev.resent.util.misc.GlUtils; +import dev.resent.visual.ui.Theme; +import dev.resent.visual.ui.animation.Animation; +import dev.resent.visual.ui.animation.Direction; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class ClickGuiRewrite extends GuiScreen{ + + public Animation introAnimation; + public int x, y, width, height; + public ScaledResolution sr; + public boolean closing; + + @Override + public void drawScreen(int mouseX, int mouseY, float var3) { + GlUtils.startScale((this.x + this.width) / 2, (this.y + this.height) / 2, introAnimation != null ? (float) introAnimation.getValue() : 1); + + + + GlUtils.stopScale(); + + if (closing) { + if(introAnimation == null) { + mc.displayGuiScreen(null); + return; + } + + introAnimation.setDirection(Direction.BACKWARDS); + if (introAnimation.isDone(Direction.BACKWARDS)) { + mc.displayGuiScreen(null); + } + } + } + + @Override + protected void mouseClicked(int parInt1, int parInt2, int parInt3) { + + } + + @Override + public void initGui() { + sr = new ScaledResolution(mc); + x = sr.getScaledWidth()/4; + y = sr.getScaledHeight()/4; + width = x + sr.getScaledWidth()/2; + height = y + sr.getScaledHeight()/2; + introAnimation = Theme.getAnimation(Theme.getAnimationId(), 500, 1, 3, 3.8f, 1.35f, false); + } + + @Override + protected void keyTyped(char par1, int par2) { + if (par2 == 0x01 || par2 == Minecraft.getMinecraft().gameSettings.keyBindClickGui.keyCode) { + closing = true; + } + } + + public boolean isMouseInside(double mouseX, double mouseY, double x, double y, double width, double height) { + return (mouseX >= x && mouseX <= width) && (mouseY >= y && mouseY <= height); + } + +} diff --git a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/Comp.java b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/Comp.java new file mode 100644 index 00000000..a36f4499 --- /dev/null +++ b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/Comp.java @@ -0,0 +1,9 @@ +package dev.resent.visual.ui.clickgui.rewrite.comp; + +public abstract class Comp { + + public abstract void draw(); + public void mouseClicked() { } + public int x, y; + +} diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index 4c72dccf..a174099d 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -26,7 +26,7 @@ import com.google.common.collect.Lists; import dev.resent.client.Resent; import dev.resent.module.base.ModManager; import dev.resent.util.misc.W; -import dev.resent.visual.ui.PreGUI; +import dev.resent.visual.ui.clickgui.PreGUI; import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.HString; diff --git a/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/MainClass.java b/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/MainClass.java index 68ecf061..a6d19b81 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/MainClass.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/MainClass.java @@ -19,6 +19,8 @@ import org.teavm.jso.dom.html.HTMLDocument; import org.teavm.jso.dom.html.HTMLElement; import org.teavm.jso.webgl.WebGLRenderingContext; +import dev.resent.client.ClientInfo; + /** * Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved. * @@ -218,7 +220,7 @@ public class MainClass { HTMLElement el = doc.getElementById(configRootElement); StringBuilder str = new StringBuilder(); - str.append("Game Crashed! I have fallen and I can't get up!\n\n"); + str.append(ClientInfo.name + " " + ClientInfo.version + "has crashed! DM this crash message to me on discord, my tag is hooman#1196, along with steps to recreate the crash. \n\n"); str.append(t); str.append('\n').append('\n'); str.append("eaglercraft.version = \"").append(EaglercraftVersion.projectForkVersion).append("\"\n");