Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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?

  • Author

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.