fix external storage showing as overfull (#2529)

This commit is contained in:
Darkere
2020-06-07 12:18:09 +02:00
committed by GitHub
parent 0341e6a79b
commit 6830a1858d
3 changed files with 6 additions and 6 deletions

View File

@@ -24,5 +24,5 @@ public interface IExternalStorage<T> extends IStorage<T> {
/**
* @return the capacity of the connected storage
*/
int getCapacity();
long getCapacity();
}

View File

@@ -43,11 +43,11 @@ public class FluidExternalStorage implements IExternalStorage<FluidStack> {
}
@Override
public int getCapacity() {
public long getCapacity() {
IFluidHandler fluidHandler = handlerSupplier.get();
if (fluidHandler != null) {
int cap = 0;
long cap = 0;
for (int i = 0; i < fluidHandler.getTanks(); ++i) {
cap += fluidHandler.getTankCapacity(i);

View File

@@ -44,17 +44,17 @@ public class ItemExternalStorage implements IExternalStorage<ItemStack> {
}
@Override
public int getCapacity() {
public long getCapacity() {
IItemHandler handler = handlerSupplier.get();
if (handler == null) {
return 0;
}
int capacity = 0;
long capacity = 0;
for (int i = 0; i < handler.getSlots(); ++i) {
capacity += Math.min(handler.getSlotLimit(i), handler.getStackInSlot(i).getMaxStackSize());
capacity += handler.getSlotLimit(i);
}
return capacity;