Skip to content

Skip potions without registry keys in recipe generation#6375

Open
evhub wants to merge 1 commit intoBluSunrize:1.21.1from
evhub:fix/potion-recipe-generators-crash
Open

Skip potions without registry keys in recipe generation#6375
evhub wants to merge 1 commit intoBluSunrize:1.21.1from
evhub:fix/potion-recipe-generators-crash

Conversation

@evhub
Copy link

@evhub evhub commented Feb 6, 2026

Fixes #6364.

When another mod registers a potion brewing recipe using a Holder.direct() (no registry key) instead of a proper Holder.Reference, PotionRecipeGenerators crashes with NoSuchElementException at the unwrapKey().orElseThrow() calls. This causes a Failed 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 recipes
  • getPotionBottlingRecipes() logging — uses orElse("unknown") instead of orElseThrow()
  • registerPotionRecipe() — early-returns for potions without registry keys

All skipped potions log a warning for debugging.

🤖 Generated with Claude Code

…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.
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.

Failed to encode packet 'clientbound/minecraft:update_recipes' when joining server

1 participant