From a89ae85c78db28d58117cc3d365a986b4e95077d Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Wed, 30 Oct 2024 16:39:28 +0800 Subject: [PATCH 1/3] remove metacheck step --- postinit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postinit.js b/postinit.js index 126751f..5122f04 100644 --- a/postinit.js +++ b/postinit.js @@ -291,7 +291,7 @@ globalThis.modapi_postinit = "(" + (() => { }; //Prototype Injection, allows for far easier access to methods - if (typeof item === "function" && item.$meta && ModAPI.hooks._rippedMethodTypeMap[method] === "instance") { + if (typeof item === "function" && ModAPI.hooks._rippedMethodTypeMap[method] === "instance") { item.prototype["$" + method.replace(compiledName + "_", "")] ||= function (...args) { return ModAPI.hooks.methods[method].apply(this, [this, ...args]); } From 2413e901a28b049302a3c50345952ec4ef876c3d Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Wed, 30 Oct 2024 17:10:59 +0800 Subject: [PATCH 2/3] Fix metamap generation --- postinit.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/postinit.js b/postinit.js index 5122f04..52da603 100644 --- a/postinit.js +++ b/postinit.js @@ -216,6 +216,10 @@ globalThis.modapi_postinit = "(" + (() => { block.forEach(item => { if (typeof item === "function") { if (!item.$meta || typeof item.$meta.name !== "string") { + if (item.name && item.name.split("_").length === 2) { + metaMap[item.name] = item; + compiledNames.add(item.name); + } return; } var compiledName = ModAPI.util.getCompiledNameFromPackage(item.$meta.name); @@ -224,6 +228,7 @@ globalThis.modapi_postinit = "(" + (() => { } }); }); + ModAPI.hooks._rippedConstructorKeys.forEach(constructor => { if (typeof constructor === "string" && constructor.length > 0) { From 4779e00f1cc6c3c4931c3b3e0a41393cfe940cfb Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Wed, 30 Oct 2024 17:11:54 +0800 Subject: [PATCH 3/3] bump ver, shift code --- postinit.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/postinit.js b/postinit.js index 52da603..1ad0805 100644 --- a/postinit.js +++ b/postinit.js @@ -21,6 +21,12 @@ globalThis.modapi_postinit = "(" + (() => { ModAPI.meta._iconMap = {}; ModAPI.meta._versionMap = {}; ModAPI.array = {}; + + ModAPI.version = "v2.1.2"; + ModAPI.flavour = "injector"; + ModAPI.GNU = "terry pratchett"; + ModAPI.credits = ["ZXMushroom63", "radmanplays", "Murturtle", "OtterCodes101", "TheIdiotPlays", "OeildeLynx31", "Stpv22"]; + function limitSize(x, n) { if (x.length > n) { return x.substring(0, n) + "…"; @@ -200,10 +206,7 @@ globalThis.modapi_postinit = "(" + (() => { } return ModAPI.hooks._teavm.$rt_createDoubleArray(size); } - ModAPI.version = "v2.1.1"; - ModAPI.flavour = "injector"; - ModAPI.GNU = "terry pratchett"; - ModAPI.credits = ["ZXMushroom63", "radmanplays", "Murturtle", "OtterCodes101", "TheIdiotPlays", "OeildeLynx31", "Stpv22"]; + ModAPI.hooks.regenerateClassMap = function () { ModAPI.hooks._rippedConstructorKeys = Object.keys(ModAPI.hooks._rippedConstructors); ModAPI.hooks._rippedMethodKeys = Object.keys(ModAPI.hooks._rippedMethodTypeMap);