When attempting to import a valid world settings json generated by "Export World Generation Settings" or custom-written, import always fails with the message:
Error Importing Settings
Can't load registry with this ops
Steps to Reproduce:
Generate a world with default settings.
Export world generation settings from that world.
Start creating a new world.
Use "More World Options" > "Import Settings" to select the newly-exported settings.
This workflow functions correctly in 1.18.2
Code analysis
@unknown: see code analysis in this comment.
Attachments
Comments 6
Code analysis (yarn 1.19):
RegistryCodecs#createRegistryDecoder expects the registry loader access to be available. A RegistryOps has associated RegistryLoader$LoaderAccess if it is constructed with either of the ofLoaded methods that take DynamicRegistryManager$Mutable.
However, MoreOptionsDialog uses RegistryOps.of which creates the ops without loader access, so decoding fails with that. It's not possible to just switch the call, though, as the dynamic registry manager available there is immutable, and RegistryLoader needs mutable registry manager to load the dynamic registry when needed.
@apple502j
I think it's reasonable that MoreOptionsDialog has no loader access, because there's no data pack before creating the world. When importing, the dimension list in the setting file should be decoded as a map rather than overrided by data packs.
Relates to MC-205877 (similar cause)