3.7 KiB
title, description, category, nav_order, tags, mentions
| title | description | category | nav_order | tags | mentions | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Intro to Items | A "Hello world" guide in making items. Learn the item format and how to create basic custom items. | General | 1 |
|
|
Minecraft Bedrock allows us to add custom items into our world with various vanilla-like properties
This tutorial will cover how to create basic items for the stable version of Minecraft.
Registering Items
Item definitions are structured similarly to entities: they contain a description and a list of components that defines the item's behavior.
Below is the minimum behavior-side code to get a custom item into the creative inventory.
BP/items/custom_item.json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {} // Must be here, even if empty!
}
}
Item Description
- Defines the item's identifier - a unique ID in the format of
namespace:identifier. - Configures which
menu_categorythe item is placed into.- Also takes the optional parameters
groupandis_hidden_in_commands.
- Also takes the optional parameters
Adding Components
Right now, our custom item is using the default component values (which can be found here).
Let's configure our own functionality!
BP/items/custom_item.json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:damage": {
"value": 10
},
"minecraft:durability":{
"max_durability": 36
},
"minecraft:hand_equipped": {
"value": true
}
}
}
}
Browse more item components here!
Applying Textures
We need to create a texture shortname to link it to an image in RP/textures/item_texture.json.
RP/textures/item_texture.json
{
"resource_pack_name": "wiki",
"texture_name": "atlas.items",
"texture_data": {
"custom_item": {
"textures": "textures/items/custom_item"
}
}
}
In our item file, we will add the minecraft:icon component to apply the texture.
BP/items/custom_item.json
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_item",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:icon": {
"texture": "custom_item"
}
}
}
}
Defining Names
Finally, we will give our item a name. Additionally, you can use the Display Name component.
RP/texts/en_US.lang
tile.wiki:custom_item.name=Custom Item
Result
In this page, you've learnt about the following:
- Basic features of items
- How to apply a texture
- How to link textures using shortnames in
item_textures.json - How to define names in the language file