ClickGui works 🔥

This commit is contained in:
ThisIsALegitUsername 2022-12-28 20:57:50 +00:00
parent f4535f9028
commit cce53a974c
4 changed files with 33 additions and 80 deletions

View File

@ -1,68 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry output="bin/main" kind="src" path="src/main/java">
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry output="bin/main" kind="src" path="src/teavm/java">
<classpathentry kind="src" output="bin/main" path="src/teavm/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-classlib/0.6.1/ed928987ac8c74c3279dbc00d777ea87155469bc/teavm-classlib-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-classlib/0.6.1/3b0f0cb8c3d879f6dd9d9d0101e0032d57f5fa8/teavm-classlib-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-platform/0.6.1/69815866360883bc945cc2704e01c2aafc1ce296/teavm-platform-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-platform/0.6.1/18dfcd3bf6c2e379e23cf168549585aae98857f/teavm-platform-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso-impl/0.6.1/e39d63686c38ec74d4eaa4d12d5259ac0e8483b9/teavm-jso-impl-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso-impl/0.6.1/b5caec1ba7fed15254b9f8b50340549023cce240/teavm-jso-impl-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso-apis/0.6.1/55274af88c7746aea55fcfef45dc9397228c8a38/teavm-jso-apis-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso-apis/0.6.1/622597700c7debce22e5d0997b649016447d67f7/teavm-jso-apis-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso/0.6.1/78c94b8a7aba6960a5ce43331c66d6c2c5ff968a/teavm-jso-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-jso/0.6.1/9d86da37b45a9c60644818536959459222083936/teavm-jso-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-metaprogramming-impl/0.6.1/aa2d2217e5dd4e612baa393d0a0003a066cd1f16/teavm-metaprogramming-impl-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-metaprogramming-impl/0.6.1/5eab0c2ab199d76b004265af824f36f1706b7d62/teavm-metaprogramming-impl-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-metaprogramming-api/0.6.1/f103f71f184e676b2d7e6f5872e148f7d794a93c/teavm-metaprogramming-api-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-metaprogramming-api/0.6.1/2c3da6a61a58ed2c3d10cf405dffad90488ed6a2/teavm-metaprogramming-api-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/com.jcraft/jzlib/1.1.3/3102d5e0e3e6cdb601b42f7bdcbff13167a2226d/jzlib-1.1.3-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/com.jcraft/jzlib/1.1.3/c01428efa717624f7aabf4df319939dda9646b2d/jzlib-1.1.3.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.7/1fc633cf2a3f5a1767ef28b81ebc5d0ecfa1ffda/joda-time-2.7-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.7/5599707a3eaad13e889f691b3af78c8c03842195/joda-time-2.7.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry sourcepath="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-interop/0.6.1/6f27194568262d33bd82a443632e8d1a778c7c1a/teavm-interop-0.6.1-sources.jar" kind="lib" path="/workspace/.gradle/caches/modules-2/files-2.1/org.teavm/teavm-interop/0.6.1/556d85e513f13e867435c34f2128e79d98995c41/teavm-interop-0.6.1.jar">
<attributes>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
</classpath>

View File

@ -2,27 +2,29 @@
<projectDescription>
<name>eaglercraft-workspace</name>
<comment></comment>
<projects/>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<linkedResources/>
<filteredResources>
<filter>
<id>1</id>
<name></name>
<type>30</type>
<name/>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>

View File

@ -43,10 +43,11 @@ public class Mod {
public void toggle() {
this.enabled = !this.enabled;
if (this.enabled)
if (this.enabled){
onEnable();
else
}else{
onDisable();
}
}
public void setEnabled(boolean state) {

View File

@ -43,12 +43,12 @@ public class ClickGUI extends GuiScreen {
y = sr.getScaledHeight() / (int) 1.1 - 10 + xy;
int off = 0;
for (int i = 0; i < modManager.modules.size(); i++) {
for (Mod m: modManager.modules) {
int fh = fr.FONT_HEIGHT;
if (isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 - 1 - offset, this.x + 90 + xo - 1 + 21, height + 30 - fh * (-off) + 30 - 1 + 2 - 1 - offset) && modManager.modules.get(i).hasSetting) {
if (isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 - 1 - offset, this.x + 90 + xo - 1 + 21, height + 30 - fh * (-off) + 30 - 1 + 2 - 1 - offset) && m.hasSetting) {
// Open settings
this.modWatching = modManager.modules.get(i);
this.modWatching = m;
} else if (isMouseInside(mouseX, mouseY, x - fr.FONT_HEIGHT + 2, height + 27 + fr.FONT_HEIGHT + 2, x - fr.FONT_HEIGHT + 6 + fr.getStringWidth("<"), height + 33 + fr.FONT_HEIGHT + 2 + fr.getStringWidth("<")) && mouseButton == 0) {
// Close settings
this.modWatching = null;
@ -58,7 +58,7 @@ public class ClickGUI extends GuiScreen {
this.modWatching = null;
} else if (isMouseInside(mouseX, mouseY, this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset, this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset) && mouseButton == 0 && modWatching == null) {
// Toggle mod
modManager.modules.get(i).toggle();
m.toggle();
} else if (isMouseInside(mouseX, mouseY, GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-5, GuiScreen.height-y-fr.FONT_HEIGHT, GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2+5+fr.getStringWidth("Edit Layout"), GuiScreen.height-y+5) && mouseButton == 0){
mc.displayGuiScreen(new HUDConfigScreen());
this.modWatching = null;
@ -138,7 +138,7 @@ public class ClickGUI extends GuiScreen {
// white line
Gui.drawRect(x - 8, height + 29, width + 33, height + 30, -1);
for (int i = 0; i < modManager.modules.size(); i++) {
for (Mod m : modManager.modules) {
if (this.modWatching == null) {
int fh = fr.FONT_HEIGHT;
if (height - 2 - fh * -(off) + 50 - 2 - offset > height + 29
@ -147,7 +147,7 @@ public class ClickGUI extends GuiScreen {
// Enabled outline
RenderUtils.drawRectOutline(this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset,
this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset,
modManager.modules.get(i).isEnabled() ? Color.GREEN.getRGB()
m.isEnabled() ? Color.GREEN.getRGB()
: Color.RED.getRGB());
Gui.drawRect(this.x + 10 + xo - 1 + 10, height - 2 - fh * -(off) + 50 - 1 - offset,
this.x + 90 + xo - 1 + 22, height + 30 - fh * (-off) + 30 - 1 + 2 - offset,
@ -157,16 +157,16 @@ public class ClickGUI extends GuiScreen {
? new Color(105, 105, 105, 65).getRGB()
: new Color(211, 211, 211, 65).getRGB());
if (modManager.modules.get(i).hasSetting) {
if (m.hasSetting) {
fr.drawString("o", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, isMouseInside(mouseX, mouseY, this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT) ? new Color(105, 105, 105, 65).getRGB() : -1);
RenderUtils.drawRectOutline(this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT, -1);
//RenderUtils.drawRectOutline(this.x+90+xo-1+10, height-2-fh*-(off)+51+1-offset, this.x+90+xo-1+10+fr.getStringWidth("o"), height-2-fh*-(off)+51+1-offset+fr.FONT_HEIGHT, -1);
//fr.drawString("+", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
//fr.drawString(" x", this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, -1);
// Gui.drawRect(this.x+90+xo-1+10, height-2-fh*-(off)+51-1-offset,
// this.x+90+xo-1+21, height+30-fh*(-off)+30-1+2-1-offset, -1);
}
fr.drawStringWithShadow(modManager.modules.get(i).name,
fr.drawStringWithShadow(m.name,
this.x + 15 + 7 + xo * (int) 1.5, height - fh * -(off) + 50 - offset, -1);
}
} else if (this.modWatching != null) {
@ -179,7 +179,7 @@ public class ClickGUI extends GuiScreen {
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
BooleanSetting b = null;
ModeSetting m = null;
ModeSetting mo = null;
Setting s = this.modWatching.settings.get(amogus);
if (s instanceof BooleanSetting) {
b = (BooleanSetting) s;
@ -189,7 +189,7 @@ public class ClickGUI extends GuiScreen {
}
if (s instanceof ModeSetting) {
m = (ModeSetting) s;
mo = (ModeSetting) s;
//RenderUtils.drawRectOutline(this.x+18+6-2, height-fr.FONT_HEIGHT+50+var, this.x+18+6+fr.getStringWidth(this.modWatching.settings.get(amogus).name + ": " + m.getValue() + 2), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
}
@ -206,7 +206,7 @@ public class ClickGUI extends GuiScreen {
+ 2,
this.height - fr.FONT_HEIGHT + 50 + var + fr.FONT_HEIGHT, -1);*/
//RenderUtils.drawRectOutline(this.x+24, height-fr.FONT_HEIGHT+50+var, this.x+24+fr.getStringWidth(s.name+": "+m.getValue()), height-fr.FONT_HEIGHT+50+var+fr.FONT_HEIGHT, -1);
fr.drawStringWithShadow(s.name + ": " + m.getValue(),
fr.drawStringWithShadow(s.name + ": " + mo.getValue(),
this.x + 18 + 6, height - fr.FONT_HEIGHT + 50 + var, -1);
} else {
fr.drawStringWithShadow(s.name, this.x + 18 + 6,