Skip to content

Show the crafting machine in crafting option tooltips - #216

Open
rubensworks wants to merge 2 commits into
master-1.21-ltsfrom
feature/crafting-machine-tooltip
Open

Show the crafting machine in crafting option tooltips#216
rubensworks wants to merge 2 commits into
master-1.21-ltsfrom
feature/crafting-machine-tooltip

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Closes #181

Hovering a craftable in the storage terminal now says which machine it is crafted in, by name and by icon, above the crafting requirements.

Iron Ingot
Quantity: 1
Crafted In: Furnace
[furnace]
Crafting Requirements:
[raw iron]

When several distinct machines expose the same recipe, the label drops the name and the icons speak for themselves (Crafted In: followed by one icon per machine). Interfaces targeting the same machine type are shown once.

How it works

The machines are resolved server-side in TerminalStorageTabIngredientCraftingHandlerCraftingNetwork, once per channel, from ICraftingNetwork#getRecipeCraftingInterfaces and the new ICraftingInterface#getTargetMachineItem(). Each interface's machine is resolved at most once per call, since many recipes are commonly exposed by the same interface. They are serialized alongside the recipe and carried to the client on the crafting option, exposed generically through ITerminalCraftingOption#getCraftingMachines() (defaulting to empty, so handlers that cannot determine them are unaffected and write nothing).

To give the machines and the requirements each their own labelled icon grid, tooltips are now built as a List<Either<FormattedText, TooltipComponent>> that mixes text and visual components, rather than a list of lines plus a single trailing component. That changes the last parameter of IIngredientComponentTerminalStorageHandler#drawInstance; the shared slot-grid rendering moved into a ClientCraftingOptionSlotsTooltip base class that both grids extend.

Depends on

CyclopsMC/IntegratedCrafting#225, which adds ICraftingInterface#getTargetMachineItem(). CI here cannot pass until that is merged and released, and integratedcrafting_version in gradle.properties is bumped to a build containing it. Locally this was built and tested against IntegratedCrafting 1.5.0-DEV via integratedcrafting_version_local in secrets.properties.

Testing

New game tests in GameTestTerminalCraftingOptionMachines: serialization round-trip (with and without machines), machine resolution from a live network for the regular and the attuned crafting interface against a crafting table and a furnace, and deduplication across two interfaces on the same machine type.

All 41 required tests passed :)

./gradlew build and ./gradlew runGameTestServer both pass.

Verified in a dev client with clientdevbridge-cli, for the regular and the attuned crafting interface against a crafting table and a furnace, plus the multiple-machine case.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RM86uiqD4soLkMyjC9Eeid


Generated by Claude Code

rubensworks and others added 2 commits September 4, 2026 19:16
Hovering a craftable in the storage terminal now says which machine it is
crafted in, both by name and by icon, above the crafting requirements.

The machines are resolved server-side once per channel, from the crafting
interfaces that expose each recipe, and travel to the client alongside the
recipe. Interfaces that target the same machine type are only shown once, and
the label names the machine only when there is exactly one of them.

To let the machines and the requirements each get their own labelled icon
grid, tooltips are now built as a list of elements that mixes text and visual
components, rather than a list of lines with a single trailing component.

Closes #181

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RM86uiqD4soLkMyjC9Eeid
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 participant