Oh The Biomes You'll Go Refabricated

Oh The Biomes You'll Go Refabricated

11M Downloads

[Crash]: config parser can't handle trailing whitespace

Inve1951 opened this issue ยท 1 comments

commented

Minecraft Version

1.18.2

BYG Version

1.4

Terrablender Version

1.1.0.102

Mod Loader

Fabric

Mod Loader Version

0.14.9

What happened?

after upgrading my mods and seeing this new book button in the player inventory i just had to disable it (as i had done for the vanilla book when it got added). turns out all 5 editors i tried to use insert a final newline by default and it appears that this is what causes BYG to crash the client during startup since after finding out the difference to the generated file and cumbersomely removing the newline it succeeds in loading the config.
i'm guessing this is actually a bug in jankson.
it appears that there's overloads accepting a string/stream which could be used to work around this until it's fixed upstream: https://github.com/falkreon/Jankson/blob/4fdb0410f8a732316584818aa0c9b7e351ac6052/src/main/java/blue/endless/jankson/api/Jankson.java#L140

crash-log

N/A

latest.log

relevant log extract
[03:08:07] [Render thread/INFO]: "Oh The Biomes You'll Go" after registries freeze event firing...
[03:08:07] [Render thread/INFO]: BYG: "Common Setup" Event Complete!
[03:08:07] [Render thread/INFO]: "************/.minecraft/config/byg/end-biomes.json5" was read.
[03:08:07] [Render thread/INFO]: "************/.minecraft/config/byg/nether-biomes.json5" was read.
[03:08:07] [Render thread/INFO]: "************/.minecraft/config/byg/trades.json5" was read.
[03:08:07] [Render thread/INFO]: "************/.minecraft/config/byg/biomepedia.json5" was read.
[03:08:07] [Render thread/ERROR]: Unhandled game exception
java.lang.IllegalStateException: Config errors were found:

Jankson file reading for "************/.minecraft/config/byg/biomepedia.json5" failed due to the following error(s):
java.lang.NullPointerException: Cannot read field "context" because "x0" is null

Config:

====================================================================================================
/*
This file uses the ".json5" file extension which allows for comments like this in a json file!
Your text editor may show this file with invalid/no syntax, if so, we recommend you download:

VSCode: https://code.visualstudio.com/
JSON5 plugin(for VSCode): https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-json5

to make editing this file much easier.
*/
{
	// Whether the biomepedia button is enabled or not in the player inventory for all users connected to this host.
	"inventory_enabled": true
}

====================================================================================================
As JSON LOADED ELEMENT:
NOT AVAILABLE BECAUSE JSONELEMENT WAS NULL
====================================================================================================

	at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.2) ~[?:?]
	at potionstudios.byg.BYG.commonLoad(BYG.java:70) ~[Oh_The_Biomes_You'll_Go-fabric-1.18.2-1.4.3.jar:?]
	at potionstudios.byg.BYGFabric.afterRegistriesFreeze(BYGFabric.java:65) ~[Oh_The_Biomes_You'll_Go-fabric-1.18.2-1.4.3.jar:?]
	at net.minecraft.util.registry.Registry.handler$baf000$byg_afterRegistriesFreeze(Registry:1084) ~[?:?]
	at net.minecraft.util.registry.Registry.freezeRegistries(Registry:371) ~[?:?]
	at net.minecraft.client.MinecraftClient.handler$dac001$onStart(MinecraftClient:13985) ~[?:?]
	at net.minecraft.client.MinecraftClient.run(MinecraftClient:716) ~[?:?]
	at net.minecraft.client.main.Main.main(Main:236) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:461) [fabric-loader-0.14.9.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.14.9.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.14.9.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104) [NewLaunch.jar:?]
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:175) [NewLaunch.jar:?]
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:185) [NewLaunch.jar:?]
	at org.polymc.EntryPoint.listen(EntryPoint.java:144) [NewLaunch.jar:?]
	at org.polymc.EntryPoint.main(EntryPoint.java:74) [NewLaunch.jar:?]
[03:08:07] [Render thread/INFO]: Stopping!
[03:08:07] [CullThread/INFO]: [STDOUT]: Shutting down culling task!
[03:08:07] [DefaultDispatcher-worker-1/WARN]: Error while searching for fallback id for mod cherishedworlds: No possible match found
[03:08:07] [DefaultDispatcher-worker-1/INFO]: No update for clean-logs found!
[03:08:08] [Render thread/ERROR]: Shutdown failure!
java.util.ConcurrentModificationException: null
	at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.2) ~[?:?]
	at java.util.HashMap.forEach(HashMap.java:1424) ~[?:?]
	at net.minecraft.client.texture.TextureManager.close(TextureManager:173) ~[?:?]
	at net.minecraft.client.MinecraftClient.close(MinecraftClient:1048) ~[?:?]
	at net.minecraft.client.MinecraftClient.stop(MinecraftClient:1026) ~[?:?]
	at net.minecraft.client.main.Main.main(Main:252) [client-intermediary.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:461) [fabric-loader-0.14.9.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.14.9.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.14.9.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104) [NewLaunch.jar:?]
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:175) [NewLaunch.jar:?]
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:185) [NewLaunch.jar:?]
	at org.polymc.EntryPoint.listen(EntryPoint.java:144) [NewLaunch.jar:?]
	at org.polymc.EntryPoint.main(EntryPoint.java:74) [NewLaunch.jar:?]

Did you isolate BYG?

I did not try BYG alone

commented

Replacing https://github.com/AOCAWOL/BYG/blob/079c460419240a9cf3b7b7d68a416216341e41ce/Common/src/main/java/potionstudios/byg/util/jankson/JanksonUtil.java#L114

with:

            load = JANKSON.loadElement(configStringFromBytes(path).strip());

should work I imagine