Show the crafting machine in crafting option tooltips - #216
Open
rubensworks wants to merge 2 commits into
Open
Conversation
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
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RM86uiqD4soLkMyjC9Eeid
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.
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.
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, fromICraftingNetwork#getRecipeCraftingInterfacesand the newICraftingInterface#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 throughITerminalCraftingOption#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 ofIIngredientComponentTerminalStorageHandler#drawInstance; the shared slot-grid rendering moved into aClientCraftingOptionSlotsTooltipbase class that both grids extend.Depends on
CyclopsMC/IntegratedCrafting#225, which adds
ICraftingInterface#getTargetMachineItem(). CI here cannot pass until that is merged and released, andintegratedcrafting_versioningradle.propertiesis bumped to a build containing it. Locally this was built and tested against IntegratedCrafting1.5.0-DEVviaintegratedcrafting_version_localinsecrets.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../gradlew buildand./gradlew runGameTestServerboth 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