Skip to content

Show a toast when a requested crafting job is completed - #214

Merged
rubensworks merged 10 commits into
master-1.21-ltsfrom
feature/crafting-job-finished-toast
Sep 4, 2026
Merged

Show a toast when a requested crafting job is completed#214
rubensworks merged 10 commits into
master-1.21-ltsfrom
feature/crafting-job-finished-toast

Conversation

@rubensworks

@rubensworks rubensworks commented Sep 2, 2026

Copy link
Copy Markdown
Member

Closes CyclopsMC/IntegratedCrafting#175.

Important

Depends on CyclopsMC/IntegratedCrafting#222, which adds the CraftingJobFinishedEvent this listens to. CI will fail until that is merged and released, and integratedcrafting_version is bumped in gradle.properties. Validated locally against a publishToMavenLocal build of that branch.

What

When a crafting job that the player requested from a terminal is completed, a toast is shown with the crafted output, comparable to what RS and AE do.

Asking to be notified

The crafting plan gui gains a checkbox next to the Craft button, enabled by default. Toggling it sends TerminalStorageCraftingPlanSetNotifyPacket, and starting the job passes the flag on to IntegratedCrafting, which persists it on the crafting job.

The checkbox is unlabeled with a tooltip, because the button row only has 38px of free space between the plan view toggle and the Back button.

Jobs that are started outside of this gui, such as the auto-crafts triggered from JEI in IntegratedTerminals-Compat, go through the existing four-argument startCraftingJob, which now defaults to notifying. That keeps them consistent with the checkbox default.

Showing the toast

CraftingJobFinishedToastListener, registered from the IntegratedCrafting mod compat, listens for completed jobs and sends CraftingJobFinishedToastPacket to the initiator when all of the following hold: the job is a root job, it carries the notify flag, and the initiator is online. Jobs that complete while the initiator is offline are not reported later.

The packet carries the crafted item, so that the client renders the item name in its own language. Outputs that are not items (fluids, energy) fall back to a server-formatted label and a crafting table icon.

Toast rendering

CraftingJobToast is generalized from the one added to IntegratedTerminals-Compat in CyclopsMC/IntegratedTerminals-Compat@44c3a1c, together with its nine-slice sprite. It now takes an arbitrary grouping token instead of a fixed enum, so both mods can reuse it: this one groups by crafted item, so repeated crafts of the same thing replace each other instead of piling up. CyclopsMC/IntegratedTerminals-Compat#17 removes the duplicate there.

Config

craftingJobFinishedToast (client) is a global off switch for players who never want these toasts.

Tests

GameTestCraftingJobNotify checks that starting a job through the crafting handler propagates the initiator and the notify flag, both with the checkbox on and off. The completion event itself is covered by game tests in the IntegratedCrafting PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh

The crafting plan gui gains a checkbox, enabled by default, with which the
player indicates that they want to be notified once the job is completed.
Once IntegratedCrafting reports the job as completed, a toast with the
crafted output is shown to the initiator, if they are online.

The toast itself is generalized from IntegratedTerminals-Compat, so that it
can be reused for the auto-craft notifications there.

Closes CyclopsMC/IntegratedCrafting#175

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
rubensworks and others added 6 commits September 2, 2026 16:13
CraftingHelpers#multiplyPrototypedIngredients can not infer its type
variables from a wildcard list, so go through a raw list like the other
callers do.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
Make room on the crafting plan button row by narrowing the plan view
toggle to 62px, which still fits its widest label, and shifting the back
and craft buttons right.

Also shorten the toast subtitle, as the longer phrasing wrapped onto a
second line at the standard toast width.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
The button row's background is narrower than the plan list above it, so
the back and craft buttons return to their original positions, and the
notify checkbox takes the space freed by the narrower view toggle.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
IntegratedCrafting now tracks the total amount on the job itself,
so the toast no longer needs its own copy of it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
This is the first build that exposes the crafting job completion event.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
The background now uses the deep teal that this mod's icons already use,
with a menril-coloured bevel, instead of a generic dark panel.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
…on to off

The toast now draws its output through the ingredient component's terminal
storage handler, so crafted fluids, energy, and ingredient components from
other mods are shown just like items, with their own quantity formatting.

The notify option is synchronised through the container's value notifier
rather than through a dedicated packet, and is disabled by default.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
A job that is distributed over multiple crafting interfaces completes as
several jobs, so their quantities are added into the toast that groups them,
rather than the toast showing only the last one that finished.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
This build keeps the initiator of crafting jobs that are distributed over
multiple crafting interfaces, so those jobs can be notified about as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
@rubensworks
rubensworks merged commit 88bf712 into master-1.21-lts Sep 4, 2026
3 checks passed
@rubensworks
rubensworks deleted the feature/crafting-job-finished-toast branch September 4, 2026 18:43
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.

2 participants