In this guide you will make a Ruby: a simple shiny gem that stacks up to 64, shows up in the creative inventory and has its own name and icon. It does nothing fancy yet, but every sword, food and armor piece you make later starts from exactly this file.
There are two ways to do it. The quick way takes a couple of minutes on your phone. The by-hand way shows you every file, so you understand what is going on.
The quick way: GodCraft
GodCraft makes the item file, the texture, the name and the pack files for you. You never open a JSON file.
- Open the Workshop and add an Item to your add-on.
- Draw the icon in the pixel editor, or start from a vanilla texture and recolor it.
- Type the name and pick the settings you want, like the stack size.
- Tap Export. GodCraft writes the manifests, UUIDs and language files and gives you a
.mcaddonto open in Minecraft.
Curious what is inside that .mcaddon? Read on.
By hand
You need a behavior pack (BP) and a resource pack (RP) that are already set up. If you do not have them yet, follow Project setup first. In every example we use the namespace myname. Replace it with your own short name, in lowercase, everywhere it appears.
These are the files you will make or change:
| File | Pack | What it does |
|---|---|---|
items/ruby.json | BP | Says the item exists and how it behaves |
textures/items/ruby.png | RP | The picture |
textures/item_texture.json | RP | Gives the picture a short name |
texts/en_US.lang | RP | The name players read |
Step 1: the item file
Create a folder called items in your behavior pack and add this file:
{
"format_version": "1.26.30",
"minecraft:item": {
"description": {
"identifier": "myname:ruby",
"menu_category": {
"category": "items"
}
},
"components": {
"minecraft:icon": {
"textures": {
"default": "myname_ruby"
}
},
"minecraft:display_name": {
"value": "item.myname:ruby.name"
},
"minecraft:max_stack_size": 64
}
}
}Let's go through it piece by piece.
format_versiontells the game which version of the item rules your file follows. Use a recent one so all the modern components work.identifieris the item's unique ID. It is alwaysnamespace:name. Never use theminecraftnamespace for a new item: that one belongs to the game.menu_categorydecides where the item shows up in the creative inventory. Thecategorycan beconstruction,nature,equipment,itemsornone(hidden). You can also add agroupsuch as"minecraft:itemGroup.name.sword"to tuck it into an existing folder.componentsis where the item gets its features. Each component is one feature.
The three components used here:
minecraft:iconpicks the picture.defaultis the short name you will define initem_texture.jsonin step 3, not a file path.minecraft:display_namesets the name. Here it points to a key in the language file, so the name can be translated.minecraft:max_stack_sizeis how many fit in one slot. Use a number from 1 to 64.
One feature, one component
Want the item to glow like an enchanted book? Add minecraft:glint with true. Want it to survive lava? Add minecraft:fire_resistant. Every component has its own reference page with all its fields.
Step 2: the texture
Draw a 16x16 pixel PNG and save it in your resource pack:
A 16x16 PNG with a transparent backgroundKeep the background transparent, or the icon will be a square. If you are new to pixel art, Pixel textures has tips for making small images look good.
Step 3: register the texture
The game does not read PNG files by path from the item. Instead, item_texture.json gives each picture a short name, and the item uses that name. Create (or open) this file:
{
"resource_pack_name": "myname",
"texture_name": "atlas.items",
"texture_data": {
"myname_ruby": {
"textures": "textures/items/ruby"
}
}
}Notice two things:
- The key
myname_rubymatches thedefaultvalue in the item's icon component. - The path has no
.pngat the end.
When you add more items later, put them all in this one file as extra entries inside texture_data. Do not make a second item_texture.json.
Step 4: the name
Open (or create) the English language file and add one line:
item.myname:ruby.name=RubyThe part before = must match the value of minecraft:display_name exactly. The part after it is what players see. Lang files are plain text: one entry per line, no quotes, no commas.
Step 5: test it
- Copy both packs into Minecraft, or export them (see Export and install).
- Create a new world and turn on both packs in its settings.
- Open the chat and type the /give command:
/give @s myname:ruby 64You should get a full stack of rubies with your icon and the name "Ruby". In a creative world you will also find it in the Items tab of the inventory.
When something goes wrong
| What you see | Most likely cause |
|---|---|
/give says the item does not exist | A typo in the identifier, or the behavior pack is not turned on |
| The item has a pink and black icon | The key in item_texture.json does not match the icon, or the path is wrong |
The name looks like item.myname:ruby.name | The lang key does not match, or the lang file is not in texts |
| Nothing from the pack loads | A JSON syntax error, like a missing comma |
Turn on Content Log in Minecraft's creator settings to see exact error messages. More fixes are in Troubleshooting.
What next?
Your ruby is a plain item. Now give it a job:
- Make something players can eat in Custom food.
- Turn rubies into a sword or a pickaxe in Weapons and tools.
- Make a full ruby armor set in Custom armor.
- Let players craft rubies in Crafting and furnace recipes.
To see how Mojang builds its own items, browse the vanilla items.