Skip to content

Fix crash displaying squeezer recipes with empty/missing tag-based outputs#1651

Closed
Copilot wants to merge 2 commits into
master-26from
copilot/fix-coal-dust-recipe-loading
Closed

Fix crash displaying squeezer recipes with empty/missing tag-based outputs#1651
Copilot wants to merge 2 commits into
master-26from
copilot/fix-coal-dust-recipe-loading

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

When a squeezer/mechanical squeezer recipe has a tag-based output (e.g. c:dusts/coal) and no mod populates that tag, JEI crashes trying to build the recipe display.

Root cause

RecipeSqueezer.getOutputItemsAsSlots() resolved tag outputs via ItemStackFromIngredient.getIngredient().display(), which internally calls BuiltInRegistries.ITEM.getOrThrow(tag) — throwing if the tag is absent from the registry.

Fix

Use SlotDisplay.TagSlotDisplay directly for tag-based outputs, bypassing registry lookup entirely. TagSlotDisplay.resolve() uses Optional and returns an empty stream for missing/empty tags instead of throwing.

// Before
right -> Pair.of(right.getLeft().getIngredient().display(), right.getRight())

// After
right -> Pair.of((SlotDisplay) new SlotDisplay.TagSlotDisplay(right.getLeft().getTag()), right.getRight())

This lets JEI render the recipe slot as empty (missing item placeholder) rather than crashing.

@coveralls

coveralls commented Apr 11, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 53.65% (-0.01%) from 53.663% — copilot/fix-coal-dust-recipe-loading into master-26

…g item tag

Use SlotDisplay.TagSlotDisplay instead of ItemStackFromIngredient.getIngredient().display()
to avoid crashing when the tag doesn't exist in the registry (e.g. c:dusts/coal when no
Coal Dust mod is installed). TagSlotDisplay safely handles missing/empty tags.

Agent-Logs-Url: https://github.com/CyclopsMC/IntegratedDynamics/sessions/8c152d32-321d-4a39-aa9e-05f944019446

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix coal dust recipe loading issue in JEI Fix crash displaying squeezer recipes with empty/missing tag-based outputs Apr 11, 2026
Copilot AI requested a review from rubensworks April 11, 2026 16:24

@rubensworks rubensworks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the problem is that ItemStackFromIngredient.getIngredient().display() can throw, maybe you can make it non-throwing instead?

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

If the problem is that ItemStackFromIngredient.getIngredient().display() can throw, maybe you can make it non-throwing instead?

The current fix does exactly that. ItemStackFromIngredient.getIngredient() calls BuiltInRegistries.ITEM.getOrThrow(tag) internally (it's in CyclopsCore, so we can't change it). By constructing SlotDisplay.TagSlotDisplay(right.getLeft().getTag()) directly with the raw TagKey<Item>, we bypass that call entirely — TagSlotDisplay is the correct display type for tag-based outputs and handles empty/missing tags safely.

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.

[26.1.x][Neoforge] Coal Dust Recipe fails to load/Crashed on JEI

3 participants