hjk321
hjk321

Reputation: 123

Forge 1.11 Texturing Problems

As forge standards have recently changed, it is hard to find applicable posts already on this site, so I have resorted to posting one myself. I am trying to add a texture/model to an item, but upon compiling, I see this:

I register the model using the following code, invoked through the client proxy in the init phase:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(modid + ":" + item.getUnlocalizedName().substring(5), "inventory"));

"item" and "modid" are properly defined in the scope above.

Here is my standard item model which the item inherits from, located at src/main/resources/assets/ultramc/models/item:

{
"thirdperson_righthand": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 1 ],
"scale": [ 0.55, 0.55, 0.55 ]
},
"firstperson_righthand": {
"rotation": [ 0, -90, 25 ],
"translation": [ 1.13, 3.2, 1.13],
"scale": [ 0.68, 0.68, 0.68 ]
}
}

... and the actual child model located at the same spot:

{
"parent":"ultramc:item/basic_item",
"textures": {
    "layer0":"ultramc:items/iron_nugget"
}
}

The texture in question is a 16x16 png file located at src/main/resources/assets/ultramc/textures/items and is named iron_nugget.png.

I'm not sure what I'm doing wrong, I followed the tutorial very closely. Any help would be greatly appreciated. Thanks!

EDIT:

Here is my source folder, because why not.

https://i.sstatic.net/6vSKj.png

Upvotes: 1

Views: 715

Answers (2)

hjk321
hjk321

Reputation: 123

I figured it out finally.

First of all, the "basic item" JSON was a bad idea. using item/generated is perfectly fine. Here is the code for those in the future that may need this:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "modid:item_name"
    }
}

Also, one thing: textures should not be under assets.modid.textures.items, but instead simply under assets.modid.textures unless you want to update the "layer0" JSON to modid:items/item_name. Heck, you could have a whole organization system under your textures folder and it would work as long as you put it right in the model file.

One last word of advice: make sure the model file name is exactly the same as the unlocalized item name of your item, or it won't work. Oh yeah, the texture should always be .png, too.

Thanks to everyone for their help, and I hope this helps future modders fufill their dreams. :)

Upvotes: 1

LPMG
LPMG

Reputation: 1

Try registering the item like this:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getUnlocalizedName(), "inventory"));

I´m not sure, but this should work!

-LPMG

Upvotes: 0

Related Questions