#How to add a custom item/block to Minecraft Java
30 messages · Page 1 of 1 (latest)
Please make sure to read #1029373817119838218 as it may answer your question!
Once your question has been resolved, please mark the post as closed by using the </close:1163944441741049897> command.
(assuming you mean without mods)
In general, you can't add anything new that would pop up in the creative inventory if you mean that.
Items
You can't add completely new items, but you can tell the game to give an, for example, iron sword a different model when it has a CustomModelData:1 nbt tag.
Blocks
You can't add new blocks nor use any special nbt tag for this like you can for items.
Only thing you can do is tell the game to give different blockstate combinations of a block different models (so a stair facing north, being upside-down and a corner stair could look different to one facing south etc.).
Or you fake a block with a custom item on an item_display entity and a barrier in it if it needs a the hitbox.
Can you explain when it comes to adding custom items (using the custommodeldata thing) like what do I need to do to get it ingame
!faq custom_model_data
!faq set custom_model_data Disclaimer: This only works for items (not placed blocks!) and only if you are in Java Edition 1.14 or later!
Example to give a stick 3 new models:
You'd place this file in YourResourcePack/assets/minecraft/models/item and call it stick.json.
stick.json
{
"parent": "item/generated",
"textures": {
"layer0": "item/stick"
},
"overrides": [
{ "predicate": {"custom_model_data": 1}, "model": "item/custom_stick"},
{ "predicate": {"custom_model_data": 2}, "model": "custom/branch"},
{ "predicate": {"custom_model_data": 3}, "model": "block/stone"}
]
}``` Ingame you can give yourself one of the custom sticks by doing `/give <player> stick{CustomModelData:X}` (X being replaced by the number you want)
**Keep in mind:**
Not all item models look like this. The overrides part basically always work this way, but the part before it has to have the **exact same** information as the default model (assuming you don't wanna change how the normal item behaves/looks).
Not every item model uses "item/generated" as parent and defines one texture (for example **shields, bows, carved pumpkins** etc.). Additionally, if the default model already uses overrides (like for shields etc.) you need to add your overrides to the existing ones.
Hence always check the relevant model file in the default pack's models/**item** folder. (Type `!faq default-pack` for more info).
Preferably copy the default model into your pack and add your custom_model_data overrides into it.
**General knowledge/tips**
A model path is **always** relative to the "models" folder of your pack.
So `"item/custom_stick"` will load the model in `YourPack/assets/minecraft/models/`**`item`** called **custom_stick**.json;
while `"custom/branch"` will load the model in `YourPack/assets/minecraft/models`**`custom`** called **branch**.json;
and so on.
Depending on the item you use as base you need to adjust the part before "overrides" to be the same information as the item model in the default pack would have. Most pure items are like the one in the example. (Pure item = not a block in the inventory).
Ok so correct me if I'm wrong here.
If I want to add a custom item (eg: a ice sword) then I go to MyResourcePack/assets/minecraft/models/item and create a custom_sword.json file and in it I add this
"parent": "item/generated",
"textures": {
"layer0": "item/iron_sword"
},
"overrides": [
{ "predicate": {"custom_model_data": 1}, "model": "item/ice_sword"},
]
}```
and in my `MyResourcePack/assets/minecraft/models/item` I have the `ice_sword.json` file.
So when I do `/give <player> iron_sword{CustomModelData:1}` I will get the item.
Well, idea wise yes, but a few small changes:
The parent for the iron_sword would be item/handheld (basically the same thing, just different display settings)
And you'd need to remove the , at the end of that predicate line (the last predicate never has a comma at the end)
(and in the command instead of <player> your username or a selector like @s ofc)
Ok I get it now
Thank you so much for your help
I just have another question how do I add like the damage the item does and stuff.
I'm guessing thats done easily by other plugins that support custommodeldata items
either plugins or by defining attribute modifiers in the /give command
Pages like https://mcstacker.net/ are nice for the command usually. Just click on the /give button, select the item at the bottom, then adjust whatever you wanna adjust (name, lore, and other nbt))
Don't I need to have the texture file of the model in the resourcepack?
if it's not a default texture, yes
like, you wont need iron_sword.png in your pack if you mean that
but you will need the texture for your ice sword (unless your ice sword also uses default textures)
So I need to replace the default item texture? can't I have the game use that texture for that model?
no, as I said, you wont need iron_sword.png in your pack
nah, you can have as many as you want
What folder do I upload the textures to?
This part just tells the game what the item looks like when it doesn't have a CustomModelData tag.
What it looks like with CustomModelData is completely independent of that part
so you can have as many predicate lines as you have and each of those models you reference can have as many textures as you need
are you using web Blockbench or downloaded Blockbench?
downloaded
k, then you either:
- have the textures anywhere in textures/item (or textures/block), and directly load/save textures from/to there from/to Blockbench (before exporting your model for the final time, else the texture reference in the model won't be correct)
- have the textures in a custom folder inside the "textures" folder and add a small .json file to your pack to tell your pack that it is allowed to load textures from there too
alr thank you so much