diff --git a/build.gradle b/build.gradle index 0d97c660e..3a3b7b54d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,8 @@ plugins { id 'java' id 'maven-publish' id 'net.neoforged.moddev' version "1.0.14" - id "me.shedaniel.unified-publishing" version "0.1.+" + // https://maven.architectury.dev/me/shedaniel/unified-publishing/maven-metadata.xml + id "me.shedaniel.unified-publishing" version "0.1.13" } ext.ENV = System.getenv() @@ -23,24 +24,18 @@ neoForge { configureEach { logLevel = org.slf4j.event.Level.INFO } + client { client() - if (ENV.MC_CLIENT_ARGS) { - programArguments.addAll(ENV.MC_CLIENT_ARGS.split(' ')) - } - jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") - gameDirectory = file 'run' - } - client2 { - client() - programArguments.addAll('--username', 'Dev2') if (ENV.MC_CLIENT_ARGS) { programArguments.addAll(ENV.MC_CLIENT_ARGS.split(' ')) } + jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") gameDirectory = file 'run' } + server { server() programArgument("--nogui") @@ -116,7 +111,7 @@ repositories { } dependencies { - api ("dev.latvian.mods:rhino:$rhino_version") { transitive(false) } + api("dev.latvian.mods:rhino:$rhino_version") { transitive(false) } compileOnly("dev.architectury:architectury-neoforge:$architectury_version") compileOnly("mezz.jei:jei-1.21-neoforge:$jei_version") @@ -190,7 +185,7 @@ unifiedPublishing { publishing { publications { mavenNeoForge(MavenPublication) { - artifactId = "$archives_base_name-neoforge" + artifactId = archives_base_name from components.java } } diff --git a/gradle.properties b/gradle.properties index 3ba2689da..fcd6f9be8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,8 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -# loom.platform=neoforge mod_id=kubejs -archives_base_name=kubejs +archives_base_name=kubejs-neoforge mod_name=KubeJS maven_group=dev.latvian.mods mod_author=latvian.dev @@ -13,11 +12,11 @@ modrinth_id=umyGl7zF minecraft_version=1.21 mod_version=2100.7.0 -neoforge_version=21.0.106-beta +neoforge_version=21.0.114-beta parchment_version=2024.07.07 -rhino_version=2100.2.5-build.41 -architectury_version=13.0.4 +rhino_version=2100.2.5-build.44 -rei_version=16.0.729 -jei_version=19.5.0.31 +architectury_version=13.0.6 +rei_version=16.0.744 +jei_version=19.5.0.47 emi_version=1.1.10+1.21 \ No newline at end of file diff --git a/src/main/java/dev/latvian/mods/kubejs/script/KubeJSContext.java b/src/main/java/dev/latvian/mods/kubejs/script/KubeJSContext.java index efc8d4ce3..56238bfa7 100644 --- a/src/main/java/dev/latvian/mods/kubejs/script/KubeJSContext.java +++ b/src/main/java/dev/latvian/mods/kubejs/script/KubeJSContext.java @@ -17,6 +17,7 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import java.lang.reflect.AccessibleObject; @@ -75,6 +76,10 @@ public Scriptable wrapAsJavaObject(Scriptable scope, Object javaObject, TypeInfo return super.wrapAsJavaObject(scope, javaObject, target); } + private static boolean isKey(Object from) { + return from instanceof CharSequence || from instanceof ResourceLocation || from instanceof ResourceKey; + } + @Override public int internalConversionWeightLast(Object fromObj, TypeInfo target) { var c = target.asClass(); @@ -149,7 +154,7 @@ protected Object internalJsToJavaLast(Object from, TypeInfo target) { throw throwAsScriptRuntimeEx(new IllegalAccessException("Reflection access denied"), this); } else if (from instanceof Holder holder && c.isInstance(holder.value())) { return holder.value(); - } else { + } else if (isKey(from)) { var reg = RegistryType.lookup(target); if (reg != null) {