[1.16.4] Bad resource pack metadata behavior causes startup warnings
andrewsf opened this issue ยท 0 comments
InMemoryResourcePack.getMetadata(...)
returns an invalid value when Minecraft looks for language metadata.
Problematic code
InMemoryResourcePack.java @ line 149
Startup exception
[04:15:01] [Render thread/WARN]: Unable to parse language metadata section of resourcepack: inmemory:jaopca
com.google.gson.JsonSyntaxException: Expected language to be a JsonObject, was a number (4)
at net.minecraft.util.JSONUtils.func_151210_l(SourceFile:393) ~[?:?]
at net.minecraft.client.resources.data.LanguageMetadataSectionSerializer.func_195812_a(SourceFile:27) ~[?:?]
at net.minecraft.client.resources.data.LanguageMetadataSectionSerializer.func_195812_a(SourceFile:15) ~[?:?]
at thelm.jaopca.resources.InMemoryResourcePack.func_195760_a(InMemoryResourcePack.java:151) ~[?:3.4.0.1]
at net.minecraft.client.resources.LegacyResourcePackWrapperV4.func_195760_a(SourceFile:364) ~[?:?]
at net.minecraft.client.resources.LanguageManager.lambda$func_239506_a_$0(LanguageManager.java:38) [?:?]
at net.minecraft.client.resources.LanguageManager$$Lambda$23803/287054541.accept(Unknown Source) [?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) [?:1.8.0_51]
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) [?:1.8.0_51]
at net.minecraft.client.resources.LanguageManager.func_239506_a_(LanguageManager.java:36) [?:?]
at net.minecraft.client.resources.LanguageManager.func_195410_a(LanguageManager.java:53) [?:?]
Solution
- Rename
metadata
topackMetadata
. - Call
deserializer.getSectionName()
and only returnpackMetadata
JsonObject if the value is"pack"
. Other deserializers (likeLanguageMetadataSectionSerializer
) expect different data so the "pack" metadata should not be returned in those cases. - Optional: create a new JSON object called
languageMetadata
and return that when appropriate.
Versions
JAOPCA: 3.4.0.1
Forge: 35.1.4
Minecraft: 1.16.4
Misc.
Almost identical to this issue: https://gitlab.com/DragonForge/SolarFluxReborn/-/issues/102