diff --git a/build.gradle.kts b/build.gradle.kts index 8186d41..9c85e8f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,8 +16,8 @@ repositories { dependencies { implementation(kotlin("stdlib")) - compileOnly("com.github.Anuken.Arc:arc-core:v149") - compileOnly("com.github.anuken.mindustry:core:v149") { + compileOnly("com.github.Anuken.Arc:arc-core:v152") + compileOnly("com.github.anuken.mindustry:core:v152") { exclude(group = "com.github.Anuken.Arc") } } diff --git a/src/main/kotlin/cf/wayzer/contentsTweaker/ContentsTweaker.kt b/src/main/kotlin/cf/wayzer/contentsTweaker/ContentsTweaker.kt index 3bcc05f..ce5897f 100644 --- a/src/main/kotlin/cf/wayzer/contentsTweaker/ContentsTweaker.kt +++ b/src/main/kotlin/cf/wayzer/contentsTweaker/ContentsTweaker.kt @@ -2,6 +2,7 @@ package cf.wayzer.contentsTweaker import arc.util.Log import arc.util.serialization.BaseJsonWriter +import arc.util.serialization.JsonValue import arc.util.serialization.JsonWriter import cf.wayzer.contentsTweaker.resolvers.* import mindustry.Vars @@ -43,7 +44,13 @@ object ContentsTweaker { fun loadPatch(name: String, content: String, doAfter: Boolean = true) { val time = measureTimeMillis { - CTNode.PatchHandler.handle(JsonIO.read(null, content)) + val data = try { + JsonIO.read(null, content) as JsonValue + } catch (e: Exception) { + Log.err("[ContentsTweaker]Failed to parse patch for '$name': $content", e) + return + } + CTNode.PatchHandler.handle(data) if (doAfter) afterHandle() } Log.infoTag("ContentsTweaker", "Load Content Patch '$name' costs $time ms")