• 论坛

导航

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

IBakedModel

IBakedModel is the result of calling IModel::bake. Unlike IModel, which purely represents a shape without any concept of items or blocks, IBakedModel is not as abstract; it represents geometry that has been optimized and reduced to a form where it is (almost) ready to go to the GPU. It can also process the state of an item or block to change the model.

In a majority of cases, it is not really necessary to implement this interface manually. One can instead use one of the existing implementations.

getOverrides

Returns the ItemOverrideList to use for this model. This is only used if this model is being rendered as an item.

isAmbientOcclusion

If the model is being rendered as a block in the world, the block in question does not emit any light, and ambient occlusion is enabled, this causes the model to be rendered with ambient occlusion.

isGui3D

If the model is being rendered as an item in an inventory, on the ground as an entity, on an item frame, etc. this makes it look “flat.” In GUIs this also disables the lighting.

isBuiltInRenderer

重要

Unless you know what you’re doing and are OK with using deprecated features, just return false from this and continue on.

When rendering this as an item, returning true causes the model to not be rendered, instead falling back to TileEntityItemStackRenderer::renderItem. For certain vanilla items such as chests and banners, this method is hardcoded to copy data from the item into a TileEntity, before using a TileEntitySpecialRenderer to render that TE in place of the item. For all other items, it will use the TileEntityItemStackRenderer instance provided by Item#setTileEntityItemStackRenderer; refer to TileEntityItemStackRenderer page for more information.

getParticleTexture

Whatever texture should be used for the particles. For blocks, this shows when an entity falls on it, when it breaks, etc. For items, this shows when it breaks or when it’s eaten.

getItemCameraTransforms

Deprecated in favor of implementing handlePerspective. The default implementation is fine if handlePerspective is implmented. See Perspective.

handlePerspective

See Perspective.

getQuads

This is the main method of IBakedModel. It returns BakedQuads, which contain the low-level vertex data that will be used to render the model. If the model is being rendered as a block, then the IBlockState passed in is non-null. Additionally, Block::getExtendedState is called to create the passed IBlockState, which allows for arbitrary data to be passed from the block to the model. If the model is being rendered as an item, the ItemOverrideList returned from getOverrides is responsible for handling the state of the item, and the IBlockState parameter will be null.

The EnumFacing passed in is used for face culling. If the block against the given side of the block being rendered is opaque, then the faces associated with that side are not rendered. If that parameter is null, all faces not associated with a side are returned (that will never be culled).

Note that this method is called very often: once for every combination of non-culled face and supported block render layer (anywhere between 0 to 28 times) per block in world. This method should be as fast as possible, and should probably cache heavily.

The long parameter is a random number.

基于 MkDocs 使用自定义主题构建. 托管于 Read the Docs.
启用夜间模式