// types every side of a mod shares. these are the api mods see, not the engine's own classes: // items are { id, count, data } here, like on the network export type Id = string; export interface ItemStack { readonly id: Id; count: number; // any json value, set by server scripts data?: unknown; } // the registries tags are for, see docs/modding/resources/tags.md export type TagRegistry = "blocks" | "items" | "entities"; // every mod's tags, the same on the server and every client. tags can be written with or without their # export interface TagApi { // whether any mod defines the tag and it loaded exists(registry: TagRegistry, tag: Id): boolean; // whether id is in the tag, like has("items", "bworld:planks", "bworld:birch_planks"). false for a tag nobody defines has(registry: TagRegistry, tag: Id, id: Id): boolean; // every id in the tag, including its tags' ids, in the order they were added. empty for a tag nobody defines get(registry: TagRegistry, tag: Id): Id[]; // every tag id is in of(registry: TagRegistry, id: Id): Id[]; // the items a recipe's item choice stands for, once each: an item id or "#tag", or a list of those expand(choice: Id | Id[]): Id[]; } export interface ModInfo { readonly id: string; readonly version: string; } export interface Position { x: number; y: number; z: number; } export type Face = "west" | "east" | "bottom" | "top" | "north" | "south"; // KeyboardEvent.code values, like "KeyE" or "Digit1" export type KeyCode = string; export type Unsubscribe = () => void; export interface EventSignal { subscribe(handler: (event: T) => void): Unsubscribe; }