Repository navigation
Registering Machines
Advertise your block’s typeId so a Machine Interface can pair with it. DNS does not run your machine. It connects that block to an Interface so items can move, and so you can receive power and talk to storage and autocraft.
Each world load: waitReady, clearAdapters, addAdapter for every machine type, then one register({ source }). addAdapter queues entries until register. Calling it twice without clearAdapters duplicates them. register with a source replaces the whole set for that source.
if (!(await dns.waitReady())) {
// DNS is off this world, or the packs don't match — keep your own storage
} else {
dns.clearAdapters();
dns.addAdapter({
ids: ["example:crusher"],
in: [0],
out: [2],
signal: true, // you call outputsReady when the job finishes
});
dns.addAdapter({
ids: ["example:dorios_mill"],
in: [],
out: [],
slotProtocol: "dorios",
energyProtocol: "dorios",
});
await dns.register({ source: "example-pack" });
}| Field | Meaning |
|---|---|
ids |
Block typeIds that may pair |
in / out
|
Static collection indexes (ignored when slotProtocol is "dorios") |
inv |
Default entity. "block" = the block’s own inventory. Slot protocols if you use "dorios"
|
signal |
true: drain only when you send outputsReady. Omit or false: DNS polls outputs about once per second |
slotProtocol |
See Slot protocols |
energyProtocol |
See Energy |
source is a stable string you choose for this pack. Call register({ source }) every world load.
Register the same machines each world load. Placing a machine still pairs. If you change what you advertise, register again.
Omit source only for a list that lasts this world load (gone on reload, and register always sends every entry). You still need register({ source }) if you use ipc energy or Power Adapter pull/push — including an empty list.
Start
Using DNS
Reference