Jump to content

Problems with assets on 1.8


unlink

Recommended Posts

Hello, I recently started modding Minecraft and I've come to the point where I was trying to add textures to a test item and a test block that I created. It just doesn't seem to be working.

 

I've spent about 6 hours trying to figure out why it won't load the texture.

 

Here's what I'm getting from the debug logs:

 

[19:04:00] [Client thread/ERROR] [FML]: Model definition for location mkcm:test_block#inventory not found
[19:04:00] [Client thread/ERROR] [FML]: Model definition for location mkcm:test_block#normal not found
[19:04:00] [Client thread/ERROR] [FML]: Model definition for location mkcm:test_item#inventory not found

 

Here's my TestItem class

 

package me.krickl.TestMod.items;

import me.krickl.TestMod.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

/**
* Created by unlink on 3/5/15.
*/
public class TestItem extends Item {

    private final String name = "test_item";

    public TestItem() {
        GameRegistry.registerItem(this, name);
        setUnlocalizedName(Reference.MODID + "_" + name);
        setCreativeTab(CreativeTabs.tabMisc);
    }

    public String getName() {
        return name;
    }
}

 

and my Mod class

 

package me.krickl.TestMod;

import me.krickl.TestMod.blocks.TestBlock;
import me.krickl.TestMod.items.TestItem;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
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.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;


@Mod(modid = Reference.MODID, name = Reference.MODNAME, version = Reference.VERSION)
public class TestMod {
    //items
    public static Item testItem;

    //blocks
    public static Block testBlock;

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        //init items and blocks
        testItem = new TestItem();
        testBlock = new TestBlock();
    }

    @EventHandler
    public void init(FMLInitializationEvent event) {
        // only run on client side! This code will raise an exception if run on server side
        if( event.getSide() == Side.CLIENT ) {
            RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();

            //blocks
            renderItem.getItemModelMesher().register(Item.getItemFromBlock(testBlock), 0,
                    new ModelResourceLocation((Reference.MODID + ":" + ((TestBlock)testBlock).getName()), "inventory"));
            System.out.println(Reference.MODID + ":" + ((TestBlock) testBlock).getName());
            //items
            renderItem.getItemModelMesher().register(testItem, 0,
                            new ModelResourceLocation(Reference.MODID + ":" + ((TestItem) testItem).getName(), "inventory"));
        }
    }

}

 

my Reference class

 

package me.krickl.TestMod;

/**
* Created by unlink on 3/5/15.
*/
public class Reference {
    public static final String MODID = "mkcm";
    public static final String MODNAME = "TestMod";
    public static final String VERSION = "1.0";
}

 

My test_item.json

 

{
  "parent": "builtin/generated",
  "textures": {
    "layer0": "mkcm:items/test_item"
  },
  "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 ]
    }
  }
}

and lastly my file structure

 

width=210 height=324dfuwMD4.png?1 [/img]

 

I just can't figure out why I can't load textures. I hope you can help me. Thanks in advance ;)

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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