• IceSunCN
  • BBS

Navigation

  • Home
  • Style Guide
  • Getting Started
    • Home
    • Structuring Your Mod
    • Forge Update Checker
    • Dependency Management
    • Debug Profiler
  • Concepts
    • Sides
    • Resources
    • Registries
    • The Fingerprint Violation Event
    • Internationalization and localization
  • Blocks
    • Home
    • Intro to Blockstates
    • Interaction
  • Animation API
    • Intro to the Animation API
    • Armatures
    • Animation State Machines
    • Using the API
  • Tile Entities
    • Home
    • Special Renderer
  • Items
    • Home
    • Loot Tables
  • Models
    • Intro to Models
    • Model Files
    • Blockstates
      • Intro to Blockstate JSONs
      • Forge Blockstate JSON
    • Connecting Blocks and Items to Models
    • Coloring Textures
    • Item Property Overrides
    • Advanced Models
      • Intro to Advanced Models
      • IModel
      • IModelState and IModelPart
      • IBakedModel
      • Extended Blockstates
      • Perspective
      • ItemOverrideList
        • ItemOverrideList()
        • applyOverride
        • handleItemState
        • getOverrides
        • ItemOverride
      • ICustomModelLoader
  • Rendering
    • TileEntityItemStackRenderer
  • Events
    • Basic Usage
  • Networking
    • Home
    • Overview
    • SimpleImpl
    • Entities
  • Data Storage
    • Capabilities
    • World Saved Data
    • Extended Entity Properties
    • Config Annotations
  • Utilities
    • Recipes
    • OreDictionary
    • PermissionAPI
  • Effects
    • Sounds
  • Conventions
    • Versioning
    • Locations
    • Loading Stages
  • Contributing to Forge
    • Getting Started
    • PR Guidelines

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"
    }
  ]
}
Built with MkDocs using a custom theme. Hosted by Read the Docs.
Enable Dark Theme