Repository navigation
WASM Host Functions
github-actions[bot] edited this page Jan 9, 2026
·
1 revision
Host functions available to Core Mods (WASM).
| Function | Parameters | Returns | Description |
|---|---|---|---|
host_get_inventory_slot |
_caller: Caller<'_, ModState>, entity_id: u64, slot: u32 |
Upper 32 bits: item_id, Lower 32 bits: count (0 = empty slot) | Get inventory slot contents |
host_get_machine_state |
_caller: Caller<'_, ModState>, entity_id: u64 |
- 0: Idle | Get machine state by entity ID |
host_log_error |
mut caller: Caller<'_, ModState>, ptr: u32, len: u32 |
Nothing (void function) | Log an error message from WASM mod |
host_log_info |
mut caller: Caller<'_, ModState>, ptr: u32, len: u32 |
Nothing (void function) | Log an info message from WASM mod |
host_set_machine_enabled |
_caller: Caller<'_, ModState>, entity_id: u64, enabled: i32 |
- 0: Success | Enable or disable a machine |
host_subscribe_event |
_caller: Caller<'_, ModState>, event_type: u32 |
Subscription ID (>= 0 on success, negative on error) | Subscribe to game events |
Get inventory slot contents
Parameters:
_caller: Caller<'_ModState>entity_id: u64slot: u32
Returns: Upper 32 bits: item_id, Lower 32 bits: count (0 = empty slot)
Get machine state by entity ID
Parameters:
_caller: Caller<'_ModState>entity_id: u64
Returns:
- 0: Idle
- 1: Processing
- 2: Waiting for input
- -1: Error (entity not found)
Log an error message from WASM mod
Parameters:
mut caller: Caller<'_ModState>ptr: u32len: u32
Returns: Nothing (void function)
Log an info message from WASM mod
Parameters:
mut caller: Caller<'_ModState>ptr: u32len: u32
Returns: Nothing (void function)
Enable or disable a machine
Parameters:
_caller: Caller<'_ModState>entity_id: u64enabled: i32
Returns:
- 0: Success
- -1: Entity not found
- -2: Permission denied
Subscribe to game events
Parameters:
_caller: Caller<'_ModState>event_type: u32
Returns: Subscription ID (>= 0 on success, negative on error)
- Home / ホーム
- Getting Started / はじめに
- Mod Structure / Mod構造
Mod Types
Reference
- Blocks & Items / ブロックとアイテム
- Machines / 機械
- Recipes / レシピ
- Conveyor System / コンベア
- Quest System / クエスト
- Biomes / バイオーム
- Save Format / セーブ形式