Jump to content

Recommended Posts

Posted

Hi guys,

 

As a bit of back story I have the following path to my item and block textures and model files:

textures: assets/<modid>/textures/items/dusts/

model: assets/<modid>/models/items/dusts/

 

And I'm trying to attempt to use the following code to register my model files:

public void registerItem(ItemCT item) {
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(
        item.getUnlocalizedName().substring(5), "inventory"));

 

Now, in  me doing this, if I put the following in my init class:

registerItem(instances.alkaline);

 

and run the game, I get the following error:

[code[

java.io.FileNotFoundException: comtech:blockstates/dust_alkaline.json

[/code]

 

What that is telling me is that it's trying to look in the "blockstates" directory (which I do not have). So my question is:

 

How do I tell forge to look in my  models/items/dusts *or* ingots *or* usables *and so on*/?

 

It looks as though forge places "blockstates/" into the middle of my string, so how can I do that?

 

Thanks

Posted

OK, I've started doing that, but I'm unable to figure out how to pass the name of my item:

ModelLoader.setCustomModelResourceLocation(item, 0,
    new ModelResourceLocation("CT:" + "models/items/dusts/" *how do I give forge my item here?*, "inventory"));

 

Although you said I shouldn't use unlocalized name, I did... but like this:

ModelLoader.setCustomModelResourceLocation(item, 0,
    new ModelResourceLocation("CT:" + "models/items/dusts/" + item.getUnlocalizedName().substring(5).replace("CT:", ""),
        "inventory"));

 

And had better success with this... The only problem with it is that I get the following:

java.lang.Exception: Could not load model definition for variant comtech:models/items/dust/dust_alkaline#inventory

 

What's happening with the "#inventory" as it seems to be throwing forge off, and I don't know if it's needed and don't know how to rid of it?

Posted

OK, so I'm probably doing this wrong as its still throwing a file not found error:

[19:53:14] [Client thread/ERROR]: Model definition for location comtech:models/item/dust/dust_alkaline#inventory not found

 

and my file structure:

assets/comtech/models/item *changed this from "items"*/dusts/dust_alkaline.json

 

private static void registerItem(ItemCT item, final String itemName) {
	ModelLoader.setCustomModelResourceLocation(item, 0,
			new ModelResourceLocation(
					Reference.resource.PREFIX + "models/item/dust/" +
					itemName,
					"inventory"));
}

 

I put item name in there as it's only putting #inventory after the file path.

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.