Skip to content

Keep the initiator of crafting jobs that are distributed - #224

Merged
rubensworks merged 1 commit into
master-1.21-ltsfrom
feature/crafting-job-initiator-distribution
Sep 4, 2026
Merged

Keep the initiator of crafting jobs that are distributed#224
rubensworks merged 1 commit into
master-1.21-ltsfrom
feature/crafting-job-initiator-distribution

Conversation

@rubensworks

Copy link
Copy Markdown
Member

When a job is scheduled with allowDistribution and more than one crafting interface knows the recipe, CraftingNetwork#scheduleCraftingJob splits it: the original job is replaced in the network by clones from CraftingHelpers#splitCraftingJobs.

Two things went wrong there:

  • CraftingHelpers#scheduleCraftingJobs set initiatorUuid after calling scheduleCraftingJob, so it landed on the original job that is no longer in the network.
  • CraftingJob#clone did not copy the initiator, so the clones would not have had it either.

The result is that distributed jobs lose their initiator entirely. That is visible today as a missing owner for those jobs in the crafting jobs gui, and it also means the completion event added in #222 cannot be attributed to whoever requested the job.

This sets the initiator before scheduling, and lets clone carry it along with the notify flag.

Found while working on CyclopsMC/IntegratedTerminals#214, where a distributed job produced no completion notification at all.

Testing

  • TestCraftingJob#testCloneRetainsInitiator and #testCloneWithoutInitiator cover the clone behaviour.
  • GameTestsCraftingJobFinishedEvent#testDistributedJobRetainsInitiator builds a network with two crafting interfaces that both know the chest recipe, schedules a job for 4, and asserts the job really was split and that every resulting job keeps the initiator and the notify flag.
  • The game test was confirmed to fail ("A split job lost its initiator") with the clone change reverted.
  • ./gradlew build and ./gradlew runGameTestServer pass (54 game tests).

Note for the consumer side

With this fix a distributed job emits one CraftingJobFinishedEvent per split job, all carrying the same initiator. IntegratedTerminals groups the resulting toasts by output so that a single toast is shown; that part is handled in CyclopsMC/IntegratedTerminals#214.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh


Generated by Claude Code

A job that is scheduled over multiple crafting interfaces is replaced by
clones of itself, but the initiator was only set on the original job after
scheduling, and clones did not carry it either. Distributed jobs therefore
lost their initiator, so their owner was not shown in the crafting jobs gui.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNDY2pZtkXqJrhztYCvNbh
@rubensworks
rubensworks merged commit 57c7851 into master-1.21-lts Sep 4, 2026
7 checks passed
@rubensworks
rubensworks deleted the feature/crafting-job-initiator-distribution branch September 4, 2026 15:37
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