Skip to content

API Reference

github-actions[bot] edited this page Sep 29, 2026 · 3 revisions

API reference

import { createBedrockClient } from "@mcbe-registry/client/bedrock";

const registry = createBedrockClient();

createBedrockClient connects this library to the host using Bedrock system and mcbe-ipc. An optional argument is a timeout in ticks for get, list, match, result, register, and similar calls after the host is up. Timeouts return unavailable values.

Call dispose() when you are done (drops discovery listeners).


registerFilledKinds(client, source, documents)

Queues and registers each non-empty kind after waitReady. Missing host → { ok: true } and no register (no missing-host warn). Invalid source → { ok: false, err: "bad" }. Empty kind lists are skipped.

The register template calls this. You can call it from your own script:

import { createBedrockClient, registerFilledKinds } from "@mcbe-registry/client/bedrock";

const registry = createBedrockClient();
await registerFilledKinds(registry, "mymod", {
  item: [{ id: "mymod:widget" }],
});

waitReady(): Promise<boolean>

Return Meaning
true Host is up and this client can talk to it
false Timed out or the host and client do not match — treat the catalog as unavailable

catalogMinecraft(): string | undefined

Version label of the vanilla snapshot the host loaded, if it advertised one. Not the player’s Minecraft version.


add(kind, document): void

Queue a document for the next register of that kind. Kinds: block, entity, fluid, gas, item, loot, pack, recipe, tag.

addRecipe / clearRecipes are the same queue for recipe only.


register(opts?): Promise<{ ok: boolean, err?: string } | undefined>

await registry.register({ source: "mymod", kind: "item" });
await registry.register({ source: "mymod", kind: "fluid" });
await registry.register({ source: "mymod", kind: "recipe" });

source is your pack id. kind is which table. Without source, the list is session-only. If you omit kind, it is recipe.

undefined means timeout. See Registering.


get(kind, id)

Full document. undefined if that id is not in the catalog or the call timed out.

await registry.get("item", "mymod:widget");
await registry.get("fluid", "mymod:latex");
await registry.get("recipe", "mymod:crush_cobble");

list(kind, filter?)

await registry.list("item");
await registry.list("fluid", { vanilla: false });
await registry.list("loot", { block: "minecraft:diamond_ore" });
await registry.list("recipe", { station: "minecraft:furnace" });

Timeout → empty lists. See Asking the catalog.


match(query) / result(query)

Recipe ids vs recipe outputs, at one station (block type id). See Asking the catalog. undefined = timeout.


subscribe / track / catalog()

subscribe notifies when a kind changes. track keeps a RAM copy; catalog() is undefined until track succeeds.

See Subscribing and Tracking.


unregister(ids): Promise<void>

Remove recipes by id. Missing ids are ignored.


Units and loot hand

import { BOTTLE, BUCKET, mb, toMb, LOOT_TOOL_NONE } from "@mcbe-registry/client";

mb(1);
toMb(BUCKET);

LOOT_TOOL_NONE is "none" (empty hand on loot tools). Use BOTTLE, BUCKET, and mb instead of raw numbers. Loot chance is percent 0–100 (100 = always).

Clone this wiki locally