🇬🇧 English
🇬🇧 English
Appearance
🇬🇧 English
🇬🇧 English
Appearance
This page is written for version:
1.21.4
This page will introduce you into some key concepts relating to items, and how you can register, texture, model and name them.
If you aren't aware, everything in Minecraft is stored in registries, and items are no exception to that.
To register an item, you will need to get the item handler from the bridge.
Not Found: /home/runner/work/javabridge-docs/javabridge-docs/reference/latest/Csharp/example/ModItems.csWith which you can call the RegisterItem method, which takes in the item definition and item group.
Not Found: /home/runner/work/javabridge-docs/javabridge-docs/reference/latest/Csharp/example/ModItems.csThe item definition is the key with which translations, and item models can be defined later. It should be all lowercase.
The item group can be set to null, which makes the item not be registered to any group.
The item currently doesn't have a translation, so you will need to add one. The translation key has already been provided by Minecraft: item.mod_id.suspicious_substance.
Create a new JSON file at: src/main/resources/assets/mod-id/lang/en_us.json and put in the translation key, and its value:
{
"item.mod_id.suspicious_substance": "Suspicious Substance"
}You can either restart the game or build your mod and press F3+T to apply changes.
To give your item a texture and model, simply create a 16x16 texture image for your item and save it in the assets/mod-id/textures/item folder. Name the texture file the same as the item's identifier, but with a .png extension.
For example purposes, you can use this example texture for suspicious_substance.png
When restarting/reloading the game - you should see that the item still has no texture, that's because you will need to add a model that uses this texture.
You're going to create a simple item/generated model, which takes in an input texture and nothing else.
Create the model JSON in the assets/mod-id/models/item folder, with the same name as the item; suspicious_substance.json
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "fabric-docs-reference:item/suspicious_substance"
}
}parent: This is the parent model that this model will inherit from. In this case, it's the item/generated model.textures: This is where you define the textures for the model. The layer0 key is the texture that the model will use.Most items will use the item/generated model as their parent, as it's a simple model that just displays the texture.
There are alternatives, such as item/handheld which is used for items that are "held" in the player's hand, such as tools.
Minecraft doesn't automatically know where your items' model files can be found, we need to provide an item model description.
Create the item description JSON in the assets/mod-id/items, with the same file name as the identifier of the item: suspicious_substance.json.
{
"model": {
"type": "minecraft:model",
"model": "fabric-docs-reference:item/suspicious_substance"
}
}model: This is the property that contains the reference to our model. type: This is the type of our model. For most items, this should be minecraft:modelmodel: This is the model's identifier. It should have this form: mod-id:item/item_nameYour item should now look like this in-game:

If you want to add a crafting recipe for your item, you will need to place a recipe JSON file in the data/mod-id/recipe folder.
For more information on the recipe format, check out these resources: