Model-block conditions v13
本页目录
本文对应 1.21.10 现代框架。文档中的接口与配置按当前文档快照核对;完整框架仍在开发验收。接口可编译、配置可解析与游戏内效果验证分别记录。
Decision: ADR-025(源码配套资料). Progress belongs only to R4 blockConditionsSlice in the delivery ledger.
{
"schemaVersion": 13,
"bindings": [],
"blocks": [{
"id": "display", "priority": 20,
"match": {"schemaVersion": 1, "condition": {
"all": [
{"any": [{"skullType": 0}, {"skullType": 2}]},
{"not": {"skullType": 2}}
]
}},
"profile": {"renderer": "gltf", "modelResource": "example:models/model-1.glb"}
}]
}
Profiles declare model_bindings_v2, model_blocks_v8, model_block_conditions_v13 and any capabilities required by the model profile. Public ModelService bind/replace/patch uses the same contract; match is a complete replacement. Script block mutations promote schema without rewriting data references or downgrading other rows. Schemas 2–12 keep their original serialized forms; model schema 11 remains reserved/unimplemented.
Each condition combines its fields with AND. all and any contain 1–32 conditions; not contains one condition. Leaves support skullType (-1 wildcard or 0–6), canonical UUID profileId, exact case-insensitive profileName, and case-insensitive raw/decoded texture substring textureHash. Profile-name legacy color codes normalize as in V1 conditions. There are no item names, lore, NBT, classes, regex or inferred business fields here. Unknown/null/empty conditions fail; migration must explicitly handle previously ignored V1 fields.
Compilation limits: depth 8, 128 nodes, 32 KiB canonical JSON; UUID 36, profile name 240, texture selector 1024 characters. Evaluation permits 131072 work units per rule and 524288 per selection. Substring comparison charges the product of text and selector lengths. Shared native facts allow at most 32 raw texture values, 16384 characters per value and 65536 total, with bounded decoded text. Budget failure returns false with an error identifying the condition path, never success under not/any. The Forge selection stops and retains native fallback with public failure diagnostics; Bukkit inspection raises that diagnostic. Missing native skull facts return false even for negated conditions.
BlockModelBinding.evaluate(facts, budget) performs selection. matchJson() returns the exact versioned selector; advanced() identifies conditions; specificity() supplies the shared ranking. Existing match() returns a conservative wildcard claim for advanced selectors and must not be used to evaluate them. Equal-priority cross-owner claims remain conservative. Priority precedes specificity, advanced rank is 1000, simple rank is 100 plus the existing specificity, and ID breaks ties inside the owner.
Bukkit scope.createItem(id, amount, identity) and scope.place(id, block, placement, identity) accept an explicit BlockModelBinding.Match describing a concrete skull to create. Type must be 0–6; player identities still require an explicit UUID and native-compatible name/texture hash. The constructed native item must select that rule. The old overloads remain for simple selectors; they reject an advanced predicate without an identity. Selecting a model never supplies inventory contents or business permission.
Only currently declared facts are read. Bukkit's public serialized profile properties preserve raw texture values; providers exposing only a URL cannot support raw-only predicates. No profile lookup/update is invoked. Inventory display-name fallback and corresponding skull item models remain a separate contract/acceptance context.