Skip to content

Item Model Data Generation

Maksym Uimanov edited this page Feb 12, 2026 · 1 revision

Item Model Data Generation

The Temporal API provides a comprehensive set of annotations for automatically generating item models during data generation. These annotations eliminate the need for manual JSON asset creation by programmatically registering item models based on predefined strategies.

Responsibilities / Purpose

  • Automates model generation: Generates item model JSON files without manual asset creation
  • Provides model variety: Supports different item types (tools, weapons, blocks, armor, etc.)
  • Integrates with data generation: Works seamlessly with NeoForge's data generation system
  • Enables customization: Allows custom model strategies for specialized item types

How it works

  1. Annotation processing: The framework scans fields annotated with item model annotations
  2. Strategy selection: Each annotation maps to a specific ItemModelProviderStrategy implementation
  3. Model creation: Strategies create appropriate item models using the ApiItemModelProvider
  4. Data generation: During data generation, models are automatically registered, and JSON files are generated

Common Item Model Annotations

@GenerateBasicItemModel

Generates a basic flat item model for standard items.

@GenerateBasicItemModel
public static final DeferredItem<?> EXAMPLE_INGOT = ITEM_FACTORY.create("example_ingot");

Use cases: Materials, ingredients, simple items without special rendering

@GenerateHandheldItemModel

Generates a handheld item model for tools and weapons.

@GenerateHandheldItemModel
public static final DeferredItem<?> EXAMPLE_SWORD = ITEM_FACTORY.createSword("example_sword", Tiers.NETHERITE, 1, 1f);

Use cases: Tools, weapons, items held in hand with a special perspective

@GenerateCubedBlockItemModel

Generates a block item model using the cube all texture.

@GenerateCubedBlockItemModel
public static final DeferredItem<?> EXAMPLE_BLOCK = BLOCK_FACTORY.create("example_block");

Use cases: Basic blocks with uniform textures on all sides

Specialized Item Model Annotations

@GenerateBowItemModel

Generates a bow model with pull animation support.

@GenerateBowItemModel
public static final DeferredItem<?> EXAMPLE_BOW = ITEM_FACTORY.createBow("example_bow");

@GenerateCrossbowItemModel

Generates a crossbow model with loading animation support.

@GenerateCrossbowItemModel
public static final DeferredItem<?> EXAMPLE_CROSSBOW = ITEM_FACTORY.createCrossbow("example_crossbow");

@GenerateSpawnEggItemModel

Generates a spawn egg model with entity-specific coloring.

@GenerateSpawnEggItemModel
public static final DeferredItem<?> EXAMPLE_SPAWN_EGG = ITEM_FACTORY.createSpawnEgg("example_spawn_egg", ExampleEntityTypes.EXAMPLE_ENTITY, 0x473A24FF, 0x71634FFF);

@GenerateTrimmedArmorItemModel

Generates an armor item model with trim support.

@GenerateTrimmedArmorItemModel
public static final DeferredItem<?> EXAMPLE_HELMET = ITEM_FACTORY.createArmor("example_helmet", ExampleArmorMaterials.EXAMPLE_ARMOR_MATERIAL, ArmorItem.Type.HELMET);

Block Item Model Annotations

@GenerateFlatBlockItemModel

Generates a flat block item model using the block's texture.

@GenerateFenceBlockItemModel

Generates a fence block item model with post and rail textures.

@GenerateFenceGateBlockItemModel

Generates a fence gate block item model with open/closed states.

@GenerateSlabBlockItemModel

Generates a slab block item model.

@GenerateStairsBlockItemModel

Generates stairs block item model.

@GenerateWallBlockItemModel

Generates a wall block item model.

@GenerateButtonBlockItemModel

Generates a button block item model.

@GeneratePressurePlateBlockItemModel

Generates a pressure plate block item model.

@GenerateTrapDoorBlockItemModel

Generates a trapdoor block item model.

@GenerateBarrelBlockItemModel

Generates a barrel block item model.

@GenerateCarpetBlockItemModel

Generates a carpet block item model.

@GenerateLogBlockItemModel

Generates a log block item model with bark texture.

@GenerateWoodBlockItemModel

Generates a wood block item model.

Custom Model Annotations

@GenerateCustomItemModel

Allows custom item model generation using a custom strategy.

@GenerateCustomItemModel(
    strategy = CustomItemModelStrategy.class,
    additionalData = {"custom_param1", "custom_param2"}
)
public static final DeferredItem<?> CUSTOM_ITEM = ITEM_FACTORY.create("custom_item");

Parameters:

  • strategy: Custom strategy class implementing ItemModelProviderStrategy<CustomItemModelSpec>
  • additionalData: Optional string array for custom parameters

@GenerateCustomBlockItemModel

Allows custom block item model generation using a custom strategy.

@GenerateCustomBlockItemModel(
    strategy = CustomBlockItemModelStrategy.class,
    additionalData = {"custom_block_param"}
)
public static final DeferredItem<?> CUSTOM_BLOCK_ITEM = BLOCK_FACTORY.create("custom_block");

Asset Requirements

Place item textures in the appropriate resource directory:

src/main/resources/assets/modid/textures/item/
├── example_ingot.png
├── example_sword.png
├── example_bow.png
├── example_crossbow.png
└── example_spawn_egg.png

For block items, textures are typically in the block texture directory:

src/main/resources/assets/modid/textures/block/
├── example_block.png
├── example_fence.png
└── example_fence_gate.png

When to use

  • Standard items: Use @GenerateBasicItemModel for simple items
  • Tools/weapons: Use @GenerateHandheldItemModel for handheld items
  • Blocks: Use appropriate block item model annotations
  • Special items: Use specialized annotations for bows, crossbows, spawn eggs, armor
  • Custom needs: Use @GenerateCustomItemModel or @GenerateCustomBlockItemModel for unique requirements

Extension Points

The annotation system integrates with the Temporal API's metadata processing:

  • Strategy interface: ItemModelProviderStrategy<T> for custom model generation
  • Provider class: ApiItemModelProvider extends NeoForge's ItemModelProvider
  • Spec classes: Various spec classes for different model types (ItemModelSpec, BlockItemModelSpec, etc.)
  • Custom strategies: Implement custom strategies for specialized item model needs

Each annotation maps to a specific strategy implementation that handles the model generation logic, allowing for easy extension and customization of the item model generation system.

Clone this wiki locally