Model block profiles v9
本页目录
本文对应 1.21.10 现代框架。文档中的接口与配置按当前文档快照核对;完整框架仍在开发验收。接口可编译、配置可解析与游戏内效果验证分别记录。
See ADR-021(源码配套资料) and block ownership v8. ModelPlan schemaVersion: 9 requires model_bindings_v2, model_blocks_v8 and model_block_profiles_v9. Public entry points stay ModelService.Owner.bindBlock/patchBlock/unbindBlock, profile domain model, and model:block_* actions. Profiles must declare capabilities before using them.
{
"schemaVersion": 9,
"bindings": [],
"blocks": [{
"id": "marker", "priority": 10, "match": {"skullType": 0},
"profile": {
"renderer": "java_item",
"modelResource": "example:models/item-java.model.json",
"item": "minecraft:stick",
"transform": {"offset": [0, 0.5, 0], "rotation": [0, 25, 0], "scale": [-1, 1.2, 0.8]},
"groundTransform": {"rotation": [0, 10, 0], "rotateSpeed": [0, 30, 0]}
}
}]
}
BlockModelBinding.profileSpec() exposes immutable BlockModelProfile; profile() still returns a JSON copy. BlockModelProfile.transform() and groundTransform() use ItemViewTransforms.Transform value types. advanced() signals schema 9. Legacy v8 fields are still accepted and serialize identically; adding advanced fields promotes the plan to 9. A schema 8 message containing them is rejected.
| Field | Meaning |
|---|---|
renderer |
gltf, source_model, or java_item |
modelResource |
Canonical namespace:models/*.glb for GLB; typed *.model.json for source/Java |
transform |
Optional offset, rotation, scale, rotateSpeed; mutually exclusive with v8 scale/offset/rotation |
item |
Required only for Java: registered non-air item, default stack; supplies native facts |
groundTransform |
Optional only for Java: the V1 item binding adjustment after resource GROUND display |
clip |
Existing embedded GLB clip only; source/Java clips are rejected |
Transforms default to zero translation/rotation/rate and unit scale. Vectors have three finite numbers. Scale may be scalar or vector, with each absolute component in [0.0001,128]. Offsets are model units/metres (maximum absolute 36000), rotations/rates are degrees/degrees per second (maximum absolute 3600). Unknown fields, zero scales, nonfinite numbers and mixed legacy/advanced transforms fail validation before platform allocation. Out-of-budget V1 fields need an explicit migration error, never clamping or silent dropping.
For GLB/source: native v8 anchor, configured offset, Y/X/Z rotation, axis scale. Source Y includes positive skull yaw; GLB Y includes 180 - yaw. The clock is world game time plus partial tick, in seconds. To migrate V1 source rotateSpeedX/Y/Z, multiply by 20.
For Java: block centre + offset, block Y/X/Z rotation, block axis scale, (-.5,0,-.5), JSON GROUND display, groundTransform, native (-.5,-.5,-.5) model centering. Java ignores skull yaw and the source-model wall shift. Block-level time rotation is rejected because V1 did not consume it; put the actual Java item binding's rate in groundTransform. That clock retains V1's system milliseconds modulo one hour, in seconds. Resource display uses the pinned native ItemTransform semantics (XYZ rotation, translation /16 and native bounds).
Java models use the existing typed decoder, override policy, textures, tint and shading. Only the declared default item's native facts are read, with null world and owner; framework item bindings are suppressed during this read. At most eight variants are prepared transactionally. Unknown item IDs, unknown predicates and missing/mismatched resources reject the candidate, preserving the current same-session plan. Missing or ambiguous native tint sources preserve the skull and expose a diagnostic instead of inventing a colour. Multi-layer native tint sources are currently rejected explicitly; they require a future unambiguous mapping contract.
The v8 selector/owner conflict rules, public Bukkit item/block operations and event semantics remain in force. Transform updates do not recreate resources; item/resource/backend changes do. Diagnostic draw records include consumed matrix, world and Java clocks, winding, selected Java variant and native tint values. Counts are emitted only for the current GPU frame. Reload/clear/disconnect/owner retirement release prepared views; world blocks remain platform-owned.
Native fixture reproduction: build the Forge frameworkJar and acceptanceDriverJar with -PframeworkAcceptance, and Bukkit plugin:jar, modelplugin:jar, bukkit-consumer-example:jar. Use the isolated acceptance installations and examples/presentation/resource-pack. The server uses -Dframework.font=true -Dframework.blockProfiles=true; both clients use -Dframework.blockModels=true -Dframework.blockProfiles=true with the existing Dev and ModelObserver launch arguments. The public consumer reads models-block-profiles-{base,alt,profile}.json, restores its world/player changes and stops the fixture after both observers finish. Omit framework.blockProfiles on all three processes for original v8 regression. Run framework.javaItemTransforms=true on the single Dev client with the ordinary fixture server for the existing 25-stage Java item regression. Acceptance driver/consumer artifacts are separate from the production framework.