After watching a YouTube video on how to make a resource pack where the texture of an item is different depending on its damage, I decided to try to try and do it myself. I copied the code, got an image, and made the code for both the image file and the wood sword, which is the item that will have a different texture when damaged. Unfortunately, when I load the resource pack, the item has a "unknown" texture (the black and purple pattern of doom). I'm positive I typed the code right, what did I do wrong?
2 Answers
I typed in the exact same things from your screenshot and ran it (i used a golden sword instead of npcArtifact.png, and i called the JSON custom.json
instead of npcArtifact.json. Other than that, it's the exact same thing, and it works just fine.
Have you made sure to include npcArtifact.png
in assets/minecraft/textures/items
? That's where it belongs. Also make sure it's a png, not a renamed gif or jpg. you can make sure by opening it in gimp and exporting it with the appropriate file extension.
Also, your npcArtifact.json
should be located at assets/minecraft/models/item
. double-check you didn't put it into the textures folder.
Lastly, even though this sounds rediculous, but it happened to me a couple of times (being a resourcepack maker myself): make sure to put the files into the same resourcepack you are loading ingame - e.g. if you load a "respack.zip", but are working with the files inside a folder of your filesystem, make sure you copy them over into respack.zip before starting up minecraft!
hope that helps.
here's what my testfiles look like:
\assets\minecraft\models\item\wooden_sword.json
{
"parent": "item/handheld",
"textures": {
"layer0": "items/wood_sword"
},
"overrides":[
{"predicate":{"damaged":1,"damage":0.25},
"model":"item/custom"}]
}
\assets\minecraft\models\item\custom.json
{
"parent":"item/handheld",
"textures":{"layer0":"items/gold_sword"}
}
and the texture for the gold_sword is obviously located at \assets\minecraft\textures\items\gold_sword.png which is where your texture should go.
-
Thanks! But-there is a problem... When I copied and pasted your exact code in, and edited it, it didn't work. Yet when I used Inspect (a Google Chrome feature where you can edit a website's code, but it goes away when you reload the page) on your code and replaced it with my code, copied it, and pasted it into my code. It worked. This is very strange for me! Do you know how to fix this as well? Jun 22, 2016 at 0:53
-
Weelll.... apart from the possibility that you didn't highlight all of the text the first time you copied it, i'm afraid no. other than that, my code is really just your code, edited, so if you use my code and edit it, you essentially just get your code back. either way, i'm glad it worked for you, and sometimes it's just that minecraft didn't properly load the texturepack, i.e. because it was still being written to when mc fetched its contents on launch :) Jun 22, 2016 at 1:46
The problem you have, is that you are using a mac. I also using a mac, discovered the same problem . There are workarounds like the one you said, using an online text editor, but Text Edit changes the format.
Hope this helps!