Rewritten RenderModule class

This commit is contained in:
ThisIsALegitUsername 2023-01-12 00:47:15 +00:00
parent 4b4204cee1
commit 6e70ff3bf1
18 changed files with 89753 additions and 57856 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 @@
#
#Sun Jan 01 10:34:48 MST 2023
#Wed Jan 11 21:59:16 UTC 2023
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

View File

@ -71,8 +71,8 @@ teavm {
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
cacheDirectory = null;
wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
minHeapSize = 104;
maxHeapSize = 128;
minHeapSize = 256;
maxHeapSize = 256;
outOfProcess = false;
processMemory = 1024;
longjmpSupported = true;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -124,22 +124,4 @@ public class ModManager {
this.modules.add(m);
}
public void onKey(int keycode) {
for (int i = 0; i < modules.size(); i++) {
if (keycode == modules.get(i).keyCode && keycode != 0) {
modules.get(i).toggle();
}
}
}
public List<Mod> getModulesByCategory(Category c) {
List<Mod> modules1 = new ArrayList<Mod>();
for (Mod module : modules) {
if (module.category == c) {
modules1.add(module);
}
}
return modules1;
}
}

View File

@ -4,8 +4,6 @@ import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import java.util.Objects;
public class RenderModule extends Mod {
public int x, y, width, height;
@ -29,7 +27,7 @@ public class RenderModule extends Mod {
public void draw() { }
public void Resize() {
public void resize() {
if ((getX() + getWidth()) > GuiScreen.width) {
this.x = GuiScreen.width - getWidth();
dragging = false;
@ -45,56 +43,40 @@ public class RenderModule extends Mod {
}
}
private void draggingFix(int mouseX, int mouseY) {
if (this.dragging && (Objects.equals(ModManager.currentModDragging, this.name) || ModManager.currentModDragging == null)) {
this.x = mouseX + this.lastX;
this.y = mouseY + this.lastY;
if (ModManager.currentModDragging == null)
ModManager.currentModDragging = this.name;
if (!Mouse.isButtonDown(0))
this.dragging = false;
if (Objects.equals(ModManager.currentModDragging, this.name))
ModManager.currentModDragging = null;
if (this.x >= GuiScreen.width - getWidth()) {
this.dragging = false;
if (Objects.equals(ModManager.currentModDragging, this.name))
ModManager.currentModDragging = null;
}
if (this.y >= GuiScreen.height - getHeight()) {
this.dragging = false;
if (Objects.equals(ModManager.currentModDragging, this.name))
ModManager.currentModDragging = null;
}
}
}
private void draggingFix(int mouseX, int mouseY) {
if (this.dragging) {
this.x = mouseX + this.lastX;
this.y = mouseY + this.lastY;
if(!Mouse.isButtonDown(0)) this.dragging = false;
}
}
public void renderLayout(int mouseX, int mouseY) {
Resize();
resize();
draw();
draggingFix(mouseX, mouseY);
boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + getWidth()
&& mouseY < getY() + this.getHeight();
boolean mouseOverX = (mouseX >= this.x && mouseX <= this.x + this.getWidth());
boolean mouseOverY = (mouseY >= this.y && mouseY <= this.y + this.getHeight());
boolean drag = (mouseOverX && mouseOverY && Mouse.isButtonDown(0));
draggingFix(mouseX, mouseY);
Gui.drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), hovered ? 0x50FFFFFF : 0x40FFFFFF);
Gui.drawRect(this.x, this.y, this.x + this.getWidth(), this.y + 1, -1);
Gui.drawRect(this.x, this.y, this.x + 1, this.y + getHeight(), -1);
Gui.drawRect(this.x + this.getWidth() - 1, this.y, this.x + getWidth(), this.y + this.getHeight(), -1);
Gui.drawRect(this.x, this.y + this.getHeight() - 1, this.x + getWidth(), this.y + this.getHeight(), -1);
if (drag && (ModManager.currentModDragging == null || ModManager.currentModDragging.equals(this.name))) {
if (!this.dragging) {
this.lastX = x - mouseX;
this.lastY = y - mouseY;
this.dragging = true;
ModManager.currentModDragging = this.name;
}
}
draw();
Gui.drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), 0x50FFFFFF);
Gui.drawRect(this.x, this.y, this.x + this.getWidth(), this.y + 1, 0xFFFFFFFF);
Gui.drawRect(this.x, this.y, this.x + 1, this.y + getHeight(), 0xFFFFFFFF);
Gui.drawRect(this.x + this.getWidth() - 1, this.y, this.x + getWidth(), this.y + this.getHeight(), 0xFFFFFFFF);
Gui.drawRect(this.x, this.y + this.getHeight() - 1, this.x + getWidth(), this.y + this.getHeight(), 0xFFFFFFFF);
boolean mouseOverX = (mouseX >= this.getX() && mouseX <= this.getX()+this.getWidth());
boolean mouseOverY = (mouseY >= this.getY() && mouseY <= this.getY()+this.getHeight());
if(mouseOverX && mouseOverY){
if(Mouse.isButtonDown(0)){
if (!this.dragging) {
this.lastX = x - mouseX;
this.lastY = y - mouseY;
this.dragging = true;
}
}
}
}
public int getX() {

View File

@ -1347,7 +1347,6 @@ public class Minecraft implements IThreadListener {
this.currentScreen.handleKeyboardInput();
} else {
Resent.INSTANCE.modManager.onKey(Keyboard.getEventKey());
if(Keyboard.getEventKey() == this.gameSettings.keyBindFreelook.keyCode)
W.freelook().smh();