From 56703bf498aedc7149f7d20dc33c555d5275174f Mon Sep 17 00:00:00 2001 From: lordIcocain <62835225+lordIcocain@users.noreply.github.com> Date: Mon, 21 Apr 2025 08:51:46 +0300 Subject: [PATCH] Fix math when cell restricted and new fluid added (#284) Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../glodblock/github/common/storage/FluidCellInventory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java index 034f9889..436d458e 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -397,8 +397,10 @@ public class FluidCellInventory implements IFluidCellInventory { if (cardDistribution) { remainingFluidCount = this.getRemainingFluidCountDist(null); } else { - remainingFluidCount = this.getRemainingFluidCount() - - ((long) this.getBytesPerType() * singleByteAmount); + remainingFluidCount = Math.min( + getRemainingFluidCount(), + getFreeBytes() * singleByteAmount + getUnusedFluidCount() + - (long) getBytesPerType() * singleByteAmount); } if (remainingFluidCount > 0) {