Skip to content

Fix NPE in HugeMushroomSpecies#rot (Closes #47)#48

Merged
supermassimo merged 1 commit intoDynamicTreesTeam:develop/1.21.1from
McHearty:develop/1.21.1
Mar 1, 2026
Merged

Fix NPE in HugeMushroomSpecies#rot (Closes #47)#48
supermassimo merged 1 commit intoDynamicTreesTeam:develop/1.21.1from
McHearty:develop/1.21.1

Conversation

@McHearty
Copy link
Copy Markdown
Contributor

@McHearty McHearty commented Mar 1, 2026

This PR resolves #47 by preventing a NullPointerException during world generation in HugeMushroomSpecies#rot.

Services.CONFIG.getIntConfig(MAX_BRANCH_ROT_RADIUS) may return null if the config entry is missing or not initialized. The previous implementation relied on implicit unboxing, which caused a crash during feature placement.

This change replaces unsafe auto-unboxing with an explicit null check and a safe default value of 0, ensuring worldgen remains stable even when the config entry is absent.

Impact

  • Fixes worldgen crash during feature placement
  • No behavioral change when config is properly defined
  • Minimal, localized change with no API impact

Closes #47.

Prevent a NullPointerException during worldgen by safely handling a nullable return from Services.CONFIG.getIntConfig(MAX_BRANCH_ROT_RADIUS).

Replaced unsafe auto-unboxing with an explicit null check and default value (0), ensuring stable feature placement when the config entry is missing.
@supermassimo supermassimo merged commit 492bd4f into DynamicTreesTeam:develop/1.21.1 Mar 1, 2026
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.

[1.3.1 Release] Server Crash On Chunk Load with HugeMushroomSpecies

2 participants