mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 23:04:08 +00:00
Got bridges working for new JSTypeRegistry domains (.d.ts files of each loaded mod)
This commit is contained in:
1 parent
b86c0284ac
commit
f1a968d196
2 files changed
+10
No files matched your search
@@ -20,6 +20,11 @@ public final class DtsJavaBridge {
|
||||
|
||||
private DtsJavaBridge() {}
|
||||
|
||||
public static void clearCache() {
|
||||
METHOD_CACHE.clear();
|
||||
FIELD_CACHE.clear();
|
||||
}
|
||||
|
||||
public static JSMethodInfo findMatchingMethod(Method method, TypeInfo containingType) {
|
||||
JSMethodInfo cached = METHOD_CACHE.get(method);
|
||||
if (cached != null) return cached;
|
||||
@@ -191,6 +196,9 @@ public final class DtsJavaBridge {
|
||||
|
||||
private static JSTypeInfo resolveJSTypeInfo(String javaFqnOrType) {
|
||||
if (javaFqnOrType == null || javaFqnOrType.isEmpty()) return null;
|
||||
if (javaFqnOrType.startsWith("Java.")) {
|
||||
javaFqnOrType = javaFqnOrType.substring(5);
|
||||
}
|
||||
JSTypeRegistry registry = TypeResolver.getInstance().getJSTypeRegistry();
|
||||
JSTypeInfo direct = registry.getTypeByJavaFqn(javaFqnOrType);
|
||||
if (direct != null) return direct;
|
||||
|
||||
+2
@@ -3,6 +3,7 @@ package noppes.npcs.client.gui.util.script.interpreter.js_parser;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.client.gui.util.script.interpreter.bridge.DtsJavaBridge;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
@@ -817,6 +818,7 @@ public class JSTypeRegistry {
|
||||
hooks.clear();
|
||||
contextHooks.clear();
|
||||
globalEngineObjects.clear();
|
||||
DtsJavaBridge.clearCache();
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user