ShadowUI 使用文档

Item presentation frames v19

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

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

Decision(源码配套资料). Authoritative progress: R4 itemFramesSlice in the delivery ledger.

Source-item profiles may declare:

JSON
{
  "renderer": "source_item",
  "resource": "example:models/block-view-bb.model.json",
  "renderHitbox": false,
  "frame": {
    "views": {
      "firstPersonRightHand": "parent",
      "firstPersonLeftHand": "parent",
      "thirdPersonRightHand": "parent",
      "thirdPersonLeftHand": "parent",
      "head": "parent",
      "fixed": "parent",
      "ground": "parent"
    },
    "guiBounds": "asset_rest",
    "dropped": { "height": 0.15, "rotationY": 0, "rotateSpeedY": 4, "interpolate": false }
  }
}

frame is optional and requires model_item_frames_v19 / model schema 19 even when its choices equal the existing defaults. Earlier schemas cannot carry it. Unknown keys, nulls, wrong types and nonfinite/out-of-budget numbers fail validation. Old profiles retain their bytes, digest and behavior. PresentationProfile must declare all model capabilities; public item operations, data references and script mutations use the same contract.

Source views accepts only the seven physical non-GUI context names above. Values are parent (bypass native item display and automatic grip) or native_item (native display, without automatic grip). Missing entries preserve the original heldModelSpace policy. Explicit modelGripBone still requires a valid declared model-origin grip, even when some views override that policy. Existing transforms, semantic-hand composition, visibility and enable flags still apply; an explicit frame never enables a disabled view.

Source guiBounds is visible_rest (default) or asset_rest (full immutable author rest). It changes only fit/centering measurement, not geometry visibility, animation or extents. Existing autoFitGui controls scale; XY centering remains active. GUI has its dedicated frame and is not a valid views key. With guiIcon, source fitting remains unused because the separate icon contract owns GUI.

Both source_item and java_item accept frame.dropped. Defaults: height 0.15 model metres, rotationY 0 degrees, rotateSpeedY 0 degrees per native tick, interpolate true. Height absolute value is at most 36000; rotation/rate at most 3600. Native render age must be finite and nonnegative; interpolate false floors it before calculating yaw. One presentation is emitted at the configured entity-relative height; native bob, bounds-derived hover and stack-copy spread are skipped. Server stack count, movement, pickup and lifecycle are untouched.

For source items, dropped yaw adds to authored local Y rotation after offset; the ground view still chooses its display frame. For Java items, dropped yaw surrounds the existing native display and binding adjustment. V1 source drops migrate with ground=parent and rate=4/interpolate=false. V1 Java skull drops migrate with v16 defaultGroundItem and rate=0. Java accepts only dropped inside frame; source views/guiBounds are rejected. Other renderers do not accept frame.

Preparation, replacement, stale generations, owner close, clear, resource recovery and disconnect follow the existing model transaction. The native dropped hook is scoped to a single live prepared source/Java layer with an explicit dropped contract; unsupported native paths retain their existing behavior. Per-view and dropped GPU observations are diagnostics, not a second authority for entity/item facts.

V1 source skull held/head/fixed yaw 180 should be expressed by the relevant view rotations. GUI already supplies its old 180-degree source facing. V1 Java skull transform fields were ignored; migration must report them. Clip aliases, unsupported source combinations and full migration remain subject to the R5 report and publication gate.

Native evidence for HEAD uses a PROFILE-bearing generic item in an armor-stand helmet slot, which reaches ItemModelResolver. Vanilla skull helmets can use the dedicated skull renderer instead; this item-frame slice does not claim that separate path. Native evidence and full V1 format/context migration remain separate acceptance requirements.