ShadowUI 使用文档

Source-item actions v17

状态待核对Minecraft 1.21.10 · Forge / Bukkit
本页目录

本文对应 1.21.10 现代框架。文档中的接口与配置按当前文档快照核对;完整框架仍在开发验收。接口可编译、配置可解析与游戏内效果验证分别记录。

Decision: ADR-029(源码配套资料). Progress and acceptance: R4 itemActionsSlice in delivery-tasks.json.

ItemAnimationCommand addresses a committed source_item binding, including bindings using skull selectors. It changes presentation only. Every current observer must support model_item_actions_v17 and have a committed, resource-ready current model revision.

JSON
{"operation":"play","binding":"held-object","playback":{"clip":"rise","loop":true,"speed":1,"transitionTicks":5,"restart":false,"queue":["idle"],"parallel":[],"conflicts":[]}}

stop replaces playback with optional transitionTicks (default 5). Java, GLB, icon and AW item backends reject this source-animation command. A missing owned binding rejects before dispatch. Unknown source clips, including every queued/parallel clip, fail on the client and preserve the preceding pose.

Use owner.itemAction(command) and owner.actionStatus(context,request) for public service operations. The existing ordered model-action channel carries item_action and item_action_receipt; owner/session/revision/digest/resource generation and action sequence fence stale messages. Duplicate identical retries return cached receipts without restarting. Mixed block/item commands share the 16 pending / 64 retained-status budgets. Wrong-kind receipts cannot complete a pending command. Later observers and reconnects do not replay historical actions. A document revision or resync retires pending receipts; it does not undo a side effect already applied to a retained native view. Use stop or the view lifecycle to end that playback.

The neutral immutable ModelAnimationPlayback uses the same v11 playback semantics: speed 0.05-16; transitions 0-200 unscaled ticks; at most 32 queued clips, four parallel layers and 32 conflicts. Primary clips play in queue order, loop loops the final clip, and parallel clips loop and override only authored local TRS channels. Non-loop completion returns to the configured default clip with its original clock. restart:false respects both conflict lists, identical programs return unchanged, and option changes on the same primary preserve elapsed time. The v11 block Playback API and serialization remain compatible.

Each owned item binding has its own expression sessions and elapsed time. All matching non-GUI displays use that pose; commands do not create per-inventory-slot business identities. GUI continues using rest geometry or its explicit icon, independently of transient commands. Sampling/geometry and old-plus-candidate memory reservations must succeed before pose replacement. Selector-only document changes with identical profiles retain the view; changing a profile or resources releases it. World change clears transient poses. Owner close, clear and disconnect release all owned state. A failed candidate does not replace the active model.

Scripts call registered model:item_action with the same JSON and must declare the capability. They can only address their ready profile's bindings. Data updates retain the behavior instance. The independent example models-item-actions-profile.json binds an action clip to a typed data field and reports consecutive local-state counts. Example data keys use canonical lowercase names (action_clip). The selected clip follows the explicit command sequence; receipt counters stay outside provider input, because automatic provider polling can turn a changed input into another data:changed event.

sourceItem.draws[context] records selected clip, action activity/time, queue segment, parallel layers, transition, geometry checksum, vertices and resource generation after actual drawing. Non-GUI queued draws from a retired action epoch are ignored; GUI rest draws remain reusable. These observations are diagnostics, not business authority. Migration, human acceptance and release remain separate ledger states.