Repository navigation
API
Dylan Brose edited this page Aug 30, 2026
·
4 revisions
Drop-in (see Installation):
import { createBedrockClient } from "./dns-peer-client.js";
const dns = createBedrockClient();Bundler:
import { createBedrockClient } from "@mcbe-dns-peer/client/bedrock";Get dns-peer-client.js from mcbe-dns-peer-client Releases.
at is { d, x, y, z } (d = dimension id, for example minecraft:overworld). Tags: xxdmogxx_dns:gateway, xxdmogxx_dns:energy_port.
Most calls return undefined if waitReady is false or the call timed out. That is not { ok: false }.
| Method | Role |
|---|---|
waitReady() |
Finds DNS; false if missing or mismatch |
stock(at, typeId) |
Gateway counts: n simple, u unique. Returns Reply
|
list(at, typeId) |
Same plus items[] { snap, n }. Returns ListReply
|
deposit(at, stack, n?) |
Store up to 64. n defaults to stack.amount. Returns Reply (n = accepted). Does not empty the stack you passed |
withdraw(at, typeId, n, uniqueSnap?) |
Returns ItemStack | undefined. uniqueSnap is an ItemStack or a list snap string |
craftStart(at, typeId, n) |
Queue autocraft at a Gateway (same amount as in-game Confirm) |
clearAdapters() |
Empty queued addAdapter entries (not yet registered) |
addAdapter(entry) |
Queue one machine type. Call clearAdapters if you rebuild the list |
register({ source }) |
Send the list. source required for ipc / Adapter energy |
outputsReady(at) |
Job finished at your machine |
subscribeEnergyPull / unsubscribeEnergyPull
|
Pull watts (machine ipc or Adapter) |
subscribeEnergyPush / unsubscribeEnergyPush
|
Push watts at Adapter |
energyStock(at) |
Query Adapter watts |
forgetPair(at) |
Remove your pack’s pair dynamic property and machine pull. Call on your block break and stale unpaired
|
isPaired(at) |
True if this pack still has a pair entry for that machine |
onWake / onPair / onUnpair
|
Subscribe; returns unsubscribe. onPair is new pairs this world load only |
Reply: { ok, err?, n?, u?, snap? }. err: "bad" on energy subscribe usually means you have not register({ source }) yet.
See Installation · Gateway · Registering machines · Energy · Pairing, wake, outputs.
Start
Using DNS
Reference