diff --git a/build.gradle b/build.gradle index 2ba5783..e222a67 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' + id 'fabric-loom' version '0.11-SNAPSHOT' id 'maven-publish' id 'java' id "com.github.johnrengelman.shadow" version "6.0.0" @@ -21,6 +21,7 @@ repositories { name "Modmuss50 Repository" url 'https://maven.fabricmc.net/' } + maven { url 'https://maven.terraformersmc.com/releases/' } maven { url 'https://jitpack.io' } maven { url 'https://www.cursemaven.com' } } @@ -43,32 +44,8 @@ dependencies { // https://mvnrepository.com/artifact/org.python/jython-standalone implementation "org.python:jython-standalone:2.7.2" - - //partial fabric api - modImplementation "net.fabricmc.fabric-api:fabric-api-base:${project.api_base_version}" - modImplementation "net.fabricmc.fabric-api:fabric-lifecycle-events-v1:${project.lifecycle_events_version}" - modImplementation "net.fabricmc.fabric-api:fabric-key-binding-api-v1:${project.key_bind_api_version}" - modImplementation "net.fabricmc.fabric-api:fabric-resource-loader-v0:${project.resource_loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-command-api-v1:${project.command_api_version}" - modImplementation "com.github.wagyourtail:jsmacros:${project.jsmacros_version}" - implementation "org.graalvm.sdk:graal-sdk:${project.graal_version}" - implementation "org.graalvm.js:js:${project.graal_version}" - implementation "org.graalvm.truffle:truffle-api:${project.graal_version}" -// if (targetCompatibility == JavaVersion.VERSION_16) { -// implementation "org.graalvm.compiler:compiler:${project.graal_version}" -// implementation "org.graalvm.compiler:compiler-management:${project.graal_version}" -// } - implementation "org.graalvm.regex:regex:${project.graal_version}" - - implementation group: 'com.ibm.icu', name: 'icu4j', version: '67.1' - - implementation "io.noties:prism4j:${project.prism_version}" - - //for modmenu - modImplementation "net.fabricmc.fabric-api:fabric-screen-api-v1:1.0.4+155f865c13" - //nullable not defined so... implementation 'com.google.code.findbugs:jsr305:3.0.2' diff --git a/gradle.properties b/gradle.properties index 0104462..120b676 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,24 +1,18 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx3G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.17.1 - yarn_mappings=1.17.1+build.1 - loader_version=0.9.0+build.204 + minecraft_version=1.19 + yarn_mappings=1.19+build.1 + loader_version=0.13.3 # Mod Properties - mod_version = 1.1.3 + mod_version = 1.1.4 maven_group = xyz.wagyourtail archives_base_name = jsmacros-jython # Dependencies - api_base_version=0.3.0+a02b4463a0 - lifecycle_events_version=1.4.4+a02b4463a0 - key_bind_api_version=1.0.4+a02b4463a0 - command_api_version=1.1.2+6cefd57713 - resource_loader_version=0.4.7+b7ab6121a0 - - jsmacros_version=e446ce9d95 + jsmacros_version=f8d39357c0 prism_version=2.0.0 graal_version=21.2.0 diff --git a/src/main/java/xyz/wagyourtail/jsmacros/jython/language/impl/JythonLanguageDescription.java b/src/main/java/xyz/wagyourtail/jsmacros/jython/language/impl/JythonLanguageDescription.java index efc4b6a..d7d1688 100644 --- a/src/main/java/xyz/wagyourtail/jsmacros/jython/language/impl/JythonLanguageDescription.java +++ b/src/main/java/xyz/wagyourtail/jsmacros/jython/language/impl/JythonLanguageDescription.java @@ -43,13 +43,14 @@ protected void exec(EventContainer ctx, ScriptTrigger scriptT interp.execfile(ctx.getCtx().getFile().getCanonicalPath()); }); } - + @Override - public void exec(EventContainer ctx, String script, Map globals) throws Exception { + protected void exec(EventContainer ctx, String script, BaseEvent event) throws Exception { execContext(ctx, (interp) -> { - globals.forEach(interp::set); + interp.set("event", event); + interp.set("file", ctx.getCtx().getFile()); interp.set("context", ctx); - + interp.exec(script); }); } diff --git a/src/main/java/xyz/wagyourtail/jsmacros/jython/library/impl/FWrapper.java b/src/main/java/xyz/wagyourtail/jsmacros/jython/library/impl/FWrapper.java index 038466f..8831460 100644 --- a/src/main/java/xyz/wagyourtail/jsmacros/jython/library/impl/FWrapper.java +++ b/src/main/java/xyz/wagyourtail/jsmacros/jython/library/impl/FWrapper.java @@ -59,12 +59,12 @@ private void internal_accept(boolean await, Object... params) { try { fn._jcall(params); } catch (Throwable ex) { - Core.instance.profile.logError(ex); + Core.getInstance().profile.logError(ex); } finally { ctx.releaseBoundEventIfPresent(Thread.currentThread()); ctx.unbindThread(Thread.currentThread()); - Core.instance.profile.joinedThreadStack.remove(Thread.currentThread()); + Core.getInstance().profile.joinedThreadStack.remove(Thread.currentThread()); } }); t.start(); @@ -77,8 +77,8 @@ private Object internal_apply(Object... params) { try { ctx.bindThread(Thread.currentThread()); - if (Core.instance.profile.checkJoinedThreadStack()) { - Core.instance.profile.joinedThreadStack.add(Thread.currentThread()); + if (Core.getInstance().profile.checkJoinedThreadStack()) { + Core.getInstance().profile.joinedThreadStack.add(Thread.currentThread()); } return fn._jcall(params).__tojava__(Object.class); } catch (Throwable ex) { @@ -86,7 +86,7 @@ private Object internal_apply(Object... params) { } finally { ctx.releaseBoundEventIfPresent(Thread.currentThread()); ctx.unbindThread(Thread.currentThread()); - Core.instance.profile.joinedThreadStack.remove(Thread.currentThread()); + Core.getInstance().profile.joinedThreadStack.remove(Thread.currentThread()); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 752f019..c013929 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,7 @@ "depends": { "fabricloader": ">=0.7.4", "minecraft": "*", - "jsmacros": "1.6.X" + "jsmacros": "1.7.X" }, "custom": { "modmenu:parent": "jsmacros"