Keep the initiator of crafting jobs that are distributed - #224
Merged
rubensworks merged 1 commit intoSep 4, 2026
Merged
Conversation
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
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.
When a job is scheduled with
allowDistributionand more than one crafting interface knows the recipe,CraftingNetwork#scheduleCraftingJobsplits it: the original job is replaced in the network by clones fromCraftingHelpers#splitCraftingJobs.Two things went wrong there:
CraftingHelpers#scheduleCraftingJobssetinitiatorUuidafter callingscheduleCraftingJob, so it landed on the original job that is no longer in the network.CraftingJob#clonedid 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
clonecarry 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#testCloneRetainsInitiatorand#testCloneWithoutInitiatorcover the clone behaviour.GameTestsCraftingJobFinishedEvent#testDistributedJobRetainsInitiatorbuilds 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.clonechange reverted../gradlew buildand./gradlew runGameTestServerpass (54 game tests).Note for the consumer side
With this fix a distributed job emits one
CraftingJobFinishedEventper 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