Port clickgui. SPEND 2 FUCKING HOURS OF MY LIFE TRYING TO FIGURE OUT MINECRAFT'S DUMBASS SAVING SYSTEM

This commit is contained in:
ThisIsALegitUsername 2022-12-28 20:33:42 +00:00
parent 94d80d4efb
commit 1fbd94e241
15 changed files with 88180 additions and 86453 deletions

View File

@ -1,18 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<classpathentry output="bin/main" kind="src" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/teavm/java">
<classpathentry output="bin/main" kind="src" 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,29 +2,27 @@
<projectDescription>
<name>eaglercraft-workspace</name>
<comment></comment>
<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>
<projects/>
<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>0</id>
<name></name>
<id>1</id>
<type>30</type>
<name/>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>

View File

@ -1,5 +1,5 @@
#
#Tue Dec 27 19:12:33 UTC 2022
#Wed Dec 28 20:02:09 UTC 2022
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,9 @@
package dev.resent;
import java.util.ArrayList;
import java.util.List;
import dev.resent.event.impl.Event;
import dev.resent.module.base.ModManager;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.setting.ModeSetting;
import net.kyori.event.EventBus;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.NBTTagCompound;
public class Resent {
@ -32,80 +25,6 @@ public class Resent {
//modManager = new ModManager();
}
/* Save & load settings */
public void saveSettings(NBTTagCompound yee) {
for (int i = 0; i < modManager.modules.size(); i++) {
List<RenderModule> renderModules = new ArrayList<>();
if (modManager.modules.get(i) instanceof RenderModule) {
renderModules.add((RenderModule) modManager.modules.get(i));
}
yee.setBoolean(modManager.modules.get(i).name + "_isEnabled", modManager.modules.get(i).enabled);
for (int o = 0; o < renderModules.size(); o++) {
yee.setInteger(renderModules.get(o).name + "_x", renderModules.get(o).x);
yee.setInteger(renderModules.get(o).name + "_y", renderModules.get(o).y);
yee.setInteger(renderModules.get(o).name + "_lastX", renderModules.get(o).lastX);
yee.setInteger(renderModules.get(o).name + "_lastY", renderModules.get(o).lastY);
}
for (int x = 0; x < modManager.modules.get(i).settings.size(); x++) {
/*if (s instanceof NumberSetting) {
yee.setFloat(modManager.modules.get(i).name + "_NumberSetting_" + s.name, ((NumberSetting) s).getValue());
}*/
if(modManager.modules.get(i).settings.get(x) instanceof ModeSetting){
yee.setString(modManager.modules.get(i).name + "_ModeSetting_" + modManager.modules.get(i).settings.get(x).name, ((ModeSetting) modManager.modules.get(i).settings.get(x)).getValue());
}
if (modManager.modules.get(i).settings.get(x) instanceof BooleanSetting) {
yee.setBoolean(modManager.modules.get(i).name + "_BoolSetting_" + modManager.modules.get(i).settings.get(x).name, ((BooleanSetting) modManager.modules.get(i).settings.get(x)).getValue());
}
}
}
}
public void loadSettings(NBTTagCompound yee) {
modManager = new ModManager();
for (int i = 0; i < modManager.modules.size(); i++) {
List<RenderModule> renderModules = new ArrayList<>();
if (modManager.modules.get(i) instanceof RenderModule) {
renderModules.add((RenderModule) modManager.modules.get(i));
}
for (int r = 0; r < renderModules.size(); r++) {
if (yee.hasKey(renderModules.get(r).name + "_x"))
renderModules.get(r).x = yee.getInteger(renderModules.get(r).name + "_x");
if(yee.hasKey(renderModules.get(r).name + "_y"))
renderModules.get(r).y = yee.getInteger(renderModules.get(r).name + "_y");
if(yee.hasKey(renderModules.get(r).name + "lastX"))
renderModules.get(r).lastX = yee.getInteger(renderModules.get(r).name + "_lastX");
if(yee.hasKey(renderModules.get(r).name + "lastY"))
renderModules.get(r).lastY = yee.getInteger(renderModules.get(r).name + "_lastY");
}
if (yee.hasKey(modManager.modules.get(i).name + "_isEnabled")) modManager.modules.get(i).setEnabled(yee.getBoolean(modManager.modules.get(i).name + "_isEnabled"));
for (int x = 0; x < modManager.modules.get(i).settings.size(); x++) {
/*if (s instanceof NumberSetting) {
if (yee.hasKey(modManager.modules.get(i).name + "_NumberSetting_" + s.name))
((NumberSetting) s).setValue(yee.getFloat(modManager.modules.get(i).name + "_NumberSetting_" + s.name));
}*/
if (modManager.modules.get(i).settings.get(x) instanceof ModeSetting) {
if (yee.hasKey(modManager.modules.get(i).name + "_ModeSetting_" + modManager.modules.get(i).settings.get(x).name))
((ModeSetting) modManager.modules.get(i).settings.get(x))
.setValue(yee.getString(modManager.modules.get(i).name + "_ModeSetting_"
+ modManager.modules.get(i).settings.get(x).name));
}
if (modManager.modules.get(i).settings.get(x) instanceof BooleanSetting) {
if (yee.hasKey(modManager.modules.get(i).name + "_BoolSetting_" + modManager.modules.get(i).settings.get(x).name))
((BooleanSetting) modManager.modules.get(i).settings.get(x)).setValue(yee.getBoolean(modManager.modules.get(i).name + "_BoolSetting_" + modManager.modules.get(i).settings.get(x).name));
}
}
}
}
public EventBus<Event> events() {
return eventBus;
}

View File

@ -1,5 +1,7 @@
package dev.resent.ui.mods;
import java.io.IOException;
import dev.resent.Resent;
import dev.resent.module.base.Mod;
import dev.resent.setting.BooleanSetting;
@ -13,12 +15,10 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.MathHelper;
public class ClickGUI extends GuiScreen {
public ScaledResolution sr;
public Mod modWatching = null;
public int x, y, width, height;
public int offset = 0;
@ -31,12 +31,11 @@ public class ClickGUI extends GuiScreen {
int xo = 0;
int xy = -30;
sr = new ScaledResolution(mc);
fr = Minecraft.getMinecraft().fontRendererObj;
width = GuiScreen.width - x;
height = GuiScreen.height - y;
x = sr.getScaledWidth() / 8 + xo;
y = sr.getScaledHeight() / (int) 1.1 - 10 + xy;
x = mc.displayWidth / 8 + xo;
y = mc.displayHeight / (int) 1.1 - 10 + xy;
int off = 0;
for (int i = 0; i < Resent.INSTANCE.modManager.modules.size(); i++) {
@ -102,12 +101,11 @@ public class ClickGUI extends GuiScreen {
int xo = 0;
int xy = -30;
sr = new ScaledResolution(mc);
fr = Minecraft.getMinecraft().fontRendererObj;
width = GuiScreen.width - x;
height = GuiScreen.height - y;
x = sr.getScaledWidth() / 8 + xo;
y = sr.getScaledHeight() / (int) 1.1 - 10 + xy;
x = mc.displayWidth / 8 + xo;
y = mc.displayHeight / (int) 1.1 - 10 + xy;
int off = 0;
// background
@ -153,9 +151,8 @@ public class ClickGUI extends GuiScreen {
: new Color(211, 211, 211, 65).getRGB());
if (Resent.INSTANCE.modManager.modules.get(i).hasSetting) {
//Setting icon
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,
@ -264,23 +261,17 @@ public class ClickGUI extends GuiScreen {
}
}.start();
}
try {
super.handleMouseInput();
} catch (IOException e) {
e.printStackTrace();
}
}
offset = MathHelper.clamp_int(MathHelper.clamp_int(offset, 0, getListMaxScroll()), 0, getListMaxScroll());
}
private int getListMaxScroll() {
/*
* int mods = 0;
* int i = 0;
* for (int z = 0; z < Resent.INSTANCE.modManager.modules.size(); z++) {
* Mod m = Resent.INSTANCE.modManager.modules.get(z);
* if (m.name.toLowerCase().contains(this.searchString.toLowerCase())) {
* mods++;
* i++;
* }
* }
*/
return 60 + 70 - this.height;
}
}
}

View File

@ -5,6 +5,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -16,7 +17,12 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import dev.resent.Resent;
import dev.resent.module.base.Mod;
import dev.resent.module.base.ModManager;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.setting.ModeSetting;
import dev.resent.setting.Setting;
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
@ -676,11 +682,14 @@ public class GameSettings {
}
}
public ModManager modManager;
/**+
* Loads the options from the options file. It appears that this
* has replaced the previous 'loadOptions'
*/
public void loadOptions() {
modManager = new ModManager();
try {
byte[] options = EagRuntime.getStorage("g");
if (options == null) {
@ -694,7 +703,44 @@ public class GameSettings {
while ((s = bufferedreader.readLine()) != null) {
try {
String[] 5astring = s.split(":");
String[] astring = s.split(":");
for(Mod m : modManager.modules){
List<RenderModule> rmodules = new ArrayList<>();
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
for(RenderModule rmod : rmodules){
if(astring[0].equals(rmod.name+"x")){
rmod.x=Integer.parseInt(astring[1]);
}
if(astring[0].equals(rmod.name+"y")){
rmod.y=Integer.parseInt(astring[1]);
}
if(astring[0].equals(rmod.name+"lastx")){
rmod.lastX=Integer.parseInt(astring[1]);
}
if(astring[0].equals(rmod.name+"lasty")){
rmod.lastY=Integer.parseInt(astring[1]);
}
}
for(Setting se : m.settings){
if(se instanceof ModeSetting){
if(astring[0].equals(m.name+"modesetting"+se.name)){
((ModeSetting)se).setValue(astring[1]);
}
if(astring[0].equals(m.name+"boolsetting"+se.name)){
((BooleanSetting)se).setValue(astring[1].equals("true"));
}
}
}
if(astring[0].equals(m.name)){
m.setEnabled(astring[1].equals("true"));
}
}
if (astring[0].equals("mouseSensitivity")) {
this.mouseSensitivity = this.parseFloat(astring[1]);
}
@ -994,7 +1040,6 @@ public class GameSettings {
}
}
Resent.INSTANCE.loadSettings();
for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values()) {
if (astring[0].equals("modelPart_" + enumplayermodelparts.getPartName())) {
@ -1027,6 +1072,31 @@ public class GameSettings {
try {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(EaglerZLIB.newGZIPOutputStream(bao)));
for(Mod m : modManager.modules){
List<RenderModule> rmodules = new ArrayList<>();
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
for(RenderModule rmod : rmodules){
printwriter.println(rmod.name+"x:"+rmod.x);
printwriter.println(rmod.name+"y:"+rmod.y);
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
}
for(Setting s : m.settings){
if(s instanceof ModeSetting){
printwriter.println(m.name+"modesetting"+s.name+":"+((ModeSetting) s).getValue());
}
if(s instanceof BooleanSetting){
printwriter.println(m.name+"boolsetting"+s.name+":"+((BooleanSetting) s).getValue());
}
}
printwriter.println(m.name + ":" + m.enabled);
}
printwriter.println("invertYMouse:" + this.invertMouse);
printwriter.println("mouseSensitivity:" + this.mouseSensitivity);
printwriter.println("fov:" + (this.fovSetting - 70.0F) / 40.0F);