Fix IllegalStateException when BiomeExtract contains a biome from a removed/updated mod#1179
Merged
rubensworks merged 3 commits intomaster-1.21-ltsfrom Apr 4, 2026
Conversation
Pull Request Test Coverage Report for Build 23979663165Details
💛 - Coveralls |
… item When a biome mod is updated and a previously-extracted biome (stored in a BiomeExtract item) no longer exists, the game crashed with IllegalStateException: Missing element ResourceKey[minecraft:worldgen/biome / ...]. The crash occurred in DataComponentBiomeConfig.BiomeHolder.getBiome() which called getter.getOrThrow(), throwing when the biome key isn't found in the registry. Changes: - DataComponentBiomeConfig.BiomeHolder.getBiome(): Changed from getOrThrow to get().orElse(null) to gracefully handle missing biomes - ItemBiomeExtract.getDescriptionId(): Check holder directly instead of biome so items with removed biomes aren't shown as "empty" - ItemBiomeExtract.isEmpty(): Check holder directly instead of biome - ItemBiomeExtract.appendHoverText(): When biome is missing (removed mod), display the raw biome ID as fallback Agent-Logs-Url: https://github.com/CyclopsMC/EvilCraft/sessions/2091da3d-064b-4c36-aa6f-8eb54afa71a9 Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix IllegalStateException for missing biome resource key
Fix IllegalStateException when BiomeExtract contains a biome from a removed/updated mod
Apr 4, 2026
rubensworks
requested changes
Apr 4, 2026
| } | ||
|
|
||
| public boolean isEmpty(ItemStack itemStack) { | ||
| return getBiome(itemStack) == null; |
Member
There was a problem hiding this comment.
I don't see why this change is necessary. If not needed, please revert.
| @Override | ||
| public String getDescriptionId(ItemStack itemStack) { | ||
| return super.getDescriptionId(itemStack) + (getBiome(itemStack) == null ? ".empty" : ""); | ||
| return super.getDescriptionId(itemStack) + (itemStack.get(RegistryEntries.COMPONENT_BIOME) == null ? ".empty" : ""); |
Member
There was a problem hiding this comment.
I don't see why this change is necessary. If not needed, please revert.
…xtract Agent-Logs-Url: https://github.com/CyclopsMC/EvilCraft/sessions/49fc63ba-d570-4488-8e2e-92ffc2f5c65a Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a biome mod is updated and removes a biome previously captured in a
BiomeExtractitem, deserializing that item crashes withIllegalStateException: Missing element ResourceKey[minecraft:worldgen/biome / ...]. This affects any item lookup (e.g., AE2 search) that triggers component deserialization.Changes
DataComponentBiomeConfig.BiomeHolder.getBiome(): ReplacegetOrThrowwithget().orElse(null)— returnsnullinstead of throwing when the biome key is absent from the registry.ItemBiomeExtract.appendHoverText(): When the holder is present but the biome no longer exists, fall back to displaying the raw resource location (e.g.biomeswevegone:skyrise_vale) instead of showing nothing.