{"url":"https://levimc.org/mods/github.com/Maskviva/Pier/","id":"github.com/Maskviva/Pier","name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","owner":"Redstone-Circuit-Communication","logo":"https://levimc.org/mods/icons/851ff45d3b121d99-288.webp","repository":"https://github.com/Redstone-Circuit-Communication/Pier","issues":"https://github.com/Redstone-Circuit-Communication/Pier/issues","releases":"https://github.com/Redstone-Circuit-Communication/Pier/releases","stars":7,"downloads":112,"updated":"2026-10-29T07:27:15Z","published":"2026-09-13T09:28:05Z","created":"2026-08-30T08:11:17Z","license":"Apache-2.0","side":["server","client"],"platform":["win-x64"],"gameVersions":["1.26.51","1.26.40","1.26.32","1.26.20"],"tags":["platform:levilamina","type:mod","type:loader"],"latest":{"variant":"","version":"26.51.3","install":"lip install github.com/Maskviva/Pier@26.51.3"},"readmes":[{"file":"README.md","lang":"en","text":"<h1 align=\"center\">Pier</h1>\n\n<p align=\"center\">\n  <b>A LeviLamina mod loader for languages other than C++.</b>\n</p>\n\n<p align=\"center\">\n  <a href=\"../../actions/workflows/build.yml\"><img src=\"../../actions/workflows/build.yml/badge.svg\" alt=\"Build\"></a>\n  <a href=\"https://github.com/Maskviva/pier/releases\"><img src=\"https://img.shields.io/github/v/release/Maskviva/pier?color=334155\" alt=\"Release\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-Apache--2.0-blue\" alt=\"Apache-2.0\"></a>\n  <img src=\"https://img.shields.io/badge/BDS-1.26.51-62B47A\" alt=\"BDS 1.26.51\">\n  <img src=\"https://img.shields.io/badge/LeviLamina-26.51.7-8B5CF6\" alt=\"LeviLamina 26.51.7\">\n</p>\n\n<p align=\"center\">\n  <a href=\"README.md\">English</a> ·\n  <a href=\"README.zh.md\">简体中文</a>\n</p>\n\nPier exposes the Bedrock server through one C ABI. A mod is a dynamic library that speaks\nthat ABI, so the language it is written in is the author's choice rather than the\nplatform's.\n\nRust, C++, Go and Zig have official bindings. Anything else with a C FFI can have one,\nand adding it does not require touching Pier.\n\n## Why Pier exists\n\nIt started as [levilamina-rust-loader](https://github.com/Maskviva/levilamina-rust-loader),\nbuilt to answer one question: can a LeviLamina mod be written in Rust?\n\nIt could, and the answer surfaced a harder problem. The loader had grown its interface by\naccretion, one function at a time, and the shape underneath was wrong in ways that could\nnot be patched out:\n\n- **The layout forked per build target.** Conditional blocks meant the tail of the\n  function table sat at a different offset on a client build than on a server one. A\n  version-number marker was added to compensate, that marker could not protect a mod\n  nobody had rebuilt, and every slot past the fork landed on the wrong function pointer\n  while both sides compiled cleanly.\n- **The center called out to every capability.** The dispatch table named each package's\n  functions directly, so a capability could not be dropped from a build without the link\n  failing. \"Optional\" was a word in the documentation, not a property of the code.\n- **Missing values became plausible ones.** An unreadable field came back as a zero that\n  looked like a legitimate answer. A land protection mod read an unresolvable dimension as\n  the overworld, refused inside the overworld and allowed everything everywhere else, and\n  logged nothing.\n- **Event names matched on substrings.** The day upstream added an event sharing a stem,\n  a subscriber would be silently redirected to a synthetic event with a different payload\n  shape, with no route back to the real one.\n\nEach of those is fixable in isolation. Together they say the interface was never designed,\nonly grown. The loader was a test, it did what a test is for, and it is not maintained.\n\nPier is the redesign: the interface first, the implementation second.\n\n## How Pier is designed\n\nThe whole of Pier is one header,\n[`packages/pier-abi/include/sdk/abi.h`](packages/pier-abi/include/sdk/abi.h). Everything\nelse in this repository implements it: the C++ host, and every language binding. The\nsections below describe how the things this header settles each work.\n\n### Every target shares one table\n\n`PierApi` carries no conditional compilation. The client-only slots and the custom dimension\nslots sit in the same place on every build, and hold NULL when the matching package was not\ncompiled in.\n\nA mod that wants to know whether the host has a capability looks at that slot at runtime.\nThe same mod source therefore builds for server and client. The marker once kept in the top\nbits of the version number, and the patches that maintained it, have been removed.\n\n### Capability packages register themselves\n\nPier is eight C++ packages. `pier-host` owns the table and the mod lifecycle and does not\nknow what fills the table. Each capability package registers four things with the host\nthrough a service provider interface: the slot pack it fills, the teardown steps it needs,\nwhether it vetoes an unload, and the events it provides.\n\nDelete a package from the build and it registers nothing: its slots stay NULL, and the host\ndoes not change by one line. Each package is one `includes(...)` line of the root build\nfile; remove the line, and configuring, building and running all go on as before. A check\nremoves each package in turn and builds again on every push.\n\nSelf-registration depends on every package being an object library and not a static one. A\nlinker drops the units of a static library that no outside symbol refers to, and the\nregistrations are file-level static objects with no outside reference. Once dropped, the\nfeature is gone and the startup log says nothing. After this was written into the contract\nit was still broken once, in four packages, and the check came after that.\n\n### What crosses the boundary: names and ids\n\nNo pointer into the server crosses the ABI. A player is a selector, an actor an id, a block a\ndimension and a coordinate, and the host looks each up again on every call.\n\nA handle can therefore be kept across ticks. Once the actor is gone, the host cannot find it\nand the call returns an error; it does not land in freed memory. Each call costs a lookup.\n\nLooking a player up by **name** needs care: when no account name matches, the selector falls\nback to the display name, which another mod can change. A player who sets their display\nname to an offline player's account name receives every call addressed by that name. So\npermissions, money and ownership use the xuid, and the Rust binding gives the two selectors\ndifferent types, which shows at the call which one is in use.\n\n### Whoever allocates a buffer frees it\n\nA buffer crossing the boundary is allocated and freed by its producer, and the receiver\ncopies what it keeps. No call returns a pointer for the other side to free: that would need\nboth sides to share an allocator, and a mod and the host each have their own. Every output\ngoes through a sink.\n\n### When a slot cannot answer\n\nA slot that cannot answer does one of three things: it returns a value that can mean \"no\nanswer\"; it logs, falls back, and says in the log what it fell back to; or it refuses.\n\nTake a function deciding whether a player may enter a plot, which cannot answer when the\nplayer cannot be read. Returning a bare boolean, it would give `false` and the caller could\nnot tell \"may not enter\" from \"unknown\", or give `true` and let the unreadable player in. So\nthe return type of such a function has room for the third case.\n\n### How the contract grows\n\nAdding a capability appends a slot and leaves the ABI version alone. Reordering, removing or\nchanging a slot advances both version numbers together, and a mod built before that is\nrefused at load with the reason in the log, rather than running into a slot that moved.\n\nThe load check is a range: `MIN_SUPPORTED <= the mod's version <= the host's version`, so a\nmod built against an older Pier keeps loading.\n\n### The checks in the repository\n\nThe object library rule was first only written in the contract, and a delivery note said it\nheld; then it was broken in the four packages that depend on self-registration. Since then\nevery rule of the contract has a script in `tools/checks/`, and\n`python3 tools/run-checks.py` runs them on every push: that the header parses as C11, that\nthe slot order only grew, that the Rust mirror matches it parameter by parameter, that no\ncapability package has a sideways edge, that no comment describes something the code does\nnot do.\n\nEach check states what it covers and what it cannot see. A delivery note citing a check\ncopies that sentence, so a reader knows which parts still need a person to look.\n\nThe rules themselves are in [`CONTRACT.md`](CONTRACT.md), with the reasoning for each.\n\n## Writing a mod\n\n**[Rust](docs/rust/index.md)** is the first official binding and the most complete one;\n**[C++](docs/cpp/index.md)** works on the header directly, **[Go](docs/go/index.md)**\nbuilds a mod as a c-shared DLL, and **[Zig](docs/zig/index.md)** reads the header through\ntranslate-c.\n\n```rust\nuse levilamina::prelude::*;\n\nstruct MyMod;\n\nimpl LeviMod for MyMod {\n    fn on_load(ctx: &ModContext) -> Result<Self> {\n        ctx.logger().info(\"hello from Rust\");\n        Ok(MyMod)\n    }\n}\n\nlevilamina::register_mod!(MyMod);\n```\n\n- [Your first mod](docs/rust/first-mod.md) walks through building\n  and installing one.\n- [pier-mod-template](https://github.com/Maskviva/pier-mod-template) is a Rust mod that runs\n  as it is: it logs, subscribes to chat, registers a command and schedules a task. Start\n  from it with GitHub's *Use this template*, or with `cargo generate`.\n\n## Binding another language\n\nOne file is enough. `sdk/abi.h` parses as C11, so an FFI tool takes it directly, and it\ndoubles as the reference documentation: every slot states what its parameters mean, what\nit returns on failure, and what it requires of threads.\n\n1. Mirror `PierApi`, declaring every field unconditionally, with no target branch.\n2. Export `pier_main` and fill the vtable with `struct_size`, `abi_version`, `mod_flags`\n   and the three lifecycle callbacks.\n3. Before calling a non-core slot, check that `struct_size` covers it and that the slot is\n   not NULL.\n\n`bindings/rust/pier-sys-rs` is the reference implementation.\n[Adding a language](docs/guide/adding-a-language.md) has the\ndetails, and section 10 of [`CONTRACT.md`](CONTRACT.md) is the authoritative version.\n\n## Installing\n\nWith [lip](https://lip.futrime.com):\n\n```bash\nlip install github.com/Maskviva/Pier\n```\n\nOr unpack the release archive into `plugins/pier/`.\n\nPier needs LeviLamina 26.51.7 on BDS 1.26.51.\n[LegacyMoney](https://github.com/LiteLDev/LegacyMoney) is optional: it is delay-loaded, so\na server without it starts normally and only the economy calls return failure values.\n\n## Building from source\n\n```bash\nxmake f --toolchain=clang-cl --target_type=server && xmake   # the host, pier.dll\ncargo build --release                                        # the Rust binding and the examples\n```\n\nThe host builds with `clang-cl` (CI installs LLVM 21.1.8), and `xmake.lua` selects it for every\ntarget. MSVC's `cl` stops on LeviLamina's `EventCoordinatorPimpl.h` with C2491, and the two files\nthat hook that function end in an `#error` under any other compiler.\n\nThe two build lines share no build dependency, only the header, so they can be fixed\nseparately.\n\n```bash\npython3 tools/run-checks.py   # the machine checks of contract §9\n```\n\n## Contributing\n\nRead [`CONTRACT.md`](CONTRACT.md) first; code that conflicts with it is the side that\nchanges. A new language binding is welcome and does not need anything in this repository\nto change.\n\n## Acknowledgements\n\nPier stands on other people's work, and these projects deserve more than a line in a\ndependency list.\n\n- **[LeviLamina](https://github.com/LiteLDev/LeviLamina)** is the platform. Pier is a\n  LeviLamina mod, and it runs on LeviLamina's hooks, event bus, commands, services and SDK.\n  Without it there would be nowhere to load a mod.\n- **[LegacyScriptEngine](https://github.com/LiteLDev/LegacyScriptEngine)** (LSE) showed what a\n  server event should mean. Many of Pier's events hook the same engine function as LSE's\n  same-named event, and most of the events added since, from hoppers and dispensers to the\n  scoreboard, were added by following where LSE places them.\n- **[iListenAttentively](https://github.com/LiteLDev/iListenAttentively)** (ILA, by\n  MiracleForest) is the event library LSE itself builds on, and Pier's second reference for\n  where to hook. Pier's events were checked against it one by one, and the attack-on-a-block,\n  wither and wake-up events and the mob-griefing hook points follow its choices.\n- **[MoreDimensions](https://github.com/LiteLDev/MoreDimensions)** is where custom dimensions\n  come from. Pier registers a dimension with the engine the way it does, and learned from the\n  places it had to hook.\n- **[LegacyMoney](https://github.com/LiteLDev/LegacyMoney)** (LLMoney) is the economy backend\n  behind Pier's money functions, and their documented semantics follow its source.\n\nThank you to everyone who maintains them. Each keeps its own license; the links have the terms,\nand the [acknowledgements page](docs/en/guide/acknowledgements.md) lists which event came from\nwhich reference.\n\n## License\n\nApache-2.0. See [`LICENSE`](LICENSE).\n\n---\n\n*Not affiliated with Mojang, Microsoft or LeviMC. Minecraft is a trademark of Mojang\nSynergies AB.*\n"},{"file":"README.zh.md","lang":"zh-Hans","text":"<h1 align=\"center\">Pier</h1>\n\n<p align=\"center\">\n  <b>让 C++ 之外的语言也能写 LeviLamina 模组的装载器。</b>\n</p>\n\n<p align=\"center\">\n  <a href=\"../../actions/workflows/build.yml\"><img src=\"../../actions/workflows/build.yml/badge.svg\" alt=\"Build\"></a>\n  <a href=\"https://github.com/Maskviva/pier/releases\"><img src=\"https://img.shields.io/github/v/release/Maskviva/pier?color=334155\" alt=\"Release\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-Apache--2.0-blue\" alt=\"Apache-2.0\"></a>\n  <img src=\"https://img.shields.io/badge/BDS-1.26.51-62B47A\" alt=\"BDS 1.26.51\">\n  <img src=\"https://img.shields.io/badge/LeviLamina-26.51.7-8B5CF6\" alt=\"LeviLamina 26.51.7\">\n</p>\n\n<p align=\"center\">\n  <a href=\"README.md\">English</a> ·\n  <a href=\"README.zh.md\">简体中文</a>\n</p>\n\nPier 用一份 C ABI 把基岩服务端暴露出来。模组就是一个会说这份 ABI 的动态库，\n所以**用什么语言写，是作者的选择，不是平台替他做的决定**。\n\nRust、C++、Go 和 Zig 都有官方绑定。任何有 C FFI 的语言都可以有自己的绑定，\n而且加一个绑定不需要动 Pier。\n\n## Pier 为什么存在\n\n它的前身是 [levilamina-rust-loader](https://github.com/Maskviva/levilamina-rust-loader)，\n当初只为回答一个问题：LeviLamina 的模组能不能用 Rust 写？\n\n能。而这个答案带出了一个更难的问题。那个装载器的接口是一次加一个函数长出来的，\n底下的形状错了，而且错在补丁补不掉的地方：\n\n- **布局按构建目标分岔。** 函数表里的条件编译，让它的尾部在客户端构建和服务端构建上\n  落在不同的偏移。为此在版本号高位打了个标记补救，可这个标记护不住任何一个没重新编译的\n  模组——分岔点之后的每一个槽位都打到了错的函数指针上，而两边都编得过。\n- **中心直接呼叫每个能力包。** 派发表里写着各个包的函数名，每一个名字都是一条从中心\n  伸向能力包的链接边，于是能力包根本删不掉。「可选」是文档里的一个词，不是代码的性质。\n- **读不到的值，变成了看起来合理的值。** 一个读不出来的字段返回 0，而 0 对多数东西\n  来说都是个合法答案。土地保护模组读不到事件里的维度，写了 `unwrap_or(0)`，于是\n  每个事件都被当成发生在主世界——主世界拒绝、别处全部放行，一行日志都没有。\n- **事件名做子串匹配。** 上游哪天新增一个含相同词干的事件，订阅方就会被静默劫持到\n  载荷形状完全不同的合成事件上，而且没有任何办法再订到真事件。\n\n这四条单独看都能修，也确实补过几个。但合起来它们说明的是一件补丁修不了的事：\n**这个接口从来不是设计出来的，是长出来的**，而那些补丁是在守一个本就不该存在的形状。\n\n那个装载器是测试版。测试版的作用就是告诉你该怎么正经地建，它做到了，然后就不再维护。\n\nPier 是重新设计：先有接口，后有实现。\n\n## Pier 是怎么设计的\n\nPier 的全部就是一份头文件\n[`packages/pier-abi/include/sdk/abi.h`](packages/pier-abi/include/sdk/abi.h)。\n仓库里的 C++ 宿主照着它实现，各语言的绑定也照着它写。下面几节讲的，是这个头文件里定下来的几件事各自是怎么运作的。\n\n### 所有目标共用同一张函数表\n\n`PierApi` 里没有条件编译。客户端专用的槽位、自定义维度的槽位，在每一种构建里都占着同样的位置；\n对应的能力包没编进来时，这些槽位的值是 NULL。\n\n模组想知道宿主有没有某个能力，就在运行时看那个槽位是不是 NULL。同一份模组源码因此在服务端和客户端都编得过。\n早先为了区分构建在版本号高位加的标记，以及维护那个标记的一串补丁，都已经删掉了。\n\n### 能力包自己向宿主注册\n\nPier 由八个 C++ 包组成。`pier-host` 管着函数表和模组的生命周期，但不知道表里填的是什么。\n每个能力包通过一套服务提供方接口（SPI）向宿主登记四样东西：\n\n| 登记什么 | 宿主什么时候用 |\n|---|---|\n| 槽位包 | 装载时填进 `PierApi` |\n| 拆除步骤（带 stage 编号） | 卸载时按 stage 从小到大执行 |\n| 卸载否决 | 允许卸载之前逐个询问 |\n| 事件提供方 | 解析一次订阅时 |\n\n把某个包从构建里删掉，它就不会登记，对应的槽位停在 NULL，`pier-host` 的代码一行不用改。\n根构建文件里每个包是一行 `includes(...)`：删掉那一行，配置、编译、运行都照常。\n有一条检查在每次推送时把每个包轮流删掉，再构建一遍。\n\n自注册有一个前提：所有包都编译成 object 库，不能是静态库。链接静态库时，链接器会丢掉没有被外部符号引用的编译单元，\n而登记用的正是没有外部引用的文件级静态对象。它们被丢掉以后，对应的功能就不见了，启动日志里一个字也没有。\n这一条写进契约以后，还是在四个包上被违反过一次，之后才加了检查。\n\n### 跨边界传的是名字和 id\n\n指向服务端内部对象的指针不会跨过 ABI。玩家用选择器表示，实体用 id，方块用维度加坐标；每次调用，宿主都重新查一遍。\n\n所以句柄可以跨 tick 保存。实体没了以后再调用，宿主查不到它，返回一个错误，调用不会落到一块已经释放的内存上。\n每次调用也因此要多查一次表。\n\n按**名字**找玩家时有一处要当心：账号名对不上时，选择器会退到显示名去找，而显示名可以被别的模组改。\n一个玩家把自己的显示名改成某个离线玩家的账号名，按名字寻址的调用就会落到他身上。\n所以权限、经济、归属判定都用 xuid；Rust 绑定把两种选择器做成了不同的类型，在调用的地方就能看出用的是哪一种。\n\n### 谁分配的缓冲区，谁释放\n\n跨边界的缓冲区由产出它的一方分配和释放，接收方想留下内容就自己复制。\n\n| 形状 | 谁分配 | 接收方怎么用 |\n|---|---|---|\n| `PierStr`（指针 + 长度） | 调用方 | 在调用返回前读完，要留就复制 |\n| Sink 回调 | 宿主 | 在 sink 里复制走，返回后指针失效 |\n| 车道的 `data` / `vtable` | 提供方 | 存活标志为真时才调用 |\n\nABI 上没有哪个调用会返回一个要对方去释放的指针：那样需要两边用同一个分配器，而模组和宿主各用各的。\n所有输出都通过 sink 交出来。\n\n结构化数据用 SNBT 文本传递，不按值传结构体，这样表达不了引擎内存布局的语言也能用。\n\n### 答不上来的时候\n\n一个槽位答不上来时，会做下面三件事中的一件：返回一个能表示「没有答案」的值；打一条日志并回退，在日志里写明回退成了什么；或者拒绝执行。\n\n举个例子：一个判断「这个玩家能不能进领地」的函数，可能因为读不到玩家而答不上来。\n如果它只返回 bool，读不到时返回 false，调用方分不清「不能进」和「不知道」；返回 true，读不到的玩家就进去了。\n所以这类函数的返回类型里留着第三种情况。\n\n日志写的是下一步该做什么。同样是订阅失败，日志写的是「这个事件在当前 BDS 版本上不存在，注册表里相近的有 A、B、C」，\n读日志的人看完就知道该去改哪个名字。\n\n### 订阅时事件名怎么匹配\n\n宿主里只有一个匹配器 `idMatches`：要么完全相等，要么是带命名空间分隔符的后缀，不做子串匹配。\n假如有两个匹配器，一个按子串、一个按后缀，同一个名字在两处可能匹配到两个不同的事件。\n\n解析按这个顺序进行，哪一步认领了，就由哪一步负责到底：\n\n1. 事件提供方认领。认领了但订阅失败，就报错，**不**往下交给别的路径。\n2. 注册表里的精确名，然后是唯一的后缀。\n3. 都没找到就报错，并列出相近的 id。\n\n提供方排在注册表前面，是因为命令事件的发射器**就在**注册表里，可 LeviLamina 只把它派发给带类型的监听器：\n动态路径查得到它，却收不到事件。这类提供方声明自己接管注册表里的那条路径。纯合成的事件声明自己不接管；\n以后上游出现同样后缀的 id 时，宿主会打一条告警，这种遮蔽在日志里就看得到。\n\n### 新功能怎么加进函数表\n\n新增一个能力，就在表尾追加一个槽位，版本号不动。重排、删除或者修改签名时，\n`PIER_ABI_VERSION` 和 `PIER_ABI_MIN_SUPPORTED` 一起推进到同一个数；在那之前编译的模组，装载时会被拒绝，日志里写着原因。\n\n装载时判断的是一个区间：`MIN_SUPPORTED <= 模组的版本 <= 宿主的版本`。\n\n`tools/abi-v1.slots` 记着已发布的槽位顺序。每次推送都有检查拿当前的表和它比，改动了已有槽位的提交会在这一步失败。\n\n### 仓库里的检查脚本\n\nobject 库那一条，最早只写在契约里，交付说明也说它成立；后来它在完全依赖自注册的四个包上被违反了。\n从那以后，契约里的规则都配了一个检查脚本，放在 `tools/checks/`。\n\n`python3 tools/run-checks.py` 一次跑完所有检查。它们查的是编译器和 clippy 查不到的东西：头文件能不能按 C11 和 C++20 各编一遍，\n槽位顺序是不是只增不减，Rust 镜像和头文件是不是逐个参数对得上，能力包之间有没有横向依赖，有没有注释在描述代码没做的事。\n\n有三条检查盯的错误，在编译期完全看不到，装载时才出现，出现时的日志也看不出和构建有什么关系。\n比如 manifest 的 type 写错，模组根本不会被扫到，也不报错；少写了内存操作符，构建全部通过，启动服务器时才被拒绝。\n\n每条检查都写明了它覆盖什么、看不到什么。交付说明引用检查结果时照抄这句话，读的人就知道哪些部分还得靠人去看。\n\n规则本身在 [`CONTRACT.md`](CONTRACT.md) 里，每一条都附了理由。\n\n## 写一个模组\n\n**[Rust](docs/zh/rust/index.md)** 是第一个官方绑定，也是功能最全的；**[C++](docs/zh/cpp/index.md)** 直接使用头文件，\n**[Go](docs/zh/go/index.md)** 把模组构建成 c-shared DLL，**[Zig](docs/zh/zig/index.md)** 通过 translate-c 读取头文件。\n\n```rust\nuse levilamina::prelude::*;\n\nstruct MyMod;\n\nimpl LeviMod for MyMod {\n    fn on_load(ctx: &ModContext) -> Result<Self> {\n        ctx.logger().info(\"hello from Rust\");\n        Ok(MyMod)\n    }\n}\n\nlevilamina::register_mod!(MyMod);\n```\n\n- [写你的第一个模组](docs/zh/rust/first-mod.md) 从构建到装上服务器走一遍。\n- [pier-mod-template](https://github.com/Maskviva/pier-mod-template) 是一个直接就能跑的 Rust 模组：\n  它会打日志、订阅聊天、注册命令、排一个延迟任务。在 GitHub 上点 *Use this template*，或者用 `cargo generate`，都能从它开始。\n\n## 绑定另一门语言\n\n一份文件就够了。`sdk/abi.h` 能被 C11 解析，FFI 工具直接吃；它同时就是参考文档：\n每个槽位都写明参数含义、失败时返回什么、对线程有什么要求。\n\n1. 镜像 `PierApi`，**无条件声明每一个字段**，不带任何目标分支。\n2. 导出 `pier_main`，往 vtable 里填 `struct_size`、`abi_version`、`mod_flags`\n   和三个生命周期回调。\n3. 调用任何非核心槽之前，先查 `struct_size` 覆盖得到它，再查槽位非空。\n\n`bindings/rust/pier-sys-rs` 是参考实现。\n[加一门语言](docs/zh/guide/adding-a-language.md) 有详细步骤，\n[`CONTRACT.md`](CONTRACT.md) 第十节是权威版本。\n\n## 安装\n\n用 [lip](https://lip.futrime.com)：\n\n```bash\nlip install github.com/Maskviva/Pier\n```\n\n或者把发布压缩包解压到 `plugins/pier/`。\n\nPier 需要 BDS 1.26.51 上的 LeviLamina 26.51.7。\n[LegacyMoney](https://github.com/LiteLDev/LegacyMoney) 是可选的：它走延迟加载，\n没装的服务器照常启动，只有经济相关的调用返回失败值。\n\n## 从源码构建\n\n```bash\nxmake f --toolchain=clang-cl --target_type=server && xmake   # 宿主本体 pier.dll\ncargo build --release                                        # Rust 绑定与示例\n```\n\n宿主用 `clang-cl` 构建（CI 安装的是 LLVM 21.1.8），`xmake.lua` 给每个目标都选了它。MSVC 的 `cl` 会在\nLeviLamina 的 `EventCoordinatorPimpl.h` 上报 C2491，hook 这个函数的两个文件在其他编译器下会直接 `#error`。\n\n两条构建线之间没有构建依赖，只有那份头文件，所以它们可以分别修。\n\n```bash\npython3 tools/run-checks.py   # 契约第九节的机器检查\n```\n\n## 参与开发\n\n先读 [`CONTRACT.md`](CONTRACT.md)；和它冲突的代码是要改的那一方。\n欢迎新的语言绑定，而且它不需要这个仓库改任何东西。\n\n## 致谢\n\nPier 站在别人的工作上，这几个项目值得的不只是依赖列表里的一行。\n\n- **[LeviLamina](https://github.com/LiteLDev/LeviLamina)** 是整个平台。Pier 本身是一个 LeviLamina 模组，\n  用的是它的钩子、事件总线、命令、服务和 SDK。没有它，就没有可以装模组的地方。\n- **[LegacyScriptEngine](https://github.com/LiteLDev/LegacyScriptEngine)**（LSE）让我们知道一个服务端事件该是什么意思。\n  Pier 的许多事件钩的是和 LSE 同名事件相同的引擎函数，后来补上的大部分事件，从漏斗、发射器到计分板，\n  是照着 LSE 的挂点补上的。\n- **[iListenAttentively](https://github.com/LiteLDev/iListenAttentively)**（ILA，作者 MiracleForest）是 LSE 自己所依赖的事件库，\n  也是 Pier 判断该钩哪里的第二份参照。Pier 的事件逐个和它对照过，其中攻击方块、凋零破坏、起床和生物破坏方块的钩点沿用了它的选择。\n- **[MoreDimensions](https://github.com/LiteLDev/MoreDimensions)** 是自定义维度的来源。Pier 向引擎注册维度的方式沿用它，\n  也从它不得不钩的那些地方学到了东西。\n- **[LegacyMoney](https://github.com/LiteLDev/LegacyMoney)**（LLMoney）是 Pier 经济函数背后的后端，这些函数文档里写明的语义以它的源码为准。\n\n感谢每一位维护者。它们各自保留自己的许可证，条款见各自的仓库；哪个事件参照了哪一个项目，\n见[致谢页](docs/zh/guide/acknowledgements.md)。\n\n## 许可\n\nApache-2.0，见 [`LICENSE`](LICENSE)。\n\n---\n\n*与 Mojang、Microsoft、LeviMC 无关。Minecraft 是 Mojang Synergies AB 的商标。*\n"}],"gallery":[],"versions":[{"version":"26.51.3","prerelease":false,"released":"2026-10-29T07:27:15Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.51.3","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.51.3/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.51.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.51.*"}}]}},{"version":"26.51.2","prerelease":false,"released":"2026-10-10T13:53:05Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.51.2","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.51.2/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.51.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.51.*"}}]}},{"version":"26.51.1","prerelease":false,"released":"2026-09-23T03:02:08Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.51.1","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.51.1/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.51.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.51.*"}}]}},{"version":"26.40.3","prerelease":false,"released":"2026-09-14T04:12:52Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.40.3","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.40.3/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.40.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.40.*"}}]}},{"version":"26.40.2","prerelease":false,"released":"2026-09-14T03:29:03Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.40.2","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.40.2/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.40.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.40.*"}}]}},{"version":"26.40.1","prerelease":false,"released":"2026-09-13T10:10:41Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.40.1","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.40.1/tooth.json","info":{"name":"Pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.40.*"}}],"client":[{"side":"client","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina#client":"26.40.*"}}]}},{"version":"26.40.0","prerelease":true,"released":"2026-09-13T10:10:14Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.40.0","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.40.0/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.40.0"}}]}},{"version":"26.32.2","prerelease":true,"released":"2026-09-13T10:09:48Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.32.2","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.32.2/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.32.1"}}]}},{"version":"26.32.1","prerelease":false,"released":"2026-09-13T10:09:33Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.32.1","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.32.1/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.32.1"}}]}},{"version":"26.32.0","prerelease":false,"released":"2026-09-13T10:08:36Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.32.0","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.32.0/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.32.0"}}]}},{"version":"26.20.2","prerelease":false,"released":"2026-09-13T09:31:19Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.20.2","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.20.2/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.20.4"}}]}},{"version":"26.20.1","prerelease":false,"released":"2026-09-13T09:28:05Z","releaseUrl":"https://github.com/Redstone-Circuit-Communication/Pier/releases/tag/v26.20.1","manifestUrl":"https://github.com/Redstone-Circuit-Communication/Pier/blob/v26.20.1/tooth.json","info":{"name":"pier","description":"Loads LeviLamina mods written in other languages through one C ABI (manifest type: pier).","tags":["platform:levilamina","type:mod","type:loader"]},"variants":{"":[{"side":"server","platform":"win-x64","deps":{"github.com/LiteLDev/LeviLamina":"26.20.4"}}]}}],"dependencies":{"github.com/liteldev/levilamina":{"id":"github.com/LiteLDev/LeviLamina","name":"LeviLamina","owner":"LiteLDev","url":"https://levimc.org/mods/github.com/LiteLDev/LeviLamina/"}},"requiredBy":[{"id":"github.com/Maskviva/CrossBind","name":"crossbind","owner":"Maskviva","url":"https://levimc.org/mods/github.com/Maskviva/CrossBind/"}]}