From 6b6b7db2b1ec52adf8f7f5ea0a5d900e67581091 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Sat, 28 Jun 2025 13:43:29 +0800 Subject: [PATCH] small change to static key processing --- core/postinit.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/postinit.js b/core/postinit.js index bde3869..ff85fad 100644 --- a/core/postinit.js +++ b/core/postinit.js @@ -351,12 +351,16 @@ const modapi_postinit = "(" + (() => { return ModAPI.hooks._teavm.$rt_createDoubleArray(size); } + function staticKeyMapper(k) { + return k.split(/(?=[A-Z])/).map(x=>x.toUpperCase()).join("_"); + } + //Proxy to make sure static variables are initialized before access, as well as fixing some issues in 1.12 function makeClinitProxy(staticVariables, clinit) { return new Proxy(staticVariables, { get: function (a, b, c) { clinit(); - return Reflect.get(a, b, c) || Reflect.get(a, b.toUpperCase(), c); + return Reflect.get(a, b, c) || Reflect.get(a, staticKeyMapper(b), c); } }); } diff --git a/package.json b/package.json index e010ea3..58c7175 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eaglerforgeinjector", - "version": "2.7.94", + "version": "2.7.94b", "description": "Advanced modding API injector for unminified, unobfuscated, unsigned eaglercraft builds.", "main": "node.js", "directories": {