Skip to content

Codex Logic Foreign Machines

CaptainGummiball edited this page Nov 10, 2026 · 1 revision

Foreign Machines

The Factory Controller can also run machines of other mods. For that, a mod or an add-on tells QNet what such a machine can make; a Machine Interface in front of the machine then fills it and empties it like a QNet machine.

For players

  1. Install the mod or add-on that describes the machine to QNet (QNet itself describes no foreign machines).
  2. Put a Machine Interface against the machine and link it to the Storage Controller of the factory.
  3. The machine appears in the Machines tab of the Factory Controller with tier 1, and its products in the list of things to make.

The interface uses the machine's normal inventories, the same ones pipes use. Nothing else of the machine is touched: its own energy, settings and upgrades stay its business.

Warning

Only products may be taken The interface takes everything the machine lets pipes take out. If the machine lets pipes take its inputs too, the interface takes them back out at once. Such a machine does not work with the factory.

For mod and pack authors

QNet's public API has the interface ProductionCapabilityProvider (package dev.cptgummiball.qnet.api.automation). A provider answers, for a block id, what that machine can make:

  • Register it once while your mod starts, with QNetApi.automation().register(provider). After start-up the API is closed.
  • capabilities(blockId) returns a list of ProductionCapability, or an empty list for blocks the provider does not know. For one block id the first provider with an answer wins. The answer is asked once per block id after every data reload and kept, so it may depend on recipes but not on one block's state.
  • A ProductionCapability has an id (namespaced, unique for that block), the inputs of one run (at least one), the outputs of one run (at least one) and the time of one run in ticks (at least 1; it is only shown).
  • A ProductionStack is an item, fluid or gas with an id and an amount (items in pieces, fluids and gases in mB). Inputs may name a tag as #namespace:path; outputs may not.
  • Only list outputs that come for sure. The planner never counts on chance outputs; the interface takes them anyway.
  • Optionally busy(dimension, pos, blockId) tells whether the machine at a position is working. The controller then waits for its outputs as long as it works; without it, it calls a job done 200 ticks after the last delivery or product.

QNet blocks are never asked; a provider that throws an error counts as not knowing the block (logged once).

How the factory sees a foreign machine

Every capability becomes a recipe of the machine's own kind, qnet_foreign:<namespace>/<block>, at tier 1 and without energy. The planner treats the machine like a QNet machine that knows only these recipes. If a QNet recipe makes the same item, the QNet recipe comes first.

Tip

Example The example add-on in the QNet sources registers a test press that presses one shard into two dusts. Look at it when you write your own provider.

QNet Codex

Getting Started

Energy

Processing

Rift

Storage

Logic

Reference

Items and Blocks

Clone this wiki locally