ShadowUI 使用文档

Owned effect programs and default events (v27)

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

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

Contract: ADR-039; additive to model effects v25, effect actions v26 and actor programs v23. This document does not change the frozen framework/parity contract.

Public entry

ModelAnimationProgramSpec(playback, authoredEvents, events) is a target-independent immutable policy. ModelAnimationProgramSpec.ClipEvents has nullable soundEvents/particleEvents channels: omitted inherits only on authoredEvents=true; an empty array silences that channel. Old ActorProgramCommand and nested ClipEvents remain compatible and expose program().

EffectProgramCommand.play(binding, spec) / stop(binding) dispatch via ModelService.Owner.effectProgram. ModelSyncSession.Port.effectProgram defaults to explicit unsupported failure. Command JSON has operation, binding and, for play, playback/authoredEvents/events. No target, platform object or business type is accepted. Strict parse rejects unknown fields, nulls, undeclared clips and excess budgets.

model:effect_program uses the same JSON in a profile declaring model_effect_programs_v27. Service clients must advertise that capability. Commands require the current committed owner/session/revision/resource generation and share the v26 ordered action stream; query actionStatus for applied/conflict/failed. Retry never replays; a new observer receives only the declaration.

Playback and events

Playback fields are clip, queue (maximum 32), parallel (maximum 4), conflicts (maximum 32), loop, speed (.05..16), transitionTicks (0..200), restart. Primary queue runs once then optionally loops its final clip; parallel layers loop while the program is active. Order and sparse-channel precedence are the v23 contract. Source expression variables stay in independent bounded layer sessions.

restart=false continues the same active primary program and integrated time; changing an active event policy requires restart. Conflict is symmetric with the installed program unless restart=true. The program uses the real effect pose and clock. Positive durations, every referenced clip, explicit event bounds, particle nodes, native event resources, compilation peak and retained layers are admitted before changing that pose. At most 37 distinct clips, 16 sound and 16 particle events per clip and 512 resolved events per program. Authored event parsing retains its bounded pre-effect particle scripts; no Java/reflection/files/custom networking.

Sound and particle anchors follow the effect placement, optional model node, real entity identity or fixed dimension. They share v26 sinks and are retired on replacement/clear. Commands preserve original declaration delay/lifetime. A dormant one-shot may be explicitly revived before its lifetime expires. Stop or command completion resumes only a declared default loop; otherwise the effect returns to a resource-free ended declaration.

Authored default events

Set authoredEvents=true on a typed BBModel/Bedrock EffectModelBinding and use ModelPlan schema 27 with model_effect_events_v27 plus v25 requirements. GLB authored-event opt-in rejects. Existing eight-argument Java construction and omitted/false JSON retain v25 behavior and canonical digest. patchEffect can toggle the field; unlike placement-only updates this prepares a replacement playback runtime.

Default event tables are validated and budgeted before model commit. They consume actual accepted default pose epochs. Explicit commands suspend the default tracks; resumed defaults start their own accepted epoch. Once/hold terminal frames do not replay sounds or particles. Missing resources, invalid event tables and capacity failure retain the previous plan. Resource/world/session recovery retires transient programs; eligible defaults are re-prepared, without replaying completed one-shots.

Migration and validation

V1 queue/parallel/conflict/restart rules map to playback. Existing authored sound/particle conventions map through the typed backend. Overlapping V1 Gecko controller order needs an explicit R5 difference report, not a silent declaration-order assumption. Context-dependent native queries, other effect types/anchors and full migration remain separate R4/R5 work. Per-candidate tests, native captures and human acceptance are recorded separately in the delivery ledger.

Effect lifetime and animation sampling use the existing unpaused client tick counter consistently. Server world-time correction cannot retire or rewind a local presentation. Draw diagnostics retain world tick separately. The v25 eight-argument constructor remains binary compatible; code using record component reflection or an eight-component record pattern must account for the new authoredEvents component.