Fix the issue where an empty basin allows the same fluid in both input tanks#9974
Open
Apertyotis wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
Open
Fix the issue where an empty basin allows the same fluid in both input tanks#9974Apertyotis wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
Apertyotis wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
Conversation
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.
Issue
Under normal circumstances, the Basin’s internal fluid tank only allows one type of fluid to occupy a single slot. However, an empty Basin is an exception: if fluid is pumped in fast enough, the issue shown in the image can occur.
Cause
The root cause lies in the condition at CombinedTankWrapper.java#L89
This logic is somewhat counterintuitive. For an empty Basin,
fittingHandlerFoundis guaranteed to be false, which causes the value ofenforceVarietyto be ignored entirely, leading to the issue described above.On the other hand, iffilledIntoCurrent != 0, the program will treat the current handler as unable to continue filling and break the outer loop — even whenenforceVarietyis false. As a result, the remaining fluid can only be inserted during the next input. For certain indivisible FluidStack cases, this also introduces a subtle logical inconsistency.I think I understand this logic now: operate on only one tank at a time to prevent overfilling and make right-click interaction more convenient for players.
Fix
CombinedTankWrapper organizes the fluid system into a well-structured tree hierarchy, and considering the intended semantics of the code, enforceVariety is meant to control whether sibling nodes under the same parent are allowed to contain the same fluid type.