Skip to content

Fix FluidSlotWidget fluidChanged detect#90

Merged
serenibyss merged 1 commit intomasterfrom
fix/fluid-widget-detect
Jun 28, 2025
Merged

Fix FluidSlotWidget fluidChanged detect#90
serenibyss merged 1 commit intomasterfrom
fix/fluid-widget-detect

Conversation

@Taskeren
Copy link
Contributor

This is originally found because I'm working on an enhanced fluid tank in GT.
Because the fluid value is kept updated from SWidgetUpdate, I think there must be something wrong.

Then I found that in the method FluidSlotWidget#fluidChanged,
the cached value is also kept changing, whose fluid amount is jumping from x B to 2x B then back (eg 64B lava to 128B then 64B).

The true cause of the amount changing is the line in FluidTankLong#getFluidStack(), which the function is called in isFluidEqual:

if (internal.amount != lastFluidAmountInStack) {
    storedAmount -= lastFluidAmountInStack - internal.amount;
}

for example, storedAmount is 64B, but the lastFluidAmountInStack is 0, then it makes the amount added to 128B.

I'm not sure what does this lastFluidAmountInStack do, but removing it fixes this problem.

@Taskeren Taskeren requested review from a team and Glease June 14, 2025 06:54
@Taskeren Taskeren added the bug Something isn't working label Jun 14, 2025
@Dream-Master Dream-Master added the 🚧 Testing on Zeta Do not merge yet, testing this PR on Zeta label Jun 20, 2025
@serenibyss serenibyss removed the 🚧 Testing on Zeta Do not merge yet, testing this PR on Zeta label Jun 28, 2025
@serenibyss serenibyss merged commit 4b84a09 into master Jun 28, 2025
1 check passed
@serenibyss serenibyss deleted the fix/fluid-widget-detect branch June 28, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments