This tutorial assumes you have already
- Read the Pre-requisites
- Downloaded the latest Forge MDK
- Setup your mod folder as described at the top of the main Forge 1.15.1 tutorials page
- Read and followed 1.0 - Gradle Configuration
- Read and followed 1.1 - Importing the project into your IDE
- Read and followed 1.2 - Basic Mod
- Read and followed 1.3 - Doing Something
- Read and followed 1.4 - Proxies
- Read and followed 1.5 - First Item
Our item currently doesn’t have a model. This is evidenced by its having the missing model when you look at it in-game and there being a FileNotFoundException
error in your logs.
Your logs will contain something very similar to
[minecraft/ModelBakery]: Unable to load model: 'examplemod:example_item#inventory' referenced from: examplemod:example_item#inventory: {}
[minecraft/ModelBakery]: java.io.FileNotFoundException: examplemod:models/item/example_item.json
This tells us that the game tried to find our model at models/item/example_item.json
but couldn’t find it.
We are going to fix this and add a model and texture for our Item.
First of all, make a file called “example_item.json” in src/main/resources/assets/examplemod/models/item/
.
Resources
A resource is data (images, audio, text, and so on) inside a program (this data isn’t code though) that is used by that program. Resources are located in the assets directory (atsrc/main/resources/assets/
). Mods contains resources including images,obj
orb3d
(advanced model) files andjson
files (like recipes,json
models, blockstate json files and localisation files). More info
Item Models Item Model files are a specific subtype of json file. More info
Inside the new example_item.json
file paste the following text.
{
"parent": "item/generated",
"textures": {
"layer0": "examplemod:item/example_item"
}
}
This text defines our example item’s model.
The "parent"
of "item/generated"
means that this model is an item and uses the normal flat model.
The texture "examplemod:item/example_item"
of "layer0"
in the "textures"
tag makes the model’s texture be our example item’s texture (which we haven’t created yet).
The texture "layer0"
is defined in the model "item/generated"
so it will be rendered. More info
Finally, download this texture (or make your own) and put it at src/main/resources/assets/examplemod/textures/item/
with the name “example_item.png”
Important: Texture files must be
.png
files
Your item should now have a model and a texture. If anything goes wrong, check your logs, they’re usually very descriptive.