Commands¶
Section notes in abi.h
the core slots, present since ABI v1
Β§H parameterized commands & enums
Slots¶
execute_command¶
| C | |
|---|---|
Execute a command as the server console (permission: Owner) and collect its output. Server thread only. Returns false if the level is not ready.
- Call:
api->execute_command(cmd, ctx, sink) - Parameters:
- cmd :
PierStr - ctx :
void* - sink :
PierCmdOutputSink
- cmd :
- Return type:
bool - Section of abi.h: the core slots, present since ABI v1
- Position in the table: slot 7, counting from 0
- Callers in each binding:
- Rust:
Host::execute_command - Go:
ExecuteCommand - Zig:
executeCommand
- Rust:
register_command¶
| C | |
|---|---|
Register a custom command /name [args: raw text].
| Text Only | |
|---|---|
Call during on_enable, on the server thread. The command stays registered for the lifetime of the server (Bedrock cannot unregister commands); callbacks for disabled mods are muted by the loader.
- Call:
api->register_command(mod, name, description, permission, cb, user) - Parameters:
- mod :
PierModHandle - name :
PierStr - description :
PierStr - permission :
int32_t - cb :
PierCommandCb - user :
void*
- mod :
- Return type:
bool - Section of abi.h: the core slots, present since ABI v1
- Position in the table: slot 8, counting from 0
- Callers in each binding:
- Rust:
command::register - Go:
RegisterCommand - Zig:
registerCommand
- Rust:
register_command_ex¶
| C | |
|---|---|
Like register_command, but with typed overloads. overloads_snbt:
| Text Only | |
|---|---|
kinds: int|bool|float|string|enum|soft_enum|actor|player|block_pos|vec3|
| Text Only | |
|---|---|
The callback's args receives the parse result as SNBT
| Text Only | |
|---|---|
- Call:
api->register_command_ex(mod, name, description, permission, overloads_snbt, cb, user) - Parameters:
- mod :
PierModHandle - name :
PierStr - description :
PierStr - permission :
int32_t - overloads_snbt :
PierStr - cb :
PierCommandCb - user :
void*
- mod :
- Return type:
bool - Section of abi.h: Β§H parameterized commands & enums
- Position in the table: slot 54, counting from 0
- Callers in each binding:
register_command_enum¶
| C | |
|---|---|
values_snbt = {values:[["name",1L],β¦]} β tryRegisterRuntimeEnum.
- Call:
api->register_command_enum(name, values_snbt) - Parameters:
- name :
PierStr - values_snbt :
PierStr
- name :
- Return type:
bool - Section of abi.h: Β§H parameterized commands & enums
- Position in the table: slot 55, counting from 0
- Callers in each binding:
register_command_soft_enum¶
| C | |
|---|---|
values_snbt = {values:["a","b"]} β tryRegisterSoftEnum.
- Call:
api->register_command_soft_enum(name, values_snbt) - Parameters:
- name :
PierStr - values_snbt :
PierStr
- name :
- Return type:
bool - Section of abi.h: Β§H parameterized commands & enums
- Position in the table: slot 56, counting from 0
- Callers in each binding:
update_command_soft_enum¶
| C | |
|---|---|
op: 0=set 1=add 2=remove.
- Call:
api->update_command_soft_enum(name, op, values_snbt) - Parameters:
- name :
PierStr - op :
int32_t - values_snbt :
PierStr
- name :
- Return type:
bool - Section of abi.h: Β§H parameterized commands & enums
- Position in the table: slot 57, counting from 0
- Callers in each binding:
Types¶
PierCommandCb¶
| C | |
|---|---|
Custom command callback.
| Text Only | |
|---|---|
PierCmdOutputSink¶
| C | |
|---|---|
Output sink for execute_command: full command output + success flag.