Source appearances, model schema 37
本页目录
本文对应 1.21.10 现代框架。文档中的接口与配置按当前文档快照核对;完整框架仍在开发验收。接口可编译、配置可解析与游戏内效果验证分别记录。
Decision: ADR-053(源码配套资料). Add an independently owned whole source model through AppearanceBinding.source(...) or appearances in a model domain. This requires model_bindings_v2, model_appearances_v33 and model_source_appearances_v37. A body may belong to another consumer. The appearance never creates inventory facts or claims the body controller.
{
"id": "outer-model",
"renderer": "source",
"target": {"kind":"player", "uuid":"00000000-0000-0000-0000-000000000001"},
"bodyRenderer": "bedrock",
"bodyResource": "example:models/player-bedrock.model.json",
"order": 0,
"bodyVisible": false,
"profile": {
"schemaVersion": 1,
"resource": "example:models/player-bedrock.model.json",
"pose": "local",
"animation": {
"mode": "body",
"clips": {"idle":"idle", "wave":"wave"},
"unmapped": "suspend"
}
}
}
The body renderer is explicitly bbmodel or bedrock. Both body and garment reference canonical namespace:models/*.model.json entries in the existing source resource pipeline; no new resource-profile file or manifest scope is needed. Preparation validates the actual body backend and keeps its immutable asset identity. Missing resources, bones, clips, unsupported queries or budget failures reject the candidate before it can replace an applied owner.
profile is an immutable SourceAppearanceProfile, limited to 64 KiB, with unknown fields rejected:
| Field | Meaning |
|---|---|
schemaVersion |
Exactly 1 |
resource |
Garment BBModel/Bedrock source entry |
pose |
local (default), rotation, matrix, exact |
bones |
Explicit garment bone → body bone map, 1–64 entries. Required for following modes; forbidden for local pose |
parts / boundaries |
Optional 1–256 distinct subtree roots / cut points. Boundaries require parts. Omitted parts select all geometry |
animation |
Rest (default), independent fixed clip, or accepted body layer mapping |
Local pose uses the garment's own model coordinates under the same player root. Rotation mode copies local rotations while retaining garment translation/scale. Matrix mode uses body current/rest matrices and garment rest parent/local pose. Exact mode follows V1 full geometry matrices, with explicit pivot conversion. Unmapped decorative descendants retain their own sampled local animation. No bone aliases are guessed.
Animation forms:
{"mode":"rest"}
{"mode":"fixed", "clip":"wave", "loop":true, "speed":1}
{"mode":"body", "clips":{"idle":"idle", "wave":"wave"}, "unmapped":"suspend"}
Fixed speed is finite in 0.01–16 and starts at the first accepted appearance sample. Changing the body's clip does not restart a fixed appearance. Body mode has an explicit map of 1–128 exact body clip → garment clip names; all declared names validate before commit. Elapsed seconds and loop flags are preserved, not normalized to a common duration. Queue segment and parallel slots remain distinct expression sessions. The garment follows the body's accepted transition progress without resampling or advancing the body. A restart at the same timestamp remains a new epoch.
If any active body layer lacks a mapping, unmapped: suspend suspends the entire appearance and keeps the body visible. unmapped: rest explicitly chooses the garment rest pose for the whole layer set. A body rest frame also chooses garment rest. Missing maps are never guessed or silently treated as another clip.
Expressions retain existing bounded source evaluation and instance-local variables. Supported clock queries are query.anim_time and query.animation_elapsed_time. Read-only facts are query.health, query.max_health, query.is_on_ground, query.is_in_water, query.is_on_fire, query.is_alive, query.ground_speed, query.life_time, query.body_y_rotation, query.head_x_rotation, query.head_y_rotation, query.is_moving, query.is_sprinting, query.is_sneaking, query.time_of_day, query.actor_count. Riding look values use the same constrained render facts as the body. Unknown facts reject before commit; no Java objects or consumer query functions are exposed.
bodyVisible: false hides the custom body only after this appearance captures successfully for the declared player/body/generation. Multiple successful appearance owners combine visibility with AND, in the existing order/id/owner sequence. Failed or suspended appearances do not hide the body. Old owners survive failed preparation; closing an owner releases only its appearances. Actor replacement resets instance-local state even when a UUID is reused. Resource reload/clear/session replacement retire poses, expression sessions and charged deferred frames.
Existing ModelService.Owner.bindAppearance, patchAppearance, unbindAppearance, replace, observation and receipt operations apply. model:appearance_bind, model:appearance_patch, model:appearance_unbind and data binding use the same schema. A profile patch replaces that whole profile; it does not merge old bones or animation modes into a new profile. A data update that resolves to the same appearance reuses the existing resource/runtime owner.
Neutral model-domain examples are examples/presentation/models-source-appearance-body.json and models-source-appearance-local.json. Set the target UUID to the intended player and publish required source resources first. Current scope is custom source-player body rendering; source first-person sleeves and V1 migration are separate delivery items. The delivery ledger records implementation, native evidence and release separately.