last commit until v1.2

This commit is contained in:
radmanplays 2024-02-22 16:39:44 +03:30
parent a192c8ff64
commit 30670ce446
9 changed files with 96 additions and 33 deletions

View File

@ -5,8 +5,13 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 4 : 5 @ 4 : 5
> INSERT 2 : 4 @ 2
~ return "eagler";
+ import static net.lax1dude.eaglercraft.v1_8.EaglercraftVersion.projectForkName;
+
> CHANGE 2 : 3 @ 2 : 3
~ return projectForkName;
> EOF

View File

@ -20,10 +20,11 @@
> DELETE 1 @ 1 : 4
> CHANGE 1 : 55 @ 1 : 4
> CHANGE 1 : 56 @ 1 : 4
~
~ import net.eaglerforge.EaglerForge;
~ import net.eaglerforge.api.BaseData;
~ import net.eaglerforge.api.ModAPI;
~ import net.eaglerforge.api.ModData;
~ import net.eaglerforge.api.ModLoader;
@ -613,8 +614,17 @@
~ DebugFramebufferView.switchView(1);
~ }
> CHANGE 5 : 6 @ 5 : 6
> CHANGE 5 : 15 @ 5 : 6
~ ModData event = new ModData();
~ event.set("key", k);
~ event.set("preventDefault", false);
~ BaseData newEvent = ModAPI.callEvent("key", event);
~
~ if (newEvent.has("preventDefault") && newEvent.getBoolean("preventDefault")) {
~ return;
~ }
~ k = newEvent.has("key") ? newEvent.getInt("key") : k;
~ if (k == 1 || (k > -1 && k == this.gameSettings.keyBindClose.getKeyCode())) {
> INSERT 11 : 18 @ 11

View File

@ -5,7 +5,11 @@
# Version: 1.0
# Author: lax1dude
> DELETE 2 @ 2 : 3
> CHANGE 2 : 5 @ 2 : 3
~ import static net.eaglerforge.api.ModLoader.returntotalloadedmods;
~ import static net.lax1dude.eaglercraft.v1_8.EaglercraftVersion.*;
~
> DELETE 3 @ 3 : 4
@ -51,9 +55,10 @@
> DELETE 3 @ 3 : 5
> CHANGE 4 : 5 @ 4 : 11
> CHANGE 4 : 6 @ 4 : 11
~ import net.eaglerforge.gui.ModGUI;
~ import org.teavm.jso.JSBody;
> DELETE 2 @ 2 : 3
@ -160,13 +165,12 @@
~ this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 + 24, 98, 20,
> CHANGE 1 : 10 @ 1 : 5
> CHANGE 1 : 9 @ 1 : 5
~ this.buttonList.add(new GuiButton(4, this.width / 2 + 2, i + 72 + 24, 98, 20,
~ I18n.format("menu.editProfile", new Object[0])));
~
~ this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 24));
~
~ if (isFork) {
~ this.openGLWarning1 = EaglercraftVersion.mainMenuStringE;
~ this.openGLWarning2 = EaglercraftVersion.mainMenuStringF;

View File

@ -9,9 +9,10 @@
> DELETE 1 @ 1 : 3
> INSERT 4 : 20 @ 4
> INSERT 4 : 21 @ 4
+
+ import net.eaglerforge.gui.ModGUI;
+ import org.apache.commons.lang3.StringUtils;
+
+ import com.google.common.base.Splitter;
@ -45,20 +46,22 @@
~ private String clickedLinkURI;
~ protected long showingCloseKey = 0;
> INSERT 10 : 40 @ 10
> CHANGE 10 : 21 @ 10 : 17
~ long millis = System.currentTimeMillis();
~ long closeKeyTimeout = millis - showingCloseKey;
~ if (closeKeyTimeout < 3000l) {
~ int alpha1 = 0xC0000000;
~ int alpha2 = 0xFF000000;
~ if (closeKeyTimeout > 2500l) {
~ float f = (float) (3000l - closeKeyTimeout) * 0.002f;
~ if (f < 0.03f)
~ f = 0.03f;
~ alpha1 = (int) (f * 192.0f) << 24;
~ alpha2 = (int) (f * 255.0f) << 24;
> INSERT 1 : 17 @ 1
+ long millis = System.currentTimeMillis();
+ long closeKeyTimeout = millis - showingCloseKey;
+ if (closeKeyTimeout < 3000l) {
+ int alpha1 = 0xC0000000;
+ int alpha2 = 0xFF000000;
+ if (closeKeyTimeout > 2500l) {
+ float f = (float) (3000l - closeKeyTimeout) * 0.002f;
+ if (f < 0.03f)
+ f = 0.03f;
+ alpha1 = (int) (f * 192.0f) << 24;
+ alpha2 = (int) (f * 255.0f) << 24;
+ }
+ String str;
+ int k = getCloseKey();
+ if (k == KeyboardConstants.KEY_GRAVE) {
@ -75,10 +78,8 @@
+ fontRendererObj.drawStringWithShadow(str, x + 2, y + 2, 0xFFAAAA | alpha2);
+ if (closeKeyTimeout > 2500l)
+ GlStateManager.disableBlend();
+ }
+
> CHANGE 2 : 14 @ 2 : 4
> CHANGE 4 : 23 @ 4 : 9
~ protected int getCloseKey() {
~ if (this instanceof GuiContainer) {
@ -92,16 +93,26 @@
~ if (((this.mc.theWorld == null || this.mc.thePlayer.getHealth() <= 0.0F) && parInt1 == 1)
~ || parInt1 == this.mc.gameSettings.keyBindClose.getKeyCode()
~ || (parInt1 == 1 && (this.mc.gameSettings.keyBindClose.getKeyCode() == 0 || this.mc.areKeysLocked()))) {
~ if (!ModGUI.isGuiOpen()) {
~ this.mc.displayGuiScreen((GuiScreen) null);
~ if (this.mc.currentScreen == null) {
~ this.mc.setIngameFocus();
~ }
~ } else {
~ ModGUI.closeGui();
> INSERT 4 : 6 @ 4
> CHANGE 1 : 3 @ 1 : 3
+ } else if (parInt1 == 1) {
+ showingCloseKey = System.currentTimeMillis();
~ } else if (parInt1 == 1) {
~ showingCloseKey = System.currentTimeMillis();
> DELETE 1 @ 1 : 2
> INSERT 1 : 2 @ 1
> CHANGE 3 : 4 @ 3 : 13
+ }
> CHANGE 1 : 3 @ 1 : 2
~ public static String getClipboardString() {
~ return EagRuntime.getClipboard();
> CHANGE 4 : 5 @ 4 : 11

View File

@ -5,9 +5,12 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
public class LoggerAPI {
public static final Logger log = LogManager.getLogger();
public static Logger log = LogManager.getLogger();
public static ModData makeModData() {
ModData loggerGlobal = new ModData();
loggerGlobal.setCallbackVoidWithDataArg("setlogger", (BaseData params) -> {
log = LogManager.getLogger(params.getString("name"));
});
loggerGlobal.setCallbackVoidWithDataArg("loginfo", (BaseData params) -> {
log.info(params.getString("string"));
});

View File

@ -14,8 +14,11 @@ import net.eaglerforge.EaglerForge;
import java.util.ArrayList;
import static net.lax1dude.eaglercraft.v1_8.EaglercraftVersion.projectForkVersion;
import static net.minecraft.client.Minecraft.getDebugFPS;
import net.minecraft.client.gui.Gui;
public class ModAPI {
private static Minecraft mc;
public ArrayList<String> requiredList;
public static final Logger log = LogManager.getLogger();
@ -65,6 +68,7 @@ public class ModAPI {
newEvent("load");
newEvent("gui");
newEvent("drawhud");
newEvent("key");
newEvent("update");
globalsFunctor(this);
@ -82,6 +86,9 @@ public class ModAPI {
getModAPI().setCallbackVoid("rightClickMouse", () -> {
mc.rightClickMouse();
});
getModAPI().setCallbackVoid("getFPS", () -> {
getDebugFPS();
});
getModAPI().set("clientBrand", ClientBrandRetriever.getClientModName());
setGlobal("mcinstance", mc);
@ -103,6 +110,9 @@ public class ModAPI {
getModAPI().setCallbackVoidWithDataArg("drawString", (BaseData params) -> {
mc.fontRendererObj.drawString(params.getString("msg"), params.getFloat("x"), params.getFloat("y"), params.getInt("color"), false);
});
getModAPI().setCallbackVoidWithDataArg("drawRect", (BaseData params) -> {
Gui.drawRect(params.getInt("left"), params.getInt("top"), params.getInt("right"), params.getInt("bottom"), params.getInt("color"));
});
ModGUI.loadFont();
}
static void globalsFunctor(ModAPI modAPI) {
@ -123,6 +133,7 @@ public class ModAPI {
});
}
public void onUpdate() {
ModAPI.callEvent("update", new ModData());
}

View File

@ -17,6 +17,10 @@ public class ModLoader {
@JSBody(params = {}, script = "try { return JSON.parse(localStorage.getItem('ml::Mods')||'[]') } catch(err) {return []}")
private static native String[] retrieveMods();
@JSBody(params = {}, script = "return returntotalloadedmods()")
public static native int returntotalloadedmods();
public static void saveModsToLocalStorage() {
saveMods(Mods);
};

View File

@ -1,6 +1,7 @@
package net.eaglerforge.api;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.minecraft.client.Minecraft;
import org.teavm.jso.JSBody;
@ -40,6 +41,15 @@ public class PlatformAPI {
//return EagRuntime.getPlatformOS();
getplatformOS();
});
platformGlobal.setCallbackVoid("getUserAgentString", () -> {
PlatformRuntime.getUserAgentString();
});
platformGlobal.setCallbackVoid("getGLRenderer", () -> {
PlatformRuntime.getGLRenderer();
});
platformGlobal.setCallbackVoid("getGLVersion", () -> {
PlatformRuntime.getGLVersion();
});
return platformGlobal;
}
}

View File

@ -1,7 +1,11 @@
package net.lax1dude.eaglercraft.v1_8;
import org.teavm.jso.JSBody;
import java.math.BigInteger;
import static net.eaglerforge.api.ModLoader.returntotalloadedmods;
public class EaglercraftVersion {
@ -42,12 +46,13 @@ public class EaglercraftVersion {
// Miscellaneous variables:
public static int loadedmods = returntotalloadedmods();
public static final String mainMenuStringA = "Minecraft* 1.8.8";
public static final String mainMenuStringB = projectForkName + " " + projectForkVersion + " (" + 0 + " Mods loaded)";
public static String mainMenuStringB = projectForkName + " " + projectForkVersion + " (" + loadedmods + " Mods loaded)";
public static final String mainMenuStringC = "";
public static final String mainMenuStringD = "Resources Copyright Mojang AB";
public static final String mainMenuStringE = "based on eaglercraft " + projectOriginVersion;
public static final String mainMenuStringE = "Based on eaglercraft " + projectOriginVersion;
public static final String mainMenuStringF = null;
public static final String mainMenuStringG = "Collector's Edition";