ShadowUI 使用文档

Model effect native queries v29

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

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

See ADR-041(源码配套资料). Public owner bindEffect, patchEffect, replace and profile model:effect_* configuration accept nativeQueries: true on a typed .model.json effect. This requires schema 29 and model_effect_queries_v29.

JSON
{
  "id": "indicator",
  "target": {"kind": "entity", "uuid": "00000000-0000-0000-0000-000000000001"},
  "resource": "example:models/query-player-bedrock.model.json",
  "playback": {"clip": "wave", "loop": true},
  "nativeQueries": true
}

The source animation can use q.health / q.max_health * 16 as an authored translation component. These are read-only client observations for presentation; they cannot authorize damage, skills or inventory operations.

Context Canonical queries Units
Loaded target dimension query.actor_count, query.time_of_day, query.moon_phase Tracked entity count; total game ticks / 24000 (not wrapped); native phase index
Loaded entity target query.is_on_ground, query.is_in_water, query.is_in_water_or_rain 0 or 1
Living entity target query.health, query.max_health, query.is_on_fire, query.ground_speed Native health points; 0 or 1 fire; horizontal blocks/tick velocity
Existing sampler query.anim_time, query.animation_elapsed_time Existing authored animation timing

q.* aliases and existing bounded expression syntax remain valid. Fixed points admit only world and animation queries. Item queries and other names fail explicitly, even inside an inactive conditional branch or a future queued clip. GLB, null and non-boolean opt-in values are rejected. An unloaded target may be prepared, but unavailable facts never become zero; sampling waits/fails without replacing a good pose. Query failures remain in diagnostics until a valid sample succeeds.

Facts update the current pose without rebuilding the plan, restarting its lifetime or compiling its behavior program. The same immutable snapshot supplies all sampled layers. Changed facts invalidate replay only, so a same-clock update is visible and variables retain transactional ownership. Stop, target replacement, resource/world change, owner close and clear use the existing v25–v28 recovery rules. Diagnostic queryFacts contains numbers from the last accepted sample, not a second source of truth.

Missing/false preserves prior canonical bytes and constructors through the ten-argument form. Opt-in changes playback identity; toggling it intentionally prepares a new runtime. Java record-pattern/reflection consumers must adapt to the new component. The portable ExpressionCompiler.Session.referencedQueries, ClipSet.referencedQueries and sampler query-cache invalidation methods add no platform dependencies.

Runtime validation uses LegacyProgramSampler.referencedQueries over its already compiled primary session. Inspection is read-only, creates no evaluator session and does not advance variables or time. The standalone clip inspection method is intended for callers without an admitted sampler.

Migration must explicitly opt in and check each source clip. V1's effect item context was empty; item fields cannot be silently synthesized. The total-time query convention differs from the existing modern actor/player day-time convention. This contract and its neutral example do not claim completion of the R5 converter or all V1 effect contexts.