Skip to content

Pairing and Wake

Dylan Brose edited this page Aug 30, 2026 · 3 revisions

Pairing, wake, outputs

When a Machine Interface pairs or unpairs with your machine, the client tells you (onPair / onUnpair). It does not re-send those after world load. Turning Power supply off is not unpair.

Pair entries are stored in your pack’s world dynamic properties. Each behavior pack has its own (UUID-isolated). DNS cannot clear that entry when your block breaks, so you call forgetPair. The client also unsubscribes machine pull on unpair and on forgetPair. Adapter pull/push are not tied to the machine pair — leave them.

Unpair does not abort the job. Interface insert, drain, and Interface energy stop. Finish locally if you already have enough energy. outputsReady while unpaired returns unpaired (no drain). On re-pair, subscribe pull again if the tank still has room or a job is still running.

After world reload, isPaired is true for machines you already remembered, but onPair does not fire and energy subscriptions are gone. Re-subscribe and inspect your own blocks for jobs — see Installation.

dns.onPair((at) => {
  // new pair this world load — if the buffer has room, or a job there is still running:
  void dns.subscribeEnergyPull(at, wantPerTick);
});

dns.onUnpair((at) => {
  // keep your job at `at`; do not unsubscribe Adapter pull/push
});

dns.onWake((at) => {
  // insert landed, or a drain actually moved items — start or inspect your job at `at`
});

void dns.outputsReady(at); // once when that job finishes; do not retry

On your block break (DNS does not see it). Skip if this is not your type, or !dns.isPaired(at):

if (dns.isPaired(at)) dns.forgetPair(at); // your pack’s pair entry + machine pull
// drop that machine’s local job state

Treat err: "unpaired" on outputsReady / subscribeEnergyPull as a stale pair (you missed unpair). Call forgetPair so your dynamic-property entry is removed and pull is dropped.

outputsReady: call once when a job finishes (signal: true). If the network cannot deposit yet, DNS keeps the request and retries when storage or power unblocks. You get wake if items actually moved.

wake: after insert, and after a drain that moved items.

Clone this wiki locally