Skip to content

Commit

Permalink
simplify constructor slightly
Browse files Browse the repository at this point in the history
comments
  • Loading branch information
ghzdude committed Dec 27, 2024
1 parent f8fd4aa commit b57cee8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public boolean canDrain() {
public boolean canFillFluidType(FluidStack fluidStack) {
if (allowSameFluidFill() || fluidStack == null) return true;
for (Entry tank : getParentHandler()) {
// only consider tanks that do not allow same fluid fill
// only consider other tanks that do not allow same fluid fill
if (tank.allowSameFluidFill() || this == tank) continue;
if (fluidStack.isFluidEqual(tank.getFluid())) {
return tank.getFluidAmount() + fluidStack.amount <= tank.getCapacity();
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/gregtech/api/capability/impl/FluidTankList.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ public FluidTankList(boolean allowSameFluidFill, @NotNull List<? extends IFluidT
public FluidTankList(boolean allowSameFluidFill, @NotNull MultipleTankHandler parent,
IFluidTank... additionalTanks) {
int tanks = parent.size();
int additional = 0;

if (!ArrayUtils.isEmpty(additionalTanks))
additional = additionalTanks.length;
int additional = ArrayUtils.getLength(additionalTanks);

this.tanks = new Entry[tanks + additional];

Expand All @@ -66,6 +63,7 @@ public int fill(FluidStack resource, boolean doFill) {

// search for tanks with same fluid type first
for (Entry tank : fluidTanks) {
// if empty or fluid doesn't match, skip
if (tank.getFluidAmount() == 0 || !resource.isFluidEqual(tank.getFluid()))
continue;

Expand Down

0 comments on commit b57cee8

Please sign in to comment.