interface command { use %world.{%world, entity}; use player.{player}; use block-entity.{command-block-entity}; use common.{position, block-pos, locale, game-mode}; use item-stack.{item-stack}; use server.{server, difficulty}; use text.{text-component}; variant command-error { invalid-consumption(option), invalid-requirement, permission-denied, command-failed(text-component), } resource command-node { literal: static func(name: string) -> command-node; argument: static func(name: string, %type: argument-type) -> command-node; then: func(node: command-node); execute-with-handler-id: func(handler-id: u32); require-with-handler-id: func(handler-id: u32); } variant argument-type { %bool, float(tuple, option>), double(tuple, option>), integer(tuple, option>), long(tuple, option>), %string(string-type), entities, entity, players, game-profile, block-pos, column-pos, position3d, position2d, block-state, block-predicate, item, item-predicate, color, component, style, message, nbt-compound-tag, nbt-tag, nbt-path, objective, objective-criteria, operation, particle, angle, rotation, scoreboard-slot, score-holder(bool), swizzle, team, item-slot, resource-location, mob-effect, function, entity-anchor, int-range, float-range, dimension, gamemode, difficulty, time(option), %resource(string), resource-or-tag(string), resource-or-tag-key(string), resource-key(string), template-mirror, template-rotation, uuid, } record entity-argument { single: bool, players-only: bool, } variant command-sender-type { rcon, console, player(player), command-block(tuple), dummy, } enum permission-level { zero, one, two, three, four, } resource command-sender { get-command-sender-type: func() -> command-sender-type; get-name: func() -> string; send-message: func(text: text-component); send-system-message: func(text: text-component); send-error: func(text: text-component); set-success-count: func(count: s32); is-player: func() -> bool; is-console: func() -> bool; as-player: func() -> option; permission-level: func() -> permission-level; has-permission-level: func(level: permission-level) -> bool; has-permission: func(server: borrow, node: string) -> bool; position: func() -> option; %world: func() -> option<%world>; get-locale: func() -> locale; should-receive-feedback: func() -> bool; should-broadcast-console-to-ops: func() -> bool; should-track-output: func() -> bool; } enum string-type { single-word, quotable, greedy, } enum suggestion-type { ask-server, all-recipes, available-sounds, available-biomes, summonable-entities, } variant arg { simple(string), msg(string), %bool(bool), item(string), item-predicate(string), resource-location(string), block(string), block-predicate(string), time(s32), num(result), block-pos(block-pos), pos3d(tuple), pos2d(tuple), rotation(tuple), gamemode(game-mode), difficulty(difficulty), players(list), particle(string), text-component(text-component), bossbar-color(bossbar-color), bossbar-style(bossbar-style), sound-category(sound-category), damage-type(string), effect(string), enchantment(string), entity-anchor(entity-anchor), } enum bossbar-color { pink, blue, red, green, yellow, purple, white, } enum bossbar-style { no-division, notches6, notches10, notches12, notches20, } enum sound-category { master, music, records, weather, blocks, hostile, neutral, players, ambient, voice, } enum entity-anchor { eyes, feet, } variant number { float64(f64), float32(f32), int32(s32), int64(s64), } variant not-in-bounds { lower-bound(tuple), upper-bound(tuple), } resource consumed-args { get-value: func(key: string) -> arg; } resource command { /// First name is primary, rest are aliases constructor(names: list, description: string); then: func(node: command-node); execute-with-handler-id: func(handler-id: u32); } }