Upgrade fluid interfaces

9 tanks, with up to 64B/fluid with 2 capacity cards
This commit is contained in:
PrototypeTrousers
2022-10-11 23:04:10 -03:00
parent 53f18f8e80
commit f7be92adcf
9 changed files with 98 additions and 16 deletions
@@ -14,7 +14,7 @@ import java.util.Objects;
public class AEFluidInventory implements IAEFluidTank {
private final IAEFluidStack[] fluids;
private final IAEFluidInventory handler;
private final int capacity;
private int capacity;
private IFluidTankProperties[] props = null;
public AEFluidInventory(final IAEFluidInventory handler, final int slots, final int capcity) {
@@ -23,6 +23,10 @@ public class AEFluidInventory implements IAEFluidTank {
this.capacity = capcity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public AEFluidInventory(final IAEFluidInventory handler, final int slots) {
this(handler, slots, Integer.MAX_VALUE);
}
@@ -32,7 +36,7 @@ public class AEFluidInventory implements IAEFluidTank {
if (slot >= 0 && slot < this.getSlots()) {
if (Objects.equals(this.fluids[slot], fluid)) {
if (fluid != null && fluid.getStackSize() != this.fluids[slot].getStackSize()) {
this.fluids[slot].setStackSize(Math.min(fluid.getStackSize(), this.capacity));
this.fluids[slot].setStackSize(fluid.getStackSize());
this.onContentChanged(slot);
}
} else {
@@ -40,7 +44,7 @@ public class AEFluidInventory implements IAEFluidTank {
this.fluids[slot] = null;
} else {
this.fluids[slot] = fluid.copy();
this.fluids[slot].setStackSize(Math.min(fluid.getStackSize(), this.capacity));
this.fluids[slot].setStackSize(fluid.getStackSize());
}
this.onContentChanged(slot);