Skip to content

Asking the Catalog

Dylan Brose edited this page Sep 28, 2026 · 1 revision

Asking the catalog

Call await registry.waitReady() first. match / result return undefined when the host does not answer in time; a real miss is []. get returns undefined both when the id is absent and when the call times out — if you need to tell those apart, the host was too slow (same causes as a failed waitReady).

Any kind: get and list

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

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

await registry.list("item");
await registry.list("fluid", { vanilla: false });
await registry.list("loot", { block: "minecraft:diamond_ore" });
await registry.list("loot", { tool: "minecraft:iron_pickaxe" });
await registry.list("loot", { tool: LOOT_TOOL_NONE });

list’s first argument is the kind. Filters combine with AND.

  • vanilla: false — documents other packs registered; skip the host’s vanilla snapshot.
  • source: "mymod" — that pack only (mymod is whatever source you passed to register).
  • Loot: block, entity, item (a dropped id), tool (the item used to harvest, or LOOT_TOOL_NONE for empty hand).

One block can have several loot documents (one per distinct drop set). tools on a document is which harvest items produce that set.

Timeout on list returns empty entries and documents.

Recipes at a station: match and result

These two calls exist only for recipes. A station is the block type id the player is using (minecraft:furnace, mymod:crusher, …). The recipe lists one or more stations; every ask uses exactly one.

Call You get
match Recipe ids
result Outputs (optional leftover / timing) — no id

Include at least one of inputs, grid, or pattern+key. If both grid and pattern+key are set, grid wins.

Bag (inputs — order does not matter):

await registry.result({
  station: "minecraft:furnace",
  inputs: ["minecraft:beef"],
});

An ingredient is a type id string, or an object with item / tag / fluid / gas / count / amount / slot. Fluid and gas amount uses BUCKET, BOTTLE, or mb(n) from this package. Amount is not unrolled like item count.

Shaped (pattern + key, same idea as a crafting-table JSON recipe):

await registry.match({
  station: "minecraft:crafting_table",
  pattern: ["A", "A"],
  key: { A: "minecraft:oak_planks" },
});

Grid — nine cells, left-to-right, top-to-bottom. null is empty:

await registry.result({
  station: "minecraft:crafting_table",
  grid: [
    null, "minecraft:oak_planks", null,
    null, "minecraft:oak_planks", null,
    null, null, null,
  ],
});

You can also list("recipe", { station, output, leftover, input }). Compact recipe rows are { id, stations, type?, leftover? } (no outputs).

Clone this wiki locally