• 论坛

导航

  • 主页
  • 样式指南
  • 入门
    • 概述
    • Mod的结构
    • Forge更新检查器
    • 依赖管理
    • 调试分析器
  • 概念
    • Sides
    • 资源
    • 注册表
    • Jar签名
    • 国际化和本地化
  • 方块
    • 概述
    • 介绍方块状态
    • 方块互动
  • 动画 API
    • 概述
    • 骨骼
    • 动画状态机
    • 使用API
  • TileEntity
    • 概述
    • 特殊渲染器
  • 物品
    • 主页
    • 战利品表
  • 模型
    • 模型概述
    • 模型文件
    • 方块状态
      • 方块状态JSON概述
      • Forge方块状态JSON
    • 绑定模型到方块和物品
    • 彩色纹理
    • 物品属性概述
    • 高级模型(未翻译)
      • 高级模型介绍
      • IModel
      • IModelState and IModelPart
      • IBakedModel
      • Extended Blockstates
      • Perspective
      • ItemOverrideList
        • ItemOverrideList()
        • applyOverride
        • handleItemState
        • getOverrides
        • ItemOverride
      • ICustomModelLoader
  • 渲染
    • TileEntityItemStackRenderer
  • 事件
    • 基本用法
  • 网络
    • 主页
    • 概述
    • SimpleImpl
    • 实体
  • 数据储存
    • 能力系统
    • World Saved Data
    • 拓展实体属性
    • Config注解
  • 工具
    • 合成
    • 矿物词典
    • 权限API
  • 效果
    • 音效
  • 惯例
    • 版本命名
    • 文件位置
    • 加载阶段
  • 参与Forge开发
    • 入门
    • PR指南

ItemOverrideList

ItemOverrideList provides a way for an IBakedModel to process the state of an ItemStack and return a new IBakedModel; thereafter, the returned model replaces the old one. ItemOverrideList represents an arbitrary function (IBakedModel, ItemStack, World, EntityLivingBase) → IBakedModel, making it useful for dynamic models. In vanilla, it is used to implement item property overrides.

ItemOverrideList()

Given a list of ItemOverrides, the constructor copies that list and stores the copy. The list may be accessed with getOverrides, and it is used to implement the vanilla applyOverride, which, in turn, is used in the vanilla handleItemState.

applyOverride

This is a deprecated vanilla method. It is only called in the vanilla handleItemState, and in almost all cases can be safely ignored.

handleItemState

This takes an IBakedModel, an ItemStack, a World, and an EntityLivingBase to produce another IBakedModel to use for rendering. This is where models can handle the state of their items.

This should not mutate the world.

getOverrides

Returns an immutable list containing all the ItemOverrides used by this ItemOverrideList. If none are applicable, this returns the empty list.

ItemOverride

This class represents a vanilla item override, which holds several predicates for the properties on an item and a model to use in case those predicates are satisfied. They are the objects in the overrides array of a vanilla item JSON model:

{
  "__comment": "Inside a vanilla JSON item model.",
  "overrides": [
    {
      "__comment": "This is an ItemOverride.",
      "predicate": {
        "__comment": "This is the Map<ResourceLocation, Float>, containing the names of properties and their minimum values.",
        "example1:prop": 4
      },
      "__comment": "This is the 'location', or target model, of the override, which is used if the predicate above matches.",
      "model": "example1:item/model"
    },
    {
      "__comment": "This is another ItemOverride.",
      "predicate": {
        "prop": 1
      },
      "model": "example2:item/model"
    }
  ]
}
基于 MkDocs 使用自定义主题构建. 托管于 Read the Docs.
启用夜间模式