Jump to content

(fixed) (1.8.9)Model definition for location *item* #inventory not found


Anora

Recommended Posts

I'm getting these errors witch I was not at first when I only had oreDragonite

 

[22:17:16] [Client thread/ERROR] [FML]: Model definition for location gc:oreAluminum#inventory not found

[22:17:16] [Client thread/ERROR] [FML]: Model definition for location gc:oreDragonite#inventory not found <-- was previously working

[22:17:16] [Client thread/ERROR] [FML]: Model definition for location gc:mystic_crafting_table#inventory not found

[22:17:16] [Client thread/ERROR] [FML]: Model definition for location gc:oreCopper#inventory not found

 

2:17:16]package anora.guildcraft.main.init;

import anora.guildcraft.main.Guildcraft;
import anora.guildcraft.main.Reference;
import anora.guildcraft.main.blocks.Gblock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class GcBlocks {

public static Block oreDragonite;
public static Block oreAluminum;
public static Block oreCopper;

public static Block mystic_crafting_table;

public static void init()
{
	oreDragonite = new Gblock(Material.rock).setUnlocalizedName("oreDragonite").setCreativeTab(Guildcraft.tabguildcraft);
	oreAluminum = new Gblock(Material.rock).setUnlocalizedName("oreAluminum").setCreativeTab(Guildcraft.tabguildcraft);
	oreCopper = new Gblock(Material.rock).setUnlocalizedName("oreCopper").setCreativeTab(Guildcraft.tabguildcraft);

	mystic_crafting_table = new Gblock(Material.wood).setUnlocalizedName("mystic_crafting_table").setCreativeTab(Guildcraft.tabguildcraft);
}

public static void register()
{
	GameRegistry.registerBlock(oreDragonite, oreDragonite.getUnlocalizedName().substring(5));
	GameRegistry.registerBlock(oreAluminum, oreAluminum.getUnlocalizedName().substring(5));
	GameRegistry.registerBlock(oreCopper, oreCopper.getUnlocalizedName().substring(5));

	GameRegistry.registerBlock(mystic_crafting_table, mystic_crafting_table.getUnlocalizedName().substring(5));

	GameRegistry.addSmelting(oreDragonite, new ItemStack(GcItems.ingotDragonite, 1), 0.0F);
}

public static void registerRenders()
{
	registerRender(oreDragonite);
	registerRender(oreAluminum);
	registerRender(oreCopper);

	registerRender(mystic_crafting_table);
}

public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

Link to comment
Share on other sites

pretty sure you have to manually register ItemBlocks.

 

You do.  It is because it allows for "technical" blocks to exist without them having an inventory object.

(e.g. I don't think you can get Fire as an item in your inventory any more)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

GameRegistry.registerBlock

registers the

ItemBlock

for you in 1.8.9 (unless you use an overload with a

Class<? extends ItemBlock>

argument and pass

null

).

GameRegistry.register

(the 1.9 replacement) doesn't.

 

Don't use unlocalised names as registry names. Registry names are IDs and must not change, unlocalised names can change at any time. Use

Block#setRegistryName

to set your registry names and the single-argument overload of

GameRegistry.registerBlock

to register your blocks, the same applies to items. If you want, you can set the unlocalised name of your block/item to its full registry name; this will include your mod ID to avoid conflicts with other mods.

 

Don't use unlocalised names as model names. The default model loaded for every item is the one with its registry name.

 

Don't use

ItemModelMesher#register

to register item models, use

ModelLoader.setCustomMeshDefinition

/

setCustomModelResourceLocation

in preInit.

 

Do you actually have item models with those names?

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

Did the changes as recommended whit the knowledge i have so far, still learning.

 

but i get a different error

Error:

[11:09:48] [Client thread/ERROR] [FML]: Exception loading model for variant gc:gc:aluminum_ore#inventory
java.lang.Exception: Could not load model definition for variant gc:gc:aluminum_ore#inventory
at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:219) ~[ModelLoader.class:?]
at net.minecraftforge.client.model.ModelLoader.loadItems(ModelLoader.java:256) ~[ModelLoader.class:?]
at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:120) ~[ModelLoader.class:?]
at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:772) [Minecraft.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:326) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:360) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:116) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model gc:blockstates/gc:aluminum_ore.json
at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:165) ~[ModelBakery.class:?]
at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:215) ~[ModelLoader.class:?]

 

by what I can tell fir sine reason its looking in gc:blockstates/gc:aluminum_ore.json witch i know is wrong it should just be gc:blockstates/aluminum_ore.json

 

 

Code:

package anora.guildcraft.main.init;

import anora.guildcraft.main.Guildcraft;
import anora.guildcraft.main.Reference;
import anora.guildcraft.main.blocks.Gblock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class GcBlocks {

public static Block oreDragonite;
public static Block oreAluminum;
public static Block oreCopper;

public static Block tableMystic;

public static void init()
{
	oreDragonite = new Gblock(Material.rock).setRegistryName("dragonite_ore").setCreativeTab(Guildcraft.tabguildcraft);
	oreAluminum = new Gblock(Material.rock).setRegistryName("aluminum_ore").setCreativeTab(Guildcraft.tabguildcraft);
	oreCopper = new Gblock(Material.rock).setRegistryName("copper_ore").setCreativeTab(Guildcraft.tabguildcraft);

	tableMystic = new Gblock(Material.wood).setRegistryName("mystic_crafting_table").setCreativeTab(Guildcraft.tabguildcraft);
}

public static void register()
{
	GameRegistry.registerBlock(oreDragonite, oreDragonite.getRegistryName());
	GameRegistry.registerBlock(oreAluminum, oreAluminum.getRegistryName());
	GameRegistry.registerBlock(oreCopper, oreCopper.getRegistryName());

	GameRegistry.registerBlock(tableMystic, tableMystic.getRegistryName());

	GameRegistry.addSmelting(oreDragonite, new ItemStack(GcItems.ingotDragonite, 1), 0.0F);
}

public static void registerRenders()
{
	registerRender(oreDragonite);
	registerRender(oreAluminum);
	registerRender(oreCopper);

	registerRender(tableMystic);
}

public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0 , new ModelResourceLocation(Reference.MOD_ID + ":" + item.getRegistryName(), "inventory"));
}
}

Link to comment
Share on other sites

ModelLoader.setCustomModelResourceLocation(item, 0 , new ModelResourceLocation(Reference.MOD_ID + ":" + item.getRegistryName(), "inventory"));

 

Item#getRegistryName

returns a name that already includes your mod ID, but you're adding your mod ID again before registering the model.

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

so if i change it to this

 

ModelLoader.setCustomModelResourceLocation(item, 0 , new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

it would fix it.

 

It would fix that particular error, yes. I don't know if there are any other issues with your models.

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

well its fixed that but now back to the same problem those same models are not being found and to make maters worse all the items I had that were loading stop loading... I am great full for you help so much as changed sins 1.6

 

[14:39:44] [Client thread/ERROR] [FML]: Model definition for location gc:copper_ore#inventory not found

[14:39:44] [Client thread/ERROR] [FML]: Model definition for location gc:aluminum_ore#inventory not found

[14:39:44] [Client thread/ERROR] [FML]: Model definition for location gc:dragonite_ore#inventory not found

[14:39:44] [Client thread/ERROR] [FML]: Model definition for location gc:mystic_crafting_table#inventory not found

 

source code as not changed much other then the line I show you

 

hers a snap shop of my file structure  https://www.dropbox.com/s/3sm0ah5kajrifjv/file%20pathsd.png?dl=0

 

found the problem, it was in the json's

 

You guys got a live chat server at all?

Link to comment
Share on other sites

Could you upload your full FML log (logs/fml-client-latest.log) to Gist and link it here?

 

Your model directory should be called models, not Models. It may not matter in the development environment since paths in Windows are case-insensitive, but it will probably not work in the release environment since paths JAR files are case-sensitive.

 

I believe there is a Forge IRC channel, but I only offer help in forum threads.

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

That appears to be the console output, please post the actual FML log.

 

I can't see any model errors in that log, only missing textures.

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

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.

×
×
  • Create New...

Important Information

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