Skip to content

fix bug causing world_gen_settings to get lost on restart - #4316

Open
gennyble wants to merge 2 commits into
SpongePowered:api-21from
gennyble:api-21
Open

gennyble wants to merge 2 commits into
SpongePowered:api-21from
gennyble:api-21

Conversation

@gennyble

@gennyble gennyble commented Oct 13, 2026 •

Copy link
Copy Markdown

Hello!

First time contributor, and Mixin novice. An attempt at #4315

This PR does three things (one just a typo fix):

  • Add an @Inject for getSeed in ServerLevelMixin.java so the seed is retrieved from the custom world generation options.
  • Load a dimension's world_gen_settings.dat in createNonDefaultLevels (SpongeWorldManager.java). I do not know where else this might need to happen; some guidance would be appreciated!
  • Fix a typo in SpongeWorldManager.createLevel. I was in that method a lot while trying to figure out how everything works, and IntelliJ flagged it.

Please let me know if you want any changes, tests, or just have comments.

@gennyble

Copy link
Copy Markdown
Author

To note, also:
I did not run the pre-commit hook because the tests were failing. I believe they were failing before my changes, but I just wanted to make sure I mentioned it.

}

final var saveDataPath = storageSource.getDimensionPath(registryKey).resolve("data");
final var saveDataStorage = new SavedDataStorage(saveDataPath, this.server.getFixerUpper(), this.server.registryAccess());

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not thrilled about how I build this SavedDataStorage, but it mimics what Level does, I believe, and I cannot get it from the world before it's built (for obvious reasons). What do you think?

if (levelData instanceof PrimaryLevelDataBridge bridge) {
final WorldOptions options = bridge.bridge$spongeData().worldGenOptions();
cir.setReturnValue(options.seed());
if (options != null) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ thinks this null check is always true, which is why I removed it before opening the PR, but IntelliJ is wrong. Maybe because bridge$spongeData always has a value, even if default? Unsure. Either way, I got an exception when trying to run it without this check.

@gabizou

gabizou commented Nov 1, 2026

Copy link
Copy Markdown
Member

Tests should be good to pass now. If they keep failing, let me know. I'll try to get this PR merged anyways soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants