private void manageInventory() { if (FluidContainerUtils.isFluidContainer(inventory[0])) { FluidStack ret = FluidContainerUtils.handleContainerItem( this, inventory, editMode, fluidTank.getFluid(), getCurrentNeeded(), 0, 1, null); if (ret != null) { fluidTank.setFluid(PipeUtils.copy(ret, Math.min(fluidTank.getCapacity(), ret.amount))); int rejects = Math.max(0, ret.amount - fluidTank.getCapacity()); if (rejects > 0) { pushUp(PipeUtils.copy(ret, rejects), true); } } } }
@Override public int fill(EnumFacing from, FluidStack resource, boolean doFill) { if (resource != null && canFill(from, resource.getFluid())) { int filled = fluidTank.fill(resource, doFill); if (filled < resource.amount && !isActive) { filled += pushUp(PipeUtils.copy(resource, resource.amount - filled), doFill); } if (filled > 0 && from == EnumFacing.UP) { if (valve == 0) { needsPacket = true; } valve = 20; valveFluid = resource.getFluid(); } return filled; } return 0; }