From c7eabcfd7ce3ec9bb2dd3de7e527de92c64a54e2 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Wed, 1 Jan 2025 15:51:11 -0300 Subject: [PATCH] Ignore unknown JSON keys --- .../bedrockconverter/SparklyBedrockConverter.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SparklyBedrockConverter/src/main/kotlin/net/sparklypower/bedrockconverter/SparklyBedrockConverter.kt b/SparklyBedrockConverter/src/main/kotlin/net/sparklypower/bedrockconverter/SparklyBedrockConverter.kt index 3d9d7e7..b698f08 100644 --- a/SparklyBedrockConverter/src/main/kotlin/net/sparklypower/bedrockconverter/SparklyBedrockConverter.kt +++ b/SparklyBedrockConverter/src/main/kotlin/net/sparklypower/bedrockconverter/SparklyBedrockConverter.kt @@ -10,6 +10,9 @@ import java.io.File import javax.imageio.ImageIO private val jsonPrettyPrint = Json { prettyPrint = true } +private val JsonIgnoreUnknownKeys = Json { + ignoreUnknownKeys = true +} fun main(args: Array) { for ((index, arg) in args.withIndex()) { @@ -126,8 +129,8 @@ fun main(args: Array) { // ===[ SOUNDS REMAPPER ]=== // Copy the definitions - val minecraftNamespaceJavaSounds = Json.decodeFromString>(File(inputAssetsFolder, "minecraft/sounds.json").readText()) - val sparklyPowerNamespaceJavaSounds = Json.decodeFromString>(File(inputAssetsFolder, "sparklypower/sounds.json").readText()) + val minecraftNamespaceJavaSounds = JsonIgnoreUnknownKeys.decodeFromString>(File(inputAssetsFolder, "minecraft/sounds.json").readText()) + val sparklyPowerNamespaceJavaSounds = JsonIgnoreUnknownKeys.decodeFromString>(File(inputAssetsFolder, "sparklypower/sounds.json").readText()) // it is actually the same JSON format for the sound definition lmao val bedrockSoundDefinitions = mutableMapOf()