From 0c0a6655a54a94c852735f317fa1583e9421d1a0 Mon Sep 17 00:00:00 2001 From: lordIcocain Date: Mon, 12 May 2025 00:40:39 +0300 Subject: [PATCH 1/3] fix math --- .../glodblock/github/common/storage/FluidCellInventory.java | 5 ++--- 1 file changed, 2 insertions(+), 3 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 436d458e..334b724e 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -226,12 +226,11 @@ public class FluidCellInventory implements IFluidCellInventory { if (types == 0) types = this.getTotalFluidTypes(); if (l != null) { if (restrictionLong > 0) { - remaining = Math.min((restrictionLong / types) - l.getStackSize(), this.getUnusedFluidCount()); + remaining = Math.min((restrictionLong / types) - l.getStackSize(), getRemainingFluidCount()); } else { remaining = (((this.getTotalBytes() / types) - (int) Math.ceil((double) l.getStackSize() / singleByteAmount) - - getBytesPerType()) * singleByteAmount) - + (singleByteAmount - l.getStackSize() % singleByteAmount); + - getBytesPerType()) * singleByteAmount); } } else { if (restrictionLong > 0) { From f31956ecc56d281d3be44f76b0bb7aae1c560539 Mon Sep 17 00:00:00 2001 From: lordIcocain Date: Mon, 12 May 2025 00:54:55 +0300 Subject: [PATCH 2/3] simplify --- .../glodblock/github/common/storage/FluidCellInventory.java | 4 +--- 1 file changed, 1 insertion(+), 3 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 334b724e..2f9e7df4 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -228,9 +228,7 @@ public class FluidCellInventory implements IFluidCellInventory { if (restrictionLong > 0) { remaining = Math.min((restrictionLong / types) - l.getStackSize(), getRemainingFluidCount()); } else { - remaining = (((this.getTotalBytes() / types) - - (int) Math.ceil((double) l.getStackSize() / singleByteAmount) - - getBytesPerType()) * singleByteAmount); + remaining = (((getTotalBytes() / types) - getBytesPerType()) * 8) - l.getStackSize(); } } else { if (restrictionLong > 0) { From 1163beabdfc365b81736d85c0ce8a896dabfafe7 Mon Sep 17 00:00:00 2001 From: lordIcocain Date: Mon, 12 May 2025 01:23:48 +0300 Subject: [PATCH 3/3] correct singleByteAmount --- .../com/glodblock/github/common/storage/FluidCellInventory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2f9e7df4..f1c54283 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -228,7 +228,7 @@ public class FluidCellInventory implements IFluidCellInventory { if (restrictionLong > 0) { remaining = Math.min((restrictionLong / types) - l.getStackSize(), getRemainingFluidCount()); } else { - remaining = (((getTotalBytes() / types) - getBytesPerType()) * 8) - l.getStackSize(); + remaining = (((getTotalBytes() / types) - getBytesPerType()) * singleByteAmount) - l.getStackSize(); } } else { if (restrictionLong > 0) {