This commit is contained in:
radmanplays 2024-02-19 13:45:45 +03:30
parent 6ffaa45138
commit 0d2cbcd1cd
7 changed files with 47 additions and 15 deletions

View File

@ -20,12 +20,13 @@
> DELETE 1 @ 1 : 4 > DELETE 1 @ 1 : 4
> CHANGE 1 : 54 @ 1 : 4 > CHANGE 1 : 55 @ 1 : 4
~ ~
~ import net.eaglerforge.EaglerForge; ~ import net.eaglerforge.EaglerForge;
~ import net.eaglerforge.api.ModAPI; ~ import net.eaglerforge.api.ModAPI;
~ import net.eaglerforge.api.ModData; ~ import net.eaglerforge.api.ModData;
~ import net.eaglerforge.api.ModLoader;
~ import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput; ~ import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput;
~ ~
~ import org.apache.commons.lang3.Validate; ~ import org.apache.commons.lang3.Validate;
@ -300,7 +301,13 @@
+ this.displayGuiScreen(new GuiScreenEditProfile(mainMenu)); + this.displayGuiScreen(new GuiScreenEditProfile(mainMenu));
+ +
> DELETE 3 @ 3 : 15 > DELETE 3 @ 3 : 6
> CHANGE 1 : 4 @ 1 : 9
~ ModLoader.loadLoader();
~ ModLoader.loadModsFromLocalStorage();
~ ModLoader.loadMods(ModLoader.Mods);
> CHANGE 16 : 17 @ 16 : 24 > CHANGE 16 : 17 @ 16 : 24

View File

@ -9,7 +9,7 @@
~ eaglercraft.recording.unsupported=Recording Unsupported! ~ eaglercraft.recording.unsupported=Recording Unsupported!
~ eaglercraft.recording.stop=Stop Recording ~ eaglercraft.recording.stop=Stop Recording
~ eaglercraft.recording.start=reen... ~ eaglercraft.recording.start=Record Screen...
~ eaglercraft.soundCategory.voice=Voice ~ eaglercraft.soundCategory.voice=Voice
> INSERT 1 : 202 @ 1 > INSERT 1 : 202 @ 1

View File

@ -4,7 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import org.teavm.jso.JSBody; import org.teavm.jso.JSBody;
import net.eaglerforge.gui.ModLoader; import net.eaglerforge.api.ModLoader;
public class EaglerForge { public class EaglerForge {
public static final Logger log = LogManager.getLogger(); public static final Logger log = LogManager.getLogger();
@ -24,6 +24,5 @@ public class EaglerForge {
public static void init() { public static void init() {
log.info("Starting EaglerForge!"); log.info("Starting EaglerForge!");
log.info("Loading Mods..."); log.info("Loading Mods...");
ModLoader.loadLoader();
} }
} }

View File

@ -60,6 +60,10 @@ public class ModAPI {
this.mc = mcIn; this.mc = mcIn;
requiredList = new ArrayList<String>(); requiredList = new ArrayList<String>();
initAPI(version); initAPI(version);
newEvent("load");
newEvent("gui");
newEvent("update"); newEvent("update");
globalsFunctor(this); globalsFunctor(this);
globalsRequireFunctor(this); globalsRequireFunctor(this);
@ -81,8 +85,6 @@ public class ModAPI {
setGlobal("mcinstance", mc); setGlobal("mcinstance", mc);
setGlobal("platform", PlatformAPI.makeModData()); setGlobal("platform", PlatformAPI.makeModData());
setGlobal("logger", LoggerAPI.makeModData()); setGlobal("logger", LoggerAPI.makeModData());
/*getModAPI().setCallbackVoidWithDataArg("drawStringWithShadow", (BaseData params) -> { /*getModAPI().setCallbackVoidWithDataArg("drawStringWithShadow", (BaseData params) -> {
mc.ingameGUI.getFontRenderer().drawStringWithShadow(params.getString("msg"), params.getFloat("x"), params.getFloat("y"), params.getInt("color")); mc.ingameGUI.getFontRenderer().drawStringWithShadow(params.getString("msg"), params.getFloat("x"), params.getFloat("y"), params.getInt("color"));
});*/ });*/

View File

@ -0,0 +1,27 @@
package net.eaglerforge.api;
import org.teavm.jso.JSBody;
public class ModLoader {
public static String[] Mods = {};
@JSBody(params = { "Mods" }, script = "window.ModLoader(Mods);")
public static native void loadMods(String[] Mods);
@JSBody(params = {}, script = "loadLoader();")
public static native void loadLoader();
@JSBody(params = { "Mods" }, script = "localStorage.setItem('ml::Mods', JSON.stringify(Mods))")
private static native void saveMods(String[] Mods);
@JSBody(params = {}, script = "try { return JSON.parse(localStorage.getItem('ml::Mods')||'[]') } catch(err) {return []}")
private static native String[] retrieveMods();
public static void saveModsToLocalStorage() {
saveMods(Mods);
};
public static void loadModsFromLocalStorage() {
Mods = retrieveMods();
};
}

View File

@ -7,7 +7,7 @@ import org.teavm.jso.JSBody;
public class PlatformAPI { public class PlatformAPI {
@JSBody(params = { }, script = "return navigator.platform;") @JSBody(params = { }, script = "return navigator.platform;")
public static native boolean getplatformOS(); public static native void getplatformOS();
public static ModData makeModData() { public static ModData makeModData() {
ModData platformGlobal = new ModData(); ModData platformGlobal = new ModData();
platformGlobal.setCallbackBoolean("isOfflineDownload", () -> { platformGlobal.setCallbackBoolean("isOfflineDownload", () -> {
@ -31,15 +31,12 @@ public class PlatformAPI {
platformGlobal.setCallbackBoolean("recSupported", () -> { platformGlobal.setCallbackBoolean("recSupported", () -> {
return EagRuntime.recSupported(); return EagRuntime.recSupported();
}); });
platformGlobal.setCallbackString("getRecText", () -> {
return EagRuntime.getRecText();
});
platformGlobal.setCallbackVoid("toggleRec", () -> { platformGlobal.setCallbackVoid("toggleRec", () -> {
EagRuntime.toggleRec(); EagRuntime.toggleRec();
}); });
platformGlobal.setCallbackBoolean("getPlatformOS", () -> { platformGlobal.setCallbackVoid("getPlatformOS", () -> {
//return EagRuntime.getPlatformOS(); //return EagRuntime.getPlatformOS();
return getplatformOS(); getplatformOS();
}); });
return platformGlobal; return platformGlobal;
} }

View File

@ -11,7 +11,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork: /// Customize these to fit your fork:
public static final String projectForkName = "EaglerForge"; public static final String projectForkName = "EaglerForge";
public static final String projectForkVersion = "v1"; public static final String projectForkVersion = "v1.1";
public static final String projectForkVendor = "radmanplays"; public static final String projectForkVendor = "radmanplays";
public static final String projectForkURL = "https://github.com/eaglerforge/EaglerForge"; public static final String projectForkURL = "https://github.com/eaglerforge/EaglerForge";