2.3 KiB
2.3 KiB
Compiling Eaglercraft with support for EFI
In recent updates of eaglercraft, compiling for EaglerForgeInjector has become a great deal more complicated. To enable reflection and disable obfuscation, follow these steps once you have an EaglercraftX workspace set up:
- In any files named
build.gradle, set theobfuscateproperty tofalse. - In any files named
build.gradle, find any code that looks like this:
and delete it.tasks.named("generateJavaScript") { doLast { // NOTE: This step may break at any time, and is not required for 99% of browsers def phile = file(folder + "/" + name) def dest = phile.getText("UTF-8") def i = dest.substring(0, dest.indexOf("=\$rt_globals.Symbol('jsoClass');")).lastIndexOf("let ") dest = dest.substring(0, i) + "var" + dest.substring(i + 3) def j = dest.indexOf("function(\$rt_globals,\$rt_exports){") dest = dest.substring(0, j + 34) + "\n" + file(folder + "/ES6ShimScript.txt").getText("UTF-8") + "\n" + dest.substring(j + 34) phile.write(dest, "UTF-8") } } - Inside of the
src/teavm/java/net/lax1dude/eaglercraft/v1_8/internal/teavm/folder, create a new file calledForceReflection.java, with these contents:package net.lax1dude.eaglercraft.v1_8.internal.teavm; public class ForceReflection { public static Object myObject; public static Object forceInit(Class iClass) { myObject = new ReflectiveClass(); try { myObject = iClass.newInstance(); } catch (Exception e) { // TODO: handle exception } return myObject; } public static class ReflectiveClass { } } - In the same folder, edit
MainClass.javaedit the start of themain(String[] args)method to look like this:public static void main(String[] args) { ForceReflection.forceInit(ForceReflection.class); if(args.length == 1) { //... rest of method - Finally, build an offline download by using
CompileJS.bat/CompileJS.shand thenMakeOfflineDownload.bat/MakeOfflineDownload.sh. - You can then upload the
EaglercraftX_1.8_Offline_en_US.htmlinto EaglerForgeInjector.