Fluid Handler
High-level API
Device name:
fluid_handlerProvided by any tank connected through a bus interface, including cauldrons and the tanks of other mods. To move fluids between tanks, use a transposer. Amounts are in millibuckets, a bucket being 1000.
With several tanks connected,
find may return any of them. To grab a specific one, give the bus interface in front of the one you want a name with a wrench, and find it by that name instead.Methods
getFluidInTank(tank:number):tableGets what is in the specified tank.
-
tank: the number of the tank to look at.- Returns a table with the fluid
id, such as minecraft:water, and the amount in millibuckets. Returns nothing for an empty tank.getFluidTankCapacity(tank:number):numberGets how much the specified tank can hold.
-
tank: the number of the tank to look at.- Returns the capacity in millibuckets.
getFluidTankCount():numberGets how many tanks the container has.
- Returns the number of tanks.
Mid-level API
Device name:
FLUIDSEach container is listed separately. When several are connected, label the bus interface and pass both the label and
FLUIDS to OCFIND, or check what DEVS lists.Fluid ids are two bytes, low byte first; [
SYSTEM](system.md) provides name lookup. An empty tank reads as fluid 0. Amounts are four bytes, low byte first.Methods
1 getFluidTankCountReads how many tanks the container has.
- Returns one byte, the tank count, at most 255.
2 getFluidTanksReads a run of tanks in one call.
Ask for 1 to 42 tanks; more than that fails with
OCEARG, since the reply would not fit. Reading stops at the end of the container, so asking for 42 tanks starting at 0 gives you as many as there are.- Takes two bytes, the tank to start at and how many tanks to read.
- Returns six bytes per tank: the fluid as two bytes and the amount as four bytes.
3 getFluidTankCapacityReads how much the tank can hold.
- Takes one byte, the tank.
- Returns four bytes, the capacity.