New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External generator settings (new implementation) #10
Changes from 1 commit
55f7093
4d76206
e7a596a
ffdac8d
ded565f
4bd1b8f
da1e965
9d35601
bfeaf97
6a572b7
23b470c
aeeded6
a1e01bf
0f9f5ff
a7c572a
b819ef2
c79512f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,9 +237,10 @@ public static CustomGeneratorSettings load(World world) { | |
settings = fromJson(jsonString); | ||
if (isOutdated) | ||
settings.save(world); | ||
} else if (!CustomCubicWorldType.pendingCustomCubicSettingsJsonString.isEmpty()) { | ||
} else if (CustomCubicWorldType.createNewWorld && !CustomCubicWorldType.pendingCustomCubicSettingsJsonString.isEmpty()) { | ||
settings = CustomGeneratorSettings.fromJson(CustomCubicWorldType.pendingCustomCubicSettingsJsonString); | ||
CustomCubicWorldType.pendingCustomCubicSettingsJsonString = ""; | ||
CustomCubicWorldType.createNewWorld = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a better way to determine if it's a new world that is used in common event handler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can suggest to do a same thing but in a |
||
settings.save(world); | ||
} else { | ||
CustomCubicMod.LOGGER | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like that static field here. Verifying that this field has the right value at the right time is nearly impossible without actually trying every possibility.
Instead I would suggest just mixing into
WorldSettings
andWorldInfo
(same as what I did in CC itself, withMixinWorldSettings
andMixinWorldInfo
).This also should remove the need for
createNewWorld
variable.This would also allow to actually store the loaded preset text somewhere instead of loading it from disk each time it's needed.
If you actually inject in the right place, you can almost completely hide the fact that the preset is not saved in level.dat, by just not saving that part into level.dat for CustomCubic worlds, and instead have code somewhere else that saves it.