diff --git a/docs/apidoc/reflect.md b/docs/apidoc/reflect.md index 2456270..b8bdd88 100644 --- a/docs/apidoc/reflect.md +++ b/docs/apidoc/reflect.md @@ -59,6 +59,9 @@ Each `ReflectClass` has the following methods: - `instanceOf(object: Object)` - Checks if the `object` is an instance of the class. +- `getConstructorByArgs(...argumentNames) : Function` + - Finds a constructor that matches the specified argument names. Eg: + - `ModAPI.reflect.getClassByName("ItemStack").getConstructorByArgs("blockIn", "amount")` ### ReflectMethod Definition diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..9bf260e --- /dev/null +++ b/docs/config.md @@ -0,0 +1,15 @@ +## eaglercraftXOpts and search parameters + +### noInitialModGui +- `processed.html?noInitialModGui=true` +or inside eaglercraftXOpts + +disables the mod gui display on startup + + +### Adding mods +Set eaglercraftXOpts.Mods to an array of mod urls. + +You can also use search parameters, eg: +- `processed.html?mod=https://example.com/mod.js` +- `processed.html?mod=https://example.com/mod.js&mod=https://example.com/mod2.js` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 7ef3dcc..94e63a4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,4 +10,6 @@ EaglerForge Injector is a tool that uses regular expressions to attach itself to [Modding API documentation](apidoc/index.md) -[Compiling the client for EaglerForgeInjector](compiling_client.md) \ No newline at end of file +[Compiling the client for EaglerForgeInjector](compiling_client.md) + +[eaglercraftXopts and search parameters](config.md) \ No newline at end of file diff --git a/examplemods/diamondBlockCustomCraft.js b/examplemods/diamondBlockCustomCraft.js index 28e3b8d..855d441 100644 --- a/examplemods/diamondBlockCustomCraft.js +++ b/examplemods/diamondBlockCustomCraft.js @@ -38,7 +38,7 @@ recipeInternal.push(ingredient); }); - var recipeContents = recipePattern.flatMap(row => ModAPI.util.str(row)); + var recipeContents = recipePattern.map(row => ModAPI.util.str(row)); var recipe = ModAPI.util.makeArray(ObjectClass, recipeContents.concat(recipeInternal)); // Define the output item as diamond_block diff --git a/examplemods/flammable_string.js b/examplemods/flammable_string.js new file mode 100644 index 0000000..5ef822f --- /dev/null +++ b/examplemods/flammable_string.js @@ -0,0 +1,7 @@ +const originalGetBurnTime = ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.tileentity.TileEntityFurnace", "getItemBurnTime")]; +ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.minecraft.tileentity.TileEntityFurnace", "getItemBurnTime")] = function (...args) { + if (args[0].$item === ModAPI.items.string.getRef()) { + return 50; + } + return originalGetBurnTime.apply(this, args); +}; \ No newline at end of file diff --git a/injector.js b/injector.js index 542b126..4190bb6 100644 --- a/injector.js +++ b/injector.js @@ -1,4 +1,4 @@ -globalThis.ModAPIVersion = "v2.4"; +globalThis.ModAPIVersion = "v2.5"; globalThis.doEaglerforge = true; document.querySelector("title").innerText = `EaglerForge Injector ${ModAPIVersion}`; document.querySelector("h1").innerText = `EaglerForge Injector ${ModAPIVersion}`; @@ -296,11 +296,11 @@ var main;(function(){` ` id="game_frame"> \