목차

Veil versions, and which one you need

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:

  1. A mod that calls a function from a newer version than it declares is refused at load time. tools/mods-check.sh and mc189 mod check refuse it too.
  2. 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 inVersion the macro picksWhy
Only main (a client-side body)4The 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_*5Blocks, 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: 7A 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.

FieldMeaning
id, name, versionRequired. id must match [a-z0-9_]{1,32}
description, authorsOptional, empty if left out
main: TypeClient-side body: a type implementing the Mod trait (init, tick, hud, event, world, input, shutdown)
abi: NPin the version yourself
groups: [..]Permission groups (table below). Required if you use ui, container, store or gameplay
caps, depends, side, categoryManifest fields, passed through as-is
settings: TABLESettings 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: TABLEA decl::Content constant. The macro registers it, sets up its models and checks it at compile time
common: f, client: fExtra registration (both sides) or appearance (client only) functions, for things the table does not cover
server_init, server_tick, event, net_recvServer start, server tick, server event bus, mod packets
block_hook, item_hook, ent_hook, client_te, container_hook, container_drawHooks 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 needVersionOld macro
HUD text and boxes, keys, chat, settings, own player state1 (no abi)mc189_mod!(M, id = …)
Inventory, entities, reading blocks, scoreboard, item icons, zoom, freelook, mod screens, channels2mc189_mod!(M, abi = 2, …)
Bone poses, cosmetic models, skins and capes, camera, resource bundles, mod-to-mod API3abi = 3
Particles, sounds and beams (fx), post-processing (render), skeletal animation, ui2, groups, depends, draw3, input4abi = 4
Blocks, items, mobs, server code, containers, storage, server events, mod packets5mc189_mod_v5!
Server bodies, mod sounds, server packs7mc189_mod_v5!(abi = 7, …)

How the new way differs:

  • The old way has two separate shapes. mc189_mod! uses the Mod trait; mc189_mod_v5! takes plain functions by name and has no Mod trait, so a mod with both a HUD and a block had to export mc_tick and mc_hud by hand. veil_mod! takes main and content together.
  • The old macros have a fixed argument order (groups after authors, depends last, common mandatory for v5, and so on). veil_mod! takes fields in any order and does not require common.
  • The old way needs extern crate alloc; plus a use alloc::… line for every type. The new way is one use mc189_mod_sdk::prelude::*;. The prelude works with the old macros too.

Permission groups

GroupContains
baseThe whole mc module (hud, keys, chat, config, inv, ents, world, board, ctl, ui, pose, model, cam, content, modapi, res, anim)
fxfx, sound
renderrender, draw3
uiui2
contentreg, block, item, ent, p4
serversrv, srvblock, srvitem, srvent, srvdata, srvevent, net (including the client-side send), body, srvpack (human review)
containercontainer
storestore
capsCapability features (human review and signing)
gameplayinput (human review)
netReserved

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.

  1. 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.
  2. 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.
  3. A mod whose mc_abi the 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 the abi: field and the macro picks 4. With the old mc189_mod!, raise abi = N.
  • "mc_abi = 5 mod uses v7 import …": add abi: 7 to veil_mod!, or use mc189_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.