Veil versions, and which one you need
MOD 制作ドキュメントは、いまのところ韓国語だけです。
Every mod reports its Veil version through an exported mc_abi() function. The game accepts 1, 2, 3, 4, 5 and 7. There is no 6: the features added "in v6" are switched on through the manifest's groups field on version 4 and 5 mods.
If you use veil_mod!, you usually do not need to know any of this. The macro picks the version for you. The rest of this page explains how it decides and what to do when it cannot.
Two rules hold for every version:
- A mod that calls a function from a newer version than it declares is refused at load time.
tools/mods-check.shandmc189 mod checkrefuse it too. - A newer version can call everything from the older ones. Old mods keep running on new games.
The macro picks the version
| What you filled in | Version the macro picks | Why |
|---|---|---|
Only main (a client-side body) | 4 | The lowest version that has every client feature: HUD, keys, inventory, entities, poses, models, camera, fx, render, anim, ui2, modapi |
Any of content, common, client, server_init, server_tick, event, net_recv, *_hook, container_* | 5 | Blocks, items, mobs and server code need the version 5 layout: one wasm that runs on both client and server. You can still have main alongside |
The above, plus server bodies (body), mod sounds (sound) or server packs (srvpack) | write abi: 7 | A macro cannot look inside function bodies. If you forget, mc189 mod check and the game both tell you to set it to 7 |
To choose the version yourself, add abi: N (one of 1, 2, 3, 4, 5, 7). There is rarely a reason to: the game never drops a version it once accepted, so staying on 4 or 5 costs nothing. If you do pin a version and then call something newer, mc189 mod build names the function, its version and the field to change.
The smallest possible mod:
#![no_std]
use mc189_mod_sdk::prelude::*;
struct M;
impl Mod for M {
fn init() -> Self {
subscribe(sub::HUD);
M
}
fn hud(&mut self, _partial: f32, _gw: u32, _gh: u32) {
hud::text(4.0, 4.0, 0xFFFF_FFFF, true, "hello");
}
}
veil_mod! {
id: "hello",
name: "Hello",
version: "0.1.0",
main: M, // version 4, no abi field needed
}
veil_mod! fields
Order does not matter. A misspelt or repeated field is a compile error that names the field and lists the valid ones.
| Field | Meaning |
|---|---|
id, name, version | Required. id must match [a-z0-9_]{1,32} |
description, authors | Optional, empty if left out |
main: Type | Client-side body: a type implementing the Mod trait (init, tick, hud, event, world, input, shutdown) |
abi: N | Pin the version yourself |
groups: [..] | Permission groups (table below). Required if you use ui, container, store or gameplay |
caps, depends, side, category | Manifest fields, passed through as-is |
settings: TABLE | Settings table (a settings::Table constant, or a JSON string) |
hud_parts: ["id" = "Label", …] | Pieces the HUD layout editor can move |
res: ["a.png" => include_bytes!(..), …] | Embedded resources (textures, models) |
content: TABLE | A decl::Content constant. The macro registers it, sets up its models and checks it at compile time |
common: f, client: f | Extra registration (both sides) or appearance (client only) functions, for things the table does not cover |
server_init, server_tick, event, net_recv | Server start, server tick, server event bus, mod packets |
block_hook, item_hook, ent_hook, client_te, container_hook, container_draw | Hooks for blocks, items, mobs, tile bytes and containers |
The wasm produced by veil_mod! has exactly the same shape as the one the old macros produce: the same export names and signatures and the same mc189-mod JSON fields. Nothing changed on the game side.
The old way: mc189_mod! and mc189_mod_v5!
Most existing mods and examples use these two macros. They keep working and will not be removed. Use veil_mod! for new code.
| What you need | Version | Old macro |
|---|---|---|
| HUD text and boxes, keys, chat, settings, own player state | 1 (no abi) | mc189_mod!(M, id = …) |
| Inventory, entities, reading blocks, scoreboard, item icons, zoom, freelook, mod screens, channels | 2 | mc189_mod!(M, abi = 2, …) |
| Bone poses, cosmetic models, skins and capes, camera, resource bundles, mod-to-mod API | 3 | abi = 3 |
Particles, sounds and beams (fx), post-processing (render), skeletal animation, ui2, groups, depends, draw3, input | 4 | abi = 4 |
| Blocks, items, mobs, server code, containers, storage, server events, mod packets | 5 | mc189_mod_v5! |
| Server bodies, mod sounds, server packs | 7 | mc189_mod_v5!(abi = 7, …) |
How the new way differs:
- The old way has two separate shapes.
mc189_mod!uses theModtrait;mc189_mod_v5!takes plain functions by name and has noModtrait, so a mod with both a HUD and a block had to exportmc_tickandmc_hudby hand.veil_mod!takesmainandcontenttogether. - The old macros have a fixed argument order (
groupsafterauthors,dependslast,commonmandatory for v5, and so on).veil_mod!takes fields in any order and does not requirecommon. - The old way needs
extern crate alloc;plus ause alloc::…line for every type. The new way is oneuse mc189_mod_sdk::prelude::*;. The prelude works with the old macros too.
Permission groups
| Group | Contains |
|---|---|
base | The whole mc module (hud, keys, chat, config, inv, ents, world, board, ctl, ui, pose, model, cam, content, modapi, res, anim) |
fx | fx, sound |
render | render, draw3 |
ui | ui2 |
content | reg, block, item, ent, p4 |
server | srv, srvblock, srvitem, srvent, srvdata, srvevent, net (including the client-side send), body, srvpack (human review) |
container | container |
store | store |
caps | Capability features (human review and signing) |
gameplay | input (human review) |
net | Reserved |
If you write groups, list every group you use, starting with base. A missing group means the game refuses to link the mod. If you leave groups out entirely, the mod is treated as using only the v1 to v5 groups (base, fx, render, caps, content, server); ui, container, store, gameplay and net must always be listed.
srvdata, srvevent and net are in the server group (source: server/isrv/src/v6/mod.rs, MODULES). If you write groups, include server, or the game refuses to link the mod; that also applies to a mod that only uses the client-side net::send. Old mods without groups (such as the srv_showcase example) keep working, because server is one of the v1 to v5 groups. The net group is the slot for outside networking (mc_http) and is not the net module (mc_net).
SDK version and compatibility promise
The SDK crate is at 0.5.1 (mods-sdk/Cargo.toml). Version 4 and later mods record it in the manifest's sdk field. mc189 mod abi prints the version table.
- The game never removes a Veil version it has accepted. Within a version, imports, events and struct fields are only ever added, never renamed or changed.
- The SDK follows semver. While it is 0.x, a minor bump means a new Veil version or a breaking Rust API change; a patch is fixes and additions.
- A mod whose
mc_abithe game does not know is not started.
"This mod was built with a newer SDK than this game. Update the game." means the mod's mc_abi is higher than anything this game knows. The game is out of date, not the mod.
When a mod does not load
bash tools/mods-check.sh FILE.wasm (or mc189 mod check FILE.wasm) compares mc_abi with the newest import the mod uses. The common messages, translated:
- "v1 mod (mc_abi=1) uses v2 import 'mc.…'": with
veil_mod!, delete theabi:field and the macro picks 4. With the oldmc189_mod!, raiseabi = N. - "mc_abi = 5 mod uses v7 import …": add
abi: 7toveil_mod!, or usemc189_mod_v5!(abi = 7, …). - "v5 mod (...) but mc_abi() returns 4": the mod has v5 exports (blocks, server) but the wrong version.
veil_mod!refuses this at compile time. - "import '…' is in group '…' but 'groups' does not list it": add that group to
groups.