Reworked optical computation transfer logic to correctly handle simulated case. - #5296
Open
Archengius wants to merge 2 commits into
Open
Reworked optical computation transfer logic to correctly handle simulated case.#5296Archengius wants to merge 2 commits into
Archengius wants to merge 2 commits into
Conversation
…ated case. Replaced visited set with a map of element to its context to support transfer without mutating the element state.
screret
approved these changes
Aug 16, 2026
Author
|
Adjusted the changes to separate visited set and simulation state, since if they are combined simulation state cannot be reused across multiple simulations. |
screret
reviewed
Aug 16, 2026
| */ | ||
| default boolean canBridge() { | ||
| Collection<IOpticalComputationProvider> list = new ArrayList<>(); | ||
| list.add(this); |
Author
There was a problem hiding this comment.
Should not be necessary since all implementations are supposed to add themselves to the visited set upon receiving the call. Adding them in advance might actually cause problems due to some of them (like network switch) checking if seen set already contains themselves, and bailing out if it does.
screret
approved these changes
Aug 16, 2026
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.
What
Reworked optical computation transfer logic to correctly handle simulated case. Simulated case is important for recipe matching logic since it is not supposed to mutate the state or consume any optical power.
Implementation Details
Replaced seen element set with a map that maps element to an opaque context object used by the element to store its modified state without touching the live data on the instance.
AI Usage
Claude Sonnet 5 was used to review the code. All of the code was written by hand.
Outcome
Recipe search logic no longer mutates the state of the computation power transfer related machines.
How Was This Tested
Built research station and other computation-related multiblocks and made sure computation transfer still works.
Potential Compatibility Issues
IOpticalComputationProviderAPI has changed in a breaking way, so any mods dependant on that part of the GTM API will need to be updated and recompiled against the new version.