Textures & UV Mapping


Shortcuts are the way of setting textures to a phrase which can then be changed on models which have a parent model with shortcuts. The use of shortcuts is great for having the same model but using different textures for certain elements of the model.

Shortcuts can be made in two ways: by setting a texture to #texture instead of a texture path or by setting the texture of an elements face to #texture without #texture being defined:

npc.json – { “textures”: { “arm”: “#arm”, … }, elements: [ … “north”: { “texture”: “#arm” }, … ] }

npc.json – { elements: [ … “north”: { “texture”: “#arm” }, … ] }

Note both exapmples above will work the same, but the second one saves more space in the model file.

In the example above I have made an npc model and can now instead of copying the model over and over for each npc I can simply make each npc parent off the existing npc model and change the texture shortcuts to each npc’s corresponding textures:

npc_king.json – { “parent”: “item/npc”, “textures”: { “arm”: “items/arm_king”, … } }

npc_robot.json – { “parent”:  “item/npc”, “textures”: { “arm”: “items/arm_robot”, … } }

Here I have made two npcs which both use the same model without the exact same model being repeated twice which saves space and makes it easy to add more npcs by just defining textures.

Download example npc resources


When creating a model for 2D items (i.e. not block items) the parent model will be a child of builtin/generated:
‘item/handheld_rod’ is a child of ‘item/handheld’ which is a child of ‘item/generated’ which is then a child of ‘builtin/generated’.

When creating a model which is a child of ‘builtin/generated’ textures are defined by “layer0”, but you can have up to “layer4”.

apple.json – { “parent”: “item/generated”, “textures”: { “layer0”: “items/apple” } }

When you specify a second layer (“layer1”) the texture you define will be combined with the intial texture.

apple & bread

apple.json – { “parent”: “item/generated”,
“textures”: { “layer0”: “items/apple”, “layer1”: “items/bread” } }

The example above shows how the images are combined, you can see the z-fighting on the edge of the item, but not on the front of the item. This shows clearly how the images are combined.

When can this be used?
Below is an example of burger ingredients I have created (styled to remove z-fighting).

There are 5 different layers which can be added to a model (layer0-layer4), 2 are taken up by burger bun and the beef burger, there is 20 possible combinations of ingredients which can be placed into the burger, instead of creating 20 different burger textures I can use these 8 textures and 20 model files to recreate the same thing. Download the example resourcepack (shown below)

modular burgers
Beef, Bacon & Cheese | Beef, Lettuce & Tomato | Beef, Cheese & Gherkins