🏭️ Model Generation

This page mainly explains how to use model generation.

Introduction

🏭️ Model Generation is acting a role to create a model in YAML format.

When configuring multiple similar models (e.g., 16 wool-colored sofas that only differ in textures), you would normally need to create an equal number of separate models. However, with Model Generation, you can easily manage these model inheritance relationships using YAML format.

Where to Configure

If you observe carefully, you'll notice that the plugin uses the following configuration format in many places.

path: "xxx:xxx"
generation:
  parent: "minecraft:xxx/xxx"
  textures:
    "xxx": "xxx:xxx"

In fact, the plugin supports model generation wherever a model path (path) can be specified. Whenever you see path, it means you can use generation within the same configuration section.

Arguments

parent

Loads a different model from the given path, in form of a resource location

The parent field can not only reference the default models provided by vanilla Minecraft but can also point to your custom models. You can view all available Minecraft models on this website

items#test:
  default:big_apple:
    material: apple
    custom-model-data: 1000
    model:
      type: minecraft:model
      path: "minecraft:item/custom/big_apple"
      generation:
        parent: "minecraft:item/apple" # inherits apple's model
        # displays a big apple in gui
        display:
          gui:
            scale: 2,2,2
  default:big_big_apple:
    material: apple
    custom-model-data: 1001
    model:
      type: minecraft:model
      path: "namespace:item/custom/big_big_apple"
      generation:
        # inherits the custom big apple model above
        parent: "minecraft:item/custom/big_apple"
        # now it would be very big both in hand and in gui
        display:
          firstperson_righthand:
            scale: 4,4,4
big apple
big big apple

textures

Holds the textures of the model, in form of a resource location or can be another texture variable.

If we intend to generate a block based on this model, the parameters for parent and textures should be specified as follows:

generation:
  parent: "minecraft:block/cube_all"
  textures:
    "particle": "minecraft:block/custom/block_particle"
    "down": "minecraft:block/custom/block_down"
    "up": "minecraft:block/custom/block_up"
    "north": "minecraft:block/custom/block_north"
    "east": "minecraft:block/custom/block_east"
    "south": "minecraft:block/custom/block_south"
    "west": "minecraft:block/custom/block_west"
items#test:
  default:big_apple:
    material: apple
    custom-model-data: 1000
    model:
      type: minecraft:model
      path: "minecraft:item/custom/big_apple"
      generation:
        parent: "minecraft:item/apple"
        textures:
          # replace the apple's texture with an axe
          layer0: minecraft:item/custom/topaz_axe 
        display:
          gui:
            scale: 2,2,2

gui-light

Can be "front" or "side". If set to "side", the model is rendered like a block. If set to "front", model is shaded like a flat item. Defaults to "side".

left: front right: side

display

Holds the different places where item models are displayed.

  • rotation: Specifies the rotation of the model according to the scheme [x, y, z].

  • translation: Specifies the position of the model according to the scheme [x, y, z]. If the value is greater than 80, it is displayed as 80. If the value is less than -80, it is displayed as -80.

  • scale: Specifies the scale of the model according to the scheme [x, y, z]. If the value is greater than 4, it is displayed as 4.

Available values: thirdperson_righthand, thirdperson_lefthand, firstperson_righthand, firstperson_lefthand, gui, head, ground, or fixed.

Let's continue with this big big apple example. You may notice that when held in the right hand, its rotation behaves incorrectly. This happens because we overrode its parent model's display.firstperson_righthand settings. Now, let's fix it!

generation:
  parent: "minecraft:item/custom/big_apple"
  display:
    firstperson_righthand:
      scale: 4,4,4
      rotation: 0,-90,25

Last updated