Jump to content

[1.8] Texture not loading


Recommended Posts

For some reason, my texture isn't loading. This is my main FirstMod.java code.


package com.andytphan.firstmod;

import com.andytphan.firstmod.ItemKey;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = FirstMod.MODID, version = FirstMod.VERSION)
public class FirstMod
    public static final String MODID = "firstmod";
    public static final String VERSION = "1.0";
    public static Item key;
    public void preInit (FMLPreInitializationEvent event)
    	key = new ItemKey();
    	GameRegistry.registerItem(key, "key");
    public void init(FMLInitializationEvent event)
    	GameRegistry.addRecipe(new ItemStack(Items.apple),
    			'X', Blocks.leaves
    	ItemStack enchantedStoneSword = new ItemStack(Items.stone_sword);
    	enchantedStoneSword.addEnchantment(Enchantment.sharpness, 5);
    	enchantedStoneSword.addEnchantment(Enchantment.knockback, 5);
    	GameRegistry.addShapelessRecipe(enchantedStoneSword, Items.stone_sword, Items.flint, Items.gunpowder);
    public void postInit(FMLPostInitializationEvent event) {
    	if(event.getSide() == Side.CLIENT) {
    		RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    		renderItem.getItemModelMesher().register(key, 0, new ModelResourceLocation(MODID + ":" + "key", "inventory"));


This is my Key item code.

package com.andytphan.firstmod;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ItemKey extends Item {
public ItemKey() {
	GameRegistry.registerItem(this, "key");
	setUnlocalizedName(FirstMod.MODID + "_" + "key");



Finally, this is my json file code.


"parent": "builtin/generated",
"textures": {
	"layer0": "firstmod/items:key"
"display": {
	"thirdperson": {
		"rotation": [ -90, 0, 0 ],
		"translation": [ 0, 1, -3 ],
		"scale": [ 0.55, 0.55, 0.55 ]
	"firstperson": {
		"rotation": [ 0, -135, 25 ],
		"translation": [0, 4, 2],
		"scale": [ 1.7, 1.7, 1.7]

Link to comment
Share on other sites

You've mixed up the slash and the colon in your model's texture path. The colon separates the resource domain (your mod ID) from the resource path (the path of the texture relative to assets/<modid>/textures), the slash separates directories within the resource path (like in regular file paths). Use


instead of




You should use the sided proxy system (i.e. the


annotation) to register your models rather than checking for the client side in your




You should also use Forge's




in preInit instead of Minecraft's


overloads in init/postInit.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Do not do that ItemModelMesher stuff that you do in postInit (if you were to use that it'd have to be in init).

Use ModelLoader.setCustomModelResourceLocation in preInit. The rendering registration also needs to be in your ClientProxy or you will crash servers with your mod.

What is the full path to the json file?


The path to the json file is pathtomodding/src/main/resources/assests/firstmod/models/items/key.json.

Link to comment
Share on other sites

Modders who use crafting tables to make enchanted items have often run into trouble, so don't be surprised if your enchantedStoneSword recipe rinses away your enchantments. Be sure to test it to find out.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.