Server edits "generator-settings" to invalid value and therefore does not start
MC-134900 was claimed to be fixed and indeed, the value is no longer ignored, instead it is now automatically edited to a nonsensical value on server start and the server crashes on startup.
Example:
level-type=flat generator-settings="{\"biome\":\"minecraft:plains\",\"layers\":[{\"block\":\"minecraft:diamond_block\",\"height\":1}],structures:{\"village\":{}}}"
When the server starts, it edits the line to:
generator-settings="{"biome"\:"minecraft\:plains","layers"\:[{"block"\:"minecraft\:diamond_block","height"\:1}],structures\:{"village"\:{}}}"
That obviously cannot work, because the string is only "{" and then there is trailing data. Colons also do not need to be escaped, but the server does it anyway. It then crashes with this error message:
[20:29:09] [main/ERROR]: Unable to bootstrap registry 'minecraft:chunk_generator_type' [20:29:09] [main/ERROR]: Registry 'minecraft:chunk_generator_type' was empty after loading [20:29:10] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD' [20:29:10] [main/FATAL]: Failed to start the minecraft server com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:913) ~[server.jar:?] at adg.a(SourceFile:493) ~[server.jar:?] at adg.a(SourceFile:545) ~[server.jar:?] at adg.a(SourceFile:541) ~[server.jar:?] at adg.a(SourceFile:549) ~[server.jar:?] at net.minecraft.server.MinecraftServer.a(SourceFile:1049) ~[server.jar:?] at net.minecraft.server.MinecraftServer.main(SourceFile:999) [server.jar:?]
If the generator settings are input without being quoted, like this (which I assume to be wrong) …
generator-settings={"biome":"minecraft:plains","layers":[{"block":"minecraft:diamond_block","height":1}],structures:{"village":{}}}
… then the server edits it to …
generator-settings={"biome"\:"minecraft\:plains","layers"\:[{"block"\:"minecraft\:diamond_block","height"\:1}],structures\:{"village"\:{}}}
… and crashes like this:
[20:33:37] [main/ERROR]: Unable to bootstrap registry 'minecraft:chunk_generator_type' [20:33:37] [main/ERROR]: Registry 'minecraft:chunk_generator_type' was empty after loading [20:33:37] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD' [20:33:37] [main/FATAL]: Failed to start the minecraft server com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 88 path $.layers at adg.a(SourceFile:495) ~[server.jar:?] at adg.a(SourceFile:545) ~[server.jar:?] at adg.a(SourceFile:541) ~[server.jar:?] at adg.a(SourceFile:549) ~[server.jar:?] at net.minecraft.server.MinecraftServer.a(SourceFile:1049) ~[server.jar:?] at net.minecraft.server.MinecraftServer.main(SourceFile:999) [server.jar:?] Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 88 path $.layers at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[server.jar:?] at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[server.jar:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:508) ~[server.jar:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:738) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:910) ~[server.jar:?] at adg.a(SourceFile:493) ~[server.jar:?] ... 5 more
Again, quoted colons for no reason.
Created Issue:
Server edits "generator-settings" to invalid value and therefore does not start
MC-134900was claimed to be fixed and indeed, the value is no longer ignored, instead it is now automatically edited to a nonsensical value on server start and the server crashes on startup.Example:
level-type=flat generator-settings="{\"biome\":\"minecraft:plains\",\"layers\":[{\"block\":\"minecraft:diamond_block\",\"height\":1}],structures:{\"village\":{}}}"When the server starts, it edits the line to:
generator-settings="{"biome"\:"minecraft\:plains","layers"\:[{"block"\:"minecraft\:diamond_block","height"\:1}],structures\:{"village"\:{}}}"That obviously cannot work, because the string is only "{" and then there is trailing data. Colons also do not need to be escaped, but the server does it anyway. It then crashes with this error message:
[20:29:09] [main/ERROR]: Unable to bootstrap registry 'minecraft:chunk_generator_type' [20:29:09] [main/ERROR]: Registry 'minecraft:chunk_generator_type' was empty after loading [20:29:10] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD' [20:29:10] [main/FATAL]: Failed to start the minecraft server com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:913) ~[server.jar:?] at adg.a(SourceFile:493) ~[server.jar:?] at adg.a(SourceFile:545) ~[server.jar:?] at adg.a(SourceFile:541) ~[server.jar:?] at adg.a(SourceFile:549) ~[server.jar:?] at net.minecraft.server.MinecraftServer.a(SourceFile:1049) ~[server.jar:?] at net.minecraft.server.MinecraftServer.main(SourceFile:999) [server.jar:?]If the generator settings are input without being quoted, like this (which I assume to be wrong) …
generator-settings={"biome":"minecraft:plains","layers":[{"block":"minecraft:diamond_block","height":1}],structures:{"village":{}}}… then the server edits it to …
generator-settings={"biome"\:"minecraft\:plains","layers"\:[{"block"\:"minecraft\:diamond_block","height"\:1}],structures\:{"village"\:{}}}… and crashes like this:
[20:33:37] [main/ERROR]: Unable to bootstrap registry 'minecraft:chunk_generator_type' [20:33:37] [main/ERROR]: Registry 'minecraft:chunk_generator_type' was empty after loading [20:33:37] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD' [20:33:37] [main/FATAL]: Failed to start the minecraft server com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 88 path $.layers at adg.a(SourceFile:495) ~[server.jar:?] at adg.a(SourceFile:545) ~[server.jar:?] at adg.a(SourceFile:541) ~[server.jar:?] at adg.a(SourceFile:549) ~[server.jar:?] at net.minecraft.server.MinecraftServer.a(SourceFile:1049) ~[server.jar:?] at net.minecraft.server.MinecraftServer.main(SourceFile:999) [server.jar:?] Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 88 path $.layers at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[server.jar:?] at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[server.jar:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:508) ~[server.jar:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:738) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714) ~[server.jar:?] at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:910) ~[server.jar:?] at adg.a(SourceFile:493) ~[server.jar:?] ... 5 moreAgain, quoted colons for no reason.
relates to
relates to
relates to
I know a lot of people have been having issues with "generator-settings" in server.properties not applying to flat worlds. I did a good amount of searching as was not able to find an answer.
I did come across issue #MC-182421 which stated it was fixed.
I used the settings from that issue that Bartosk posted:
{"biome":"minecraft:plains","layers":[{"block":"minecraft:diamond_block","height":1}],"structures":{"village":{}}}
I tested on 20w18a since that was the version that was claimed to work on.
It worked. But when I tested in both 1.16 and 1.16.4 neither worked. I even tested on the latest snapshot, 20w46a, and still a no go.
In the images, you will see the diamond block world worked in 20w18a, but the same value did not apply for any other version.
Proper value is:
{"biome":"minecraft:plains","layers":[{"block":"minecraft:diamond_block","height":1}],"structures":{"village":{}}}Main problem was missing quotes around "structures".
You don't need to wrap whole thing in '"', as `.properties` format does not require that (everything is string). Escape on colons is also added by `java.util.Properties` class and is removed before passed outside, so it's also syntactically valid.
Thanks, that does indeed work! This mistake is even in the main example of this setting on the German Minecraft wiki (the English one doesn't even have any).
But I still wonder why the server edits its own settings file at all. Also, the error messages could be made more helpful.
Addition of escapes is automate action of `Properties` class. It's rather old piece of code (existed since Java 1.0) and has weird behaviors.
So I assume there's a "// TODO: make better" in there?