use of net.minecraftforge.fluids.capability.templates.FluidTank in project Electrodynamics by aurilisdev.
the class TileElectrolyticSeparator method tickServer.
public void tickServer(ComponentTickable tickable) {
// ensures only one fluid per output
AbstractFluidHandler<?> handler = getComponent(ComponentType.FluidHandler);
FluidTank oxygen = handler.getOutputTanks()[0];
FluidTank hydrogen = handler.getOutputTanks()[1];
FluidUtilities.outputToPipe(this, new FluidTank[] { oxygen }, OXYGEN_DIRECTION);
FluidUtilities.outputToPipe(this, new FluidTank[] { hydrogen }, HYDROGEN_DIRECTION);
}
use of net.minecraftforge.fluids.capability.templates.FluidTank in project Beyond-Earth by MrScautHD.
the class FluidMultiTank method drain.
@Override
public FluidStack drain(int maxDrain, FluidAction action) {
FluidStack drained = null;
for (FluidTank tank : this.getTankList()) {
if (drained == null) {
FluidStack amount = tank.drain(maxDrain, action);
if (!amount.isEmpty()) {
drained = amount;
maxDrain -= amount.getAmount();
}
} else {
FluidStack test = drained.copy();
test.setAmount(maxDrain);
int amount = tank.drain(test, action).getAmount();
drained.grow(amount);
maxDrain -= amount;
}
}
return drained;
}
use of net.minecraftforge.fluids.capability.templates.FluidTank in project Beyond-Earth by MrScautHD.
the class FluidMultiTank method fill.
@Override
public int fill(FluidStack resource, FluidAction action) {
resource = resource.copy();
FluidStack filled = resource.copy();
filled.setAmount(0);
for (FluidTank tank : this.getTankList()) {
int amount = tank.fill(resource, action);
filled.grow(amount);
resource.shrink(amount);
}
return filled.getAmount();
}
use of net.minecraftforge.fluids.capability.templates.FluidTank in project TinkersConstruct by SlimeKnights.
the class AdvancementsProvider method getTankWith.
/**
* Gets a tank filled with the given fluid
*/
private static FluidTank getTankWith(Fluid fluid, int capacity) {
FluidTank tank = new FluidTank(capacity);
tank.fill(new FluidStack(fluid, capacity), FluidAction.EXECUTE);
return tank;
}
use of net.minecraftforge.fluids.capability.templates.FluidTank in project TinkersConstruct by SlimeKnights.
the class TankItemFluidHandler method fill.
@Override
public int fill(FluidStack resource, FluidAction action) {
FluidTank tank = getTank();
int didFill = tank.fill(resource, action);
if (didFill > 0 && action.execute()) {
updateContainer(tank);
}
return didFill;
}
Aggregations