IFluidHandlerItem

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.IFluidHandlerItem;

Implements

IFluidHandlerItem implements the following interfaces:

IFluidHandler

Operators

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

Parameters:

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

Return Type: IFluidStack

Members

Getter
Gets the container of this handler.
script.zs
// IFluidHandlerItem.container as ItemStack
myIFluidHandlerItem.container

Return Type: ItemStack

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
// IFluidHandlerItem.drain(resource as IFluidStack, action as FluidAction) as IFluidStack;
myIFluidHandlerItem.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
// IFluidHandlerItem.drain(maxDrain as int, action as FluidAction) as IFluidStack;
myIFluidHandlerItem.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
// IFluidHandlerItem.fill(resource as IFluidStack, action as FluidAction) as int;
myIFluidHandlerItem.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
// IFluidHandlerItem.getFluidInTank(tank as int) as IFluidStack;
myIFluidHandlerItem.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
// IFluidHandlerItem.getTankCapacity(tank as int) as int;
myIFluidHandlerItem.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
// IFluidHandlerItem.isFluidValid(tank as int, stack as IFluidStack) as bool;
myIFluidHandlerItem.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
// IFluidHandlerItem.tanks as int
myIFluidHandlerItem.tanks

Return Type: int