Skip potions without registry keys in recipe generation#6375
Open
evhub wants to merge 1 commit intoBluSunrize:1.21.1from
Open
Skip potions without registry keys in recipe generation#6375evhub wants to merge 1 commit intoBluSunrize:1.21.1from
evhub wants to merge 1 commit intoBluSunrize:1.21.1from
Conversation
…nrize#6364 When another mod registers a potion brewing recipe with a Holder.direct() (no registry key) instead of a proper Holder.Reference, the recipe generation and logging code would crash with NoSuchElementException on Holder.unwrapKey().orElseThrow(). This caused a "Failed to encode packet clientbound/minecraft:update_recipes" error that disconnected clients. This change gracefully skips potions without registry keys in both getPotionBottlingRecipes() and registerPotionRecipe(), logging a warning instead of crashing.
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.
Fixes #6364.
When another mod registers a potion brewing recipe using a
Holder.direct()(no registry key) instead of a properHolder.Reference,PotionRecipeGeneratorscrashes withNoSuchElementExceptionat theunwrapKey().orElseThrow()calls. This causes aFailed to encode packet 'clientbound/minecraft:update_recipes'error that disconnects clients from the server.This PR adds defensive checks in three places:
getPotionBottlingRecipes()callback — skips potions without registry keys before adding bottling/bullet recipesgetPotionBottlingRecipes()logging — usesorElse("unknown")instead oforElseThrow()registerPotionRecipe()— early-returns for potions without registry keysAll skipped potions log a warning for debugging.
🤖 Generated with Claude Code