ShadowUI 使用文档

Blender 实体 服装物品与模型方块

Minecraft 1.12.2 · Forge / Bukkit
本页目录

先按导出与首次显示确认 GLB 能被本机读取。本章各 YAML 都是独立完整文件;节点名、动画名、匹配名称需改为自己的实际值。模型替换仍通过 modelResource 与对应映射完成。

实体模型

文件 plugins/ShadowModelPlugin/configs/entity/blender-entity.yml:

YAML
schemaVersion: 1
entries:
  wiki_glb_entity:
    kind: model
    match:
      entityNameContains: WikiGlbTarget
    renderer: gltf
    modelResource: models/wiki-creature.glb
    defaultAnimation: idle
    actionMap:
      idle: idle
      attack: attack
    transform:
      scale: 1

先给测试实体明确的自定义名称,再检查规则匹配。配置不会自动生成该实体,也不会赋予攻击伤害。希望由技能或附属插件创建、绑定和播放动作时,使用GLB API,不要另写一套模型网络协议。

玩家刚性附件与蒙皮服装

文件 plugins/ShadowModelPlugin/configs/player/blender-outfit.yml:

YAML
schemaVersion: 1
entries:
  wiki_glb_outfit:
    kind: player-skeleton
    priority: 1000
    match:
      playerName: ExamplePlayer
    renderer: gltf
    modelResource: models/wiki-body.glb
    syncMode: gltf_clips
    renderMode: replace
    fallbackAnimation: idle
    attachments:
      - id: backpack
        mode: rigid
        resource: models/wiki-backpack.glb
        bone: body_back
        transform:
          scale: 1
          offset: [0, 0, 0]
          rotation: [0, 0, 0]
      - id: coat
        mode: skin
        resource: models/wiki-coat.glb
        boneMap:
          coat_spine: body_spine
          coat_arm_right: body_arm_right
          coat_arm_left: body_arm_left

这是一条完整玩家绑定,不应与另一条同玩家同优先级的身体规则同时启用;已有身体规则时将 attachments 合入该条目。

模式 绑定方式 限制
rigid resource 中的附件整体跟随身体 bone,可有静态 transform 不设置附件自己的动画、boneMap 或 firstPerson
skin boneMap 左侧为服装关节名,右侧为身体关节名 不设置 bone 或 transform;服装骨架与绑定姿态由作者制作兼容

每条玩家绑定最多 8 个附件,id 唯一。skin 映射不会自动把任意两个不同骨架重定向为同一套动作。运行时附件资源不可用时可能只跳过附件,不能将“身体已出现”当作服装已经成功。附属 API 中的 AppearanceAttachment 有自己的已有来源类型,不等同于这里的 GLB attachments 配置。

独立动画物品与掉落物

文件 plugins/ShadowModelPlugin/configs/item/blender-animated-item.yml:

YAML
schemaVersion: 1
entries:
  wiki_glb_animated_item:
    kind: model
    condition:
      item: minecraft:blaze_rod
    renderer: gltf
    modelResource: models/wiki-relic.glb
    gltfAnimation: spin
    autoFitGui: true
    transform:
      scale: 1

spin 必须是资源内真实 clip;静态物品省略 gltfAnimation。此规则使用普通物品模式,可检查背包、手持和掉落显示。需要与自定义玩家精确握点对齐的装备请用物理握点配置:该路径要求静态装备,不允许混用 gltfAnimation。

模型方块

文件 plugins/ShadowModelPlugin/configs/item/blender-skull.yml。模型方块规则属于 item 分类,不要另建不受识别的 block 配置分类。

YAML
schemaVersion: 1
entries:
  wiki_glb_skull:
    kind: block-skull
    renderer: gltf
    modelResource: models/wiki-statue.glb
    profileName: WikiGlbRelic
    skullType: 3
    priority: 100
    transform:
      scale: 1

配置把符合头颅身份的方块交给模型渲染,不会凭空放置世界方块。附属插件可通过 ShadowModelAPI.createBlockItem("wiki_glb_skull", 1) 取得对应物品,或用公开 placeBlock 接口放置;完整权限、覆盖策略和事件见方块 API。需要播放内嵌动画时可添加实际 gltfAnimation。

立式与壁挂头颅使用各自的放置朝向。核对不同方向和破坏后的清理;不要为某个雕像在 Java 中叠加固定旋转。头颅资料可能异步就绪,放置 API 返回 PLACED 只表示服务端操作结果,不保证客户端已取得资料或完成绘制。运行时会在仍为同一放置目标、区块已加载且配置未改变时补发更新;业务无需反射 NMS 或反复覆盖方块状态。

配置操作与集中检查

以上文件保存后统一执行 /shadowmodelconfig reload,分别用 debug entity/blender-entity、debug player/blender-outfit、debug item/blender-animated-item、debug item/blender-skull 检查文档诊断;命令均以 /shadowmodelconfig 开头。

一次检查实体绑定与解除、两种服装、物品背包/手持/掉落、模型方块放置/朝向/破坏,再统一记录结果。资源替换、回退和错误码见GLB 入门;没有改动的游戏功能无需重复启动客户端验证。