Model binding patches v1
本页目录
本文对应 1.21.10 现代框架。文档中的接口与配置按当前文档快照核对;完整框架仍在开发验收。接口可编译、配置可解析与游戏内效果验证分别记录。
ModelBindingPatch.applyTemplate(kind, binding, patch) copies an authored binding and applies the same structural rules used by public binding patch methods and configured model:patch, model:player_patch, model:item_patch, model:block_patch and model:effect_patch actions. The helper preserves data expressions; callers must resolve and parse the resulting binding before preparing or publishing it. It is not a substitute for typed validation.
| Kind | Mutable fields | Merge / clear |
|---|---|---|
| ENTITY | resource, clip, transform, states, geometry | transform vectors merge; states/geometry null clears; clip null removes explicit clip |
| PLAYER | profile, geometry | direct profile fields merge; geometry null clears |
| ITEM / BLOCK | priority, match, profile | complete field replacement |
| EFFECT | resource, playback, transform, delayTicks, lifetimeTicks, restart, authoredEvents, placement, nativeQueries, attachment, geometry | transform vectors merge; attachment/geometry null clears |
IDs, targets and owners stay immutable. Nested profile maps and arrays replace complete values. Unknown fields and malformed merge objects reject before mutation; typed values, cross-binding references, capability requirements and resource availability are checked by the existing plan transaction. On failure the active plan/template survives. Existing schemas, capabilities and canonical declaration bytes are unchanged.
Geometry, attachment and placement edits preserve playback when its definition is unchanged. Changing a resource, playback settings, restart token or source event/query policy follows the existing binding's playback-replacement rules. Data refreshes preserve the behavior instance; they do not recompile the profile. Untouched template expressions continue to read new data after a patch.
For example, a behavior can move an existing effect to a same-owner bone while hiding its head mesh:
{"op":"action","name":"model:effect_patch","args":{"id":"marker","value":{"attachment":{"binding":"body","node":"head"},"geometry":{"hiddenNodes":["head"],"normalized":true}}}}
The enclosing profile must declare model_effect_attachments_v30 and model_geometry_v31 in addition to its existing model requirements. Missing capabilities or an invalid bone reject the candidate. Use "attachment": null or "geometry": null to clear the corresponding override. Data-provider identifiers use the existing lowercase namespace grammar.
See ADR-044(源码配套资料) and delivery tasks(源码配套资料) for scoped validation and open V1 parity work.
Scoped native and same-artifact regression evidence: receipt(源码配套资料). Full V1 parity, user acceptance and release remain separate ledger gates.