• 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
      • 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

IModelState and IModelPart

IModelState and IModelPart are a way to transform models (or parts thereof). An IModelPart represents the part of the model being transformed. An IModelState represents a function IModelPart → TRSRTransform. By applying the IModelState to an IModelPart, we get a TRSRTransform representing how to transform that part. Note that passing Optional.absent() to IModelState::apply has a different meaning than usual. Doing so means getting the transform for the entire model, instead of just a part of it.

One of the uses of this is animation. An IModelState can represent a certain frame of the animation and supply transforms to turn the original model into the current frame. By supplying different IModelStates over time, an animation can be performed. For example, the B3D model format supports this kind of animation directly through its nodes; however, the animation system is still WIP. Another, more common use case is Forge blockstate JSONs. The models within the blockstates can be transformed with transform tags, which translate into simple IModelStates that are passed into the contained models. Finally, another use case is perspective aware models.

Which IModelParts a certain model will use is dependent on the model itself. If I had a B3DState that dealt with B3D NodeJoints and tried to use it on a vanilla JSON model, it wouldn’t work as vanilla models have no idea what a NodeJoint is and will not even ask about them.

Built with MkDocs using a custom theme. Hosted by Read the Docs.
Enable Dark Theme