Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/main/kotlin/cf/wayzer/contentsTweaker/ContentsTweaker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Any>(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")
Expand Down
Loading