use of com.enderio.core.api.common.util.ITankAccess in project EnderIO by SleepyTrousers.
the class ReservoirTankWrapper method setTanksDirty.
@Override
public void setTanksDirty() {
if (tank != null) {
FluidStack stack = tank.getFluid();
if (stack != null && stack.amount > 0) {
for (ITankAccess parent : parents) {
FluidTank ptank = parent.getInputTank(stack);
if (ptank != null) {
stack.amount -= ptank.fill(stack, true);
parent.setTanksDirty();
if (stack.amount <= 0) {
return;
}
}
}
}
tank.setCapacity(0);
}
}
use of com.enderio.core.api.common.util.ITankAccess in project EnderIO by SleepyTrousers.
the class ReservoirTankWrapper method getInputTank.
@Override
public FluidTank getInputTank(FluidStack forFluidType) {
FluidTank parentTank = parents.get(0).getInputTank(forFluidType);
if (parentTank == null) {
return null;
}
int free = parentTank.getCapacity() - parentTank.getFluidAmount();
for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext(); ) {
TileEntity neighbor = world.getTileEntity(pos.offset(itr.next()));
if (neighbor instanceof ITankAccess) {
FluidTank tank2 = ((ITankAccess) neighbor).getInputTank(forFluidType);
if (tank2 != null) {
free += tank2.getCapacity() - tank2.getFluidAmount();
parents.add(((ITankAccess) neighbor));
}
}
}
if (free < Fluid.BUCKET_VOLUME) {
free = Fluid.BUCKET_VOLUME;
}
return tank = new SmartTank(parentTank.getFluid(), free);
}
Aggregations