stewbeet.plugins.resource_pack.item_models

The item_models plugin automatically generates item and block models for custom items defined in the StewBeet framework.
It processes textures, handles powered states, generates specialized models for different block types,
and creates the necessary item model files for Minecraft resource packs.
(This plugin requires item definitions in memory and the textures_folder configuration.)

Some Features Showcase (example from SimplEnergy)

Automatically detects texture patterns:

Both models are automatically created and ready to use (models/item/* and items/*):

Source Code: stewbeet/plugins/resource_pack/item_models/__init__.py

Source Code: stewbeet/plugins/resource_pack/item_models/object.py

What it does

  • Generates block models with automatic pattern detection (cube, cake, orientable, etc.)
  • Creates item models with proper texture layering and parent inheritance
  • Handles powered states for blocks (_on variants)
  • Supports specialized models (bow pulling animations, leather armor overlays)
  • Automatically processes and copies textures from source folders
  • Generates both items/*.json files and models/[item|block]/*.json files
  • Tracks rendered models to prevent duplicates

Dependencies

  • βœ… Required: Your definition plugin (see definitions_setup.md for details)
  • βœ… Required: textures_folder configuration in meta.stewbeet
  • πŸ“ Position: Should run after verification plugins and before finalization
    (see basic/beet.yml for an example)

Configuration

Basic Example Configuration

yaml
pipeline:
  - ...
  - src.setup_definitions  # Load item definitions into memory
  - ...
  - stewbeet.plugins.resource_pack.item_models  # Check both item definitions and your textures to generate models
  - ...

meta:
  stewbeet:
    textures_folder: "assets/textures"  # Path to textures directory

Configuration Options

OptionTypeDefaultDescription
textures_folderstring"assets/textures"Path to the directory containing texture files. Must be set in meta.stewbeet.textures_folder

Features

Block Model Generation

Automatically detects texture patterns and generates appropriate block models:

🍰 Cake Model (requires: bottom, side, top, inner textures)

  • Creates main cake model with proper texture mapping
  • Generates 6 slice models for each cake state
  • Maps inner texture to inside in model

πŸ”² Cube Bottom Top, e.g. barrel (requires: bottom, side, top textures)

  • Uses minecraft:block/cube_bottom_top parent
  • Perfect for blocks with different top/bottom faces

⬆️ Orientable Model (requires: front, side, top textures)

  • Uses minecraft:block/orientable parent
  • Ideal for directional blocks like furnaces

πŸ“¦ Cube Column (requires: end, side textures)

  • Uses minecraft:block/cube_column parent
  • Great for pillar-like blocks

Item Model Generation

  • πŸ“‹ Uses appropriate parent models based on item type
  • πŸ›‘οΈ Handles leather armor with layer1 overlays
  • 🏹 Creates bow pulling animations with range dispatch, and for a crossbow its charge and loaded states
  • ⚑ Supports powered state variants

Powered State Support

  • πŸ” Automatically detects _on texture variants
  • πŸ”„ Generates separate models for powered/unpowered states, the plain one selecting the _on one while a furnace host burns
  • πŸͺœ Writes the inner and outer corner copies of a stairs block's model, selected from the display's custom_model_data string

Texture Processing

  • πŸ“ Recursively scans textures folder for .png files
  • πŸ“‹ Creates texture mappings for model generation
  • πŸ”„ Copies textures to resource pack assets
  • πŸ“ Supports .mcmeta animation files
  • 🚫 Handles missing texture validation

Specialized Model Types

Bow Models:

  • 🎯 Detects pulling texture variants (_pulling_0, _pulling_1, etc.)
  • πŸ“Š Creates range dispatch system for use duration
  • πŸ”„ Generates conditional models for bow states

Leather Armor:

  • 🎨 Automatically adds layer1 texture for color overlays
  • πŸ›‘οΈ Maintains compatibility with vanilla dyeing system

Item Component Files

  • πŸ†” Generates items/{item_name}.json files
  • 🎯 Creates model references for item components
  • πŸ”§ Uses custom JSON encoder for proper formatting
  • 🏹 Handles special cases like bow animations

Next steps