IFluidHandler

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.capability.IFluidHandler;

Operators

[](tank as int) as IFluidStack
Gets the fluid in the given tank.
script.zs
// IFluidHandler[tank as int] as IFluidStack
myIFluidHandler[myInt]

Parameters:

tank Type: int - The tank to get the fluid of.

Return Type: IFluidStack

Members

drain(resource as IFluidStack, action as FluidAction) as IFluidStack
Drains fluid out of the internal tanks.

Returns: A new FluidStack representing the fluid that was drained along with how much was drained.

script.zs
// IFluidHandler.drain(resource as IFluidStack, action as FluidAction) as IFluidStack;
myIFluidHandler.drain(<fluid:minecraft:water> * 400, <constant:neoforge:fluid_action:execute>);

Parameters:

resource Type: IFluidStack - The fluid and the maximum amount of the fluid to drain.
action Type: IFluidHandlerAction - Determines if the drain is simulated or executed.

Return Type: IFluidStack

drain(maxDrain as int, action as FluidAction) as IFluidStack
Drains fluid out of the internal tanks.

Returns: A new FluidStack representing the fluid that was drained along with how much was drained.

script.zs
// IFluidHandler.drain(maxDrain as int, action as FluidAction) as IFluidStack;
myIFluidHandler.drain(400, <constant:neoforge:fluid_action:execute>);

Parameters:

maxDrain Type: int - How much fluid should be drained.
action Type: IFluidHandlerAction - Determines if the drain is simulated or executed.

Return Type: IFluidStack

fill(resource as IFluidStack, action as FluidAction) as int
Fills the internal tanks with the given fluid.

Returns: The amount of the fluid that will be used by the fill.

script.zs
// IFluidHandler.fill(resource as IFluidStack, action as FluidAction) as int;
myIFluidHandler.fill(<fluid:minecraft:water>, <constant:neoforge:fluid_action:execute>);

Parameters:

resource Type: IFluidStack - The fluid to fill.
action Type: IFluidHandlerAction - Determines if the fill is simulated or executed.

Return Type: int

getFluidInTank(tank as int) as IFluidStack
Gets the fluid in the given tank.

Returns: The fluid in the tank.

script.zs
// IFluidHandler.getFluidInTank(tank as int) as IFluidStack;
myIFluidHandler.getFluidInTank(0);

Parameters:

tank Type: int - The tank to get the fluid of.

Return Type: IFluidStack

getTankCapacity(tank as int) as int
Gets the capacity of the given tank.

Returns: The capacity of the given tank.

script.zs
// IFluidHandler.getTankCapacity(tank as int) as int;
myIFluidHandler.getTankCapacity(0);

Parameters:

tank Type: int - The tank to get the capacity of.

Return Type: int

isFluidValid(tank as int, stack as IFluidStack) as bool
Checks if the given fluid is valid for the given tank.

Returns: true if the fluid is valid, false otherwise.

script.zs
// IFluidHandler.isFluidValid(tank as int, stack as IFluidStack) as bool;
myIFluidHandler.isFluidValid(0, <fluid:minecraft:water>);

Parameters:

tank Type: int - The tank to check.
stack Type: IFluidStack - The fluid to check.

Return Type: bool

Getter
Gets the number of tanks in this fluid handler.

A single handler can have many tanks holding different fluids

script.zs
// IFluidHandler.tanks as int
myIFluidHandler.tanks

Return Type: int