Skip to main content

Machine IO

Machine IO controls how automation interacts with each face of a machine. A face can accept recipe inputs, expose completed outputs, or remain disabled without changing the machine's internal recipe logic.

This section uses the template's real machines:

MachineResourcesPurpose
Example Thermal CrusherItemsOne input slot, one output slot, and six configurable faces.
Example Fluid WasherItems and one liquidConsumes Example Coolant from indexed liquid tank 0.
Example Gas ReactorItems and two gasesConsumes Hydrogen from gas index 0 and produces Exhaust in gas index 1.

All examples import public APIs from DoriosCore:

import {
FluidStorage,
GasStorage,
Machine,
registerIOInterface,
} from "DoriosCore/index.js";

Your extension registers its policies from addon-owned scripts. It does not modify DoriosCore.

The three parts of machine IO

registerIOInterface()
defines allowed slots, tanks, modes, and face buttons

machine.processIO()
performs transfers with compatible adjacent containers

uc.io_tab
displays and cycles the registered six-face buttons

All three parts must agree. A UI index that does not match its registered buttonSlots displays the wrong button or no valid outline.

Slots and resource indices are different

The helper entity has an item inventory. Energy, liquids, and gases also have their own indexed storage systems.

ValueExampleMeaning
Item slot3Physical slot in container_items.
Display slot4Inventory slot containing a generated resource-bar frame item.
Liquid index0First liquid tank managed by FluidStorage.
Gas index1Second gas tank managed by GasStorage.
Button slot15Inventory slot reserved for one clickable IO face button.

Liquid index 0 is not item slot 0. The liquid's current level can be rendered at any free display slot by calling fluid.display(slot).

Relative faces and physical directions

Players configure faces as:

top, left, front, right, bottom, back

DoriosCore converts those relative faces into the block's physical world directions using its placement state. The stored configuration uses absolute directions, so rotating the block at placement gives the visible front, left, and right their expected meaning.

What processIO does not own

machine.processIO() moves allowed resources between compatible neighboring endpoints. It does not:

  • execute recipes;
  • decide which liquid or gas a recipe needs;
  • create missing resource display items;
  • register custom fluids or gases;
  • own UtilityCore networks.

UtilityCore remains responsible for its networks. Machine recipes and storage validation remain addon-owned.

Tutorial order

  1. Item inputs and outputs
  2. Configure the six faces
  3. Liquid IO
  4. Gas IO

The first two pages extend the crusher from the previous sections. The liquid and gas pages then use the template's specialized machines to show the extra storage requirements.

For the complete signatures and validation rules, see the technical registerIOInterface and processIO references.

Start with Item inputs and outputs.