Skip to content

Commit

Permalink
Ignore unknown JSON keys
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Jan 1, 2025
1 parent 64185ea commit c7eabcf
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>) {
for ((index, arg) in args.withIndex()) {
Expand Down Expand Up @@ -126,8 +129,8 @@ fun main(args: Array<String>) {

// ===[ SOUNDS REMAPPER ]===
// Copy the definitions
val minecraftNamespaceJavaSounds = Json.decodeFromString<Map<String, MCJavaSoundDefinition>>(File(inputAssetsFolder, "minecraft/sounds.json").readText())
val sparklyPowerNamespaceJavaSounds = Json.decodeFromString<Map<String, MCJavaSoundDefinition>>(File(inputAssetsFolder, "sparklypower/sounds.json").readText())
val minecraftNamespaceJavaSounds = JsonIgnoreUnknownKeys.decodeFromString<Map<String, MCJavaSoundDefinition>>(File(inputAssetsFolder, "minecraft/sounds.json").readText())
val sparklyPowerNamespaceJavaSounds = JsonIgnoreUnknownKeys.decodeFromString<Map<String, MCJavaSoundDefinition>>(File(inputAssetsFolder, "sparklypower/sounds.json").readText())

// it is actually the same JSON format for the sound definition lmao
val bedrockSoundDefinitions = mutableMapOf<String, MCJavaSoundDefinition>()
Expand Down

0 comments on commit c7eabcf

Please sign in to comment.