Adding Custom Textures to Items - jojodmo/CustomItems GitHub Wiki
We recommend that you use CustomItems to automatically generate your resource pack for you. For more information check out the wiki page about automatic resource pack generation
This is only possible for Minecraft versions 1.9 and above. If you're using Minecraft 1.14 or above, you can download some example files here
IMPORTANT FOR YOUR RESOURCE PACK TO WORK If you're setting the material for your item (setting material: "minecraft:APPLE"
, or something like that in your item yml file) Make sure to read here, otherwise, your resource pack will not work.
IMPORTANT: READ ABOVE
Custom Textures enable you to define a custom texture from a resource pack to be used for an item. To add a custom texture:
First, download the correct example resource pack for your version. If you don't download the correct version it will not work:
In this folder you'll find item yml files which you can use on your server as example files (put the files like emeraldHoe.yml into plugins/CustomItems/items on your server).
You'll also find a folder called "CUIResourcePack". This is the resource pack! To add new textures, go to CUIResourcePack/assets/minecraft/textures/item/custom. Here you'll find .png files corresponding to different textureIDs. For example, if your item.yml has
item:
textureID: 27
then you should create a new file in CUIResourcePack/assets/minecraft/textures/item/custom called texture27.png
, and put the texture of your CustomItem here.
After you modify it as you like, just make sure to make CUIResourcePack your server's resource pack. For more info about resource packs, see Creating a resource pack on the Minecraft wiki.
Keep in mind that if you'd like to change the material of an item (change it from a diamond hoe to a sword or something), or use fallback textures (make players without your resource pack see your custom item as a golden ingot, for example), you'll need to create your own resource pack — these are only starter packs. See If you set the material for your item below
One way of giving armor a custom texture is to change the default texture of leather armor (to make it look more like the "solid" armors like diamond and gold, or whatever you want). Then, you can use the color
attribute of your custom item to the color you want your armor to be:
item:
material: "minecraft:LEATHER_CHESTPLATE"
color: "#00aaff"
Due to limitations with Minecraft, some extra steps are needed to give armors, Elytras, and shields completely new textures that show up while a player is wearing them. You can give armor a completely custom appearance in a player's inventory, but making it show up when they wear it is a more involved (unless you use the leather armor method above)
For more info on giving armor, elytras, and shields using Optifine, check out Using Optifine for armor textures. Remember: You only need optifine for giving armor a custom appearance while a player is wearing it. You don't need optifine or any other mods for any other custom models or textures.
Important if you do this, you'll need to modify your resource pack to work with the fallback texture. Otherwise, you won't see any texture on the item. For more info about doing this, check out If you set the material for your item below
To set the fallback texture for a custom item, all you have to do is set the item's material to whatever you want the fallback texture to be:
item:
textureID: 42
material: "minecraft:STONE_AXE"
If a player on your server had your resource pack, they would see this as a custom-textured item. If they didn't have the resource pack, they would see this as a normal Minecraft stone axe.
IMPORTANT In Minecraft 1.14 and above, you can set the fallback texture of a custom item to any Minecraft item. However, in Minecraft 1.13 and below, fallback textures are only supported on damageable items, like tools, weapons, and armor.
For more info about how to set up your resource pack for fallback textures, read If you set the material for your item below
First, make yourself a texture t least a 16x16 image or find the resource pack with a texture you would like to animate.
Now open up an image editor, such as Paint.net or Photoshop.
For each frame, you will need to have at least a 16x16 image size. Each frame is kept in the same image file. The below example has 4 frames that are 32x32 each:
Now create a new .txt file in the same folder as the item image.
Rename it to a .mcmeta file.
Make sure the text file is not example.png, but instead example.png.mcmeta
Open in up in a program such as Notepad.
Now copy and paste this code into the file.
{ "animation": { "frametime": 4 } }
What is Frametime: Frame time is the rate the animation moves between the frames. Need more help: If you need more help or some examples head over to the discord.
If you set the material for your item, but also give it a custom texture ID, you'll need to modify your resource pack.
IMPORTANT — Read the Minecraft Wiki on creating resource packs and The Minecraft Wiki on models first
IMPORTANT — This tutorial is just if you don't have any experience with resource packs at all. It is just to help you get custom textures working — it is very basic, and there's a ton of awesome things you can do with resource packs (remember that resource packs are a Minecraft thing — not a CustomItems thing, so you can find tons of great tutorials online).
Try Googling "Creating a resource pack with custom_model_data", or looking for some video tutorials on YouTube for creating resource packs
In Minecraft 1.14 and above, you can use any material. Keep in mind that, by default, if you change the material of the item, your custom item will act like that item. If you don't want that, you can add some handlers to change the item's behavior.
For those knowledgeable about resource packs, the item's custom_model_data will be whatever you set the textureID to. If you aren't super knowledgeable about custom_model_data, keep reading!
In this tutorial, we're going to be using a Custom Item with its base material set to "minecraft:DIAMOND_SWORD" and its textureID set to 27:
# in myCustomItem.yml
item:
material: "minecraft:DIAMOND_SWORD"
textureID: 27
-
Before you start, make sure you've downloaded the correct starter resource pack using the link above (http://www.mediafire.com/file/s6maukyqvws50e7/CustomItemsExampleFiles.zip/file)
-
First, open up your resource pack folder. Everything we do will be in there.
-
Find the /assets/minecraft/models/item folder in your resource pack.
-
Next, copy the "diamond_hoe.json" file in this folder, and paste it into the same folder with a new name. This new name will be whatever the item material is block is, all lowercase with underscores for spaces.
- So, for example, if the base material (what you have "material" set to under "item" in your item.yml) is an oak sapling, re-name it to "oak_sapling.json". In our example, because we're using "minecraft:DIAMOND_SWORD" as our base material, rename it to "diamond_sword.json"
-
Next, if you want, you can change "parent": "item/handheld" to be something else like "parent": "item/block", depending on what you want. Read The Minecraft wiki on models for more info.
-
Now, take a look at this json. DON'T CHANGE ANYTHING YET:
{ "predicate": { "custom_model_data": 27 }, "model": "item/custom/dihoe/model27" },
This tells you where Minecraft will find the texture file for the given item ID. The one above is for items with "textureID" set to 27 in their item yml file, because "custom_model_data" is 27.
So, for example, you could change this to something like NOW YOU CAN CHANGE THINGS:
{ "predicate": { "custom_model_data": 27 }, "model": "item/custom/diswrd/model27" }
Now, Minecraft will look at the "/assets/minecraft/models/item/custom/disword/model27" file to find the model for the item (instead of the old "/assets/minecraft/models/item/custom/dihoe/model27").
- You should change all of the "model"s to the correct path for every texture ID you want use. Make sure you ONLY change the "dihoe" part to "diswrd" or another folder name like that. If you change anything before "custom", bad things will happen.
- IMPORTANT: Minecraft has a limit on the length of the things between the slashes, so make sure you don't make the folder names too long. Otherwise, your resource pack won't work
-
Then, open up the "custom" folder at /assets/minecraft/models/item/custom
-
Copy the "dihoe" folder and paste it, and re-name it to your new name that you created above (so, using the example above, we would re-name it to "diswrd").
-
Next, find the .json file corresponding to the texture ID you're using. For us, this would be the texture ID 27, so we would look for "model27.json". Open it up.
-
OPTIONAL: If you want, you can make "parent": "item/handheld" if the item is just a normal hand-held item, and "parent": "item/block" if the item is a block (THIS WON'T CHANGE BLOCK TEXTURES — ONLY WHAT THE ITEM LOOKS LIKE IN YOUR HAND).
-
Then, under "textures", the entry under "layer0" will be the location of the png file. For example, if it was "item/custom/texture27", this would be the file
/assets/minecraft/textures/item/custom/texture27.png
You could change this to some other path. For example, changing it to "item/custom/diswrd/texture27" would make the png file be at:
/assets/minecraft/textures/item/custom/diswrd/texture27.png
-
Then, just go into that folder and edit the png file to be the texture you want! For example, if we kept "layer0" set to "item/custom/texture27", then we would edit the PNG file /assets/minecraft/textures/item/custom/texture27.png
-
Then, in your item yml file, just set the "textureID" of the item to be what you edited in the resource pack. So, for us, we would be using "textureID: 27"
# in myCustomItem.yml
item:
material: "minecraft:DIAMOND_SWORD"
textureID: 27
- Now, if you want to use a different textureID (say, 42", just repeat the above steps, replacing everywhere you see a "27" with "42", or whatever textureID you want! (textureID has to be a whole number above 0)
In Minecraft 1.13 and below, you must use some type of damageable item (like a diamond hoe, diamond sword, bow, etc.). Keep in mind that, by default, if you change the material of the item, your custom item will act like that item. If you don't want that, you can add some handlers to change the item's behavior.
For those knowledgeable about resource packs, the tool's damage will be whatever you set the textureID to. If you aren't super knowledgeable about resource packs, keep reading!
item:
material: "minecraft:DIAMOND_SWORD"
textureID: 2
For the item above, in Minecraft 1.14 or above, the item's custom_model_data will be two
In Minecraft 1.13 or below, the tool's damage will be 1560/1562
Please take a look in the template texture pack below
1.13 and below texture pack template. If you're using only this resource pack and you aren't using fallback textures, then any time you want to add a new texture, set textureID
in the item yml file like shown above, and then put the texture in the resource pack. You should name it texture<textureID>
, so, for example, if textureID
is set to 42
in your item yml file, you should put your texture .png file at
/assets/minecraft/textures/item/custom/texture42.png
It's a little to complicated to include a tutorial on creating a custom resource pack here, but you can find a lot of good YouTube videos online. If you're using Minecraft 1.13 or below, you may find this site helpful, if you already know how to create a resource pack: https://geenium.github.io/damage-value-generator/