• Forums

Navigation

  • Home
  • Style Guide
  • Getting Started
    • Home
    • Structuring Your Mod
    • Forge Update Checker
    • Debug Profiler
  • Concepts
    • Sides
    • Resources
    • Data
    • Registries
    • Mod Lifecycle
    • Internationalization and localization
  • Blocks
    • Home
    • Blockstates
    • Interaction
  • Tile Entities
    • Home
    • Renderer
  • Items
    • Home
    • Loot Modification
  • Models
    • Intro to Models
    • Model Files
    • Blockstates
      • Intro to Blockstate JSONs
    • Coloring Textures
    • Item Property Overrides
    • Advanced Models
      • IBakedModel
      • Perspective
      • ItemOverrideList
        • ItemOverrideList()
        • resolve
        • getOverrides
        • ItemOverride
  • Rendering
    • ItemStackTileEntityRenderer
  • Data Generation
    • Introduction
    • Model Providers
  • Events
    • Basic Usage
  • Networking
    • Home
    • Overview
    • SimpleImpl
    • Entities
  • Data Storage
    • Capabilities
    • World Saved Data
  • Utilities
    • Recipes
    • Tags
  • Effects
    • Particles
    • Sounds
  • Conventions
    • Versioning
    • Locations
  • Advanced Topics
    • Access Transformers
  • Contributing to Forge
    • Getting Started
    • PR Guidelines
  • Legacy Versions
    • Home
    • Porting to 1.16

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, ClientWorld, LivingEntity) → 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.

resolve

This takes an IBakedModel, an ItemStack, a ClientWorld, and an LivingEntity 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