Jump to content

Model definition not found


JohniClark

Recommended Posts

Hello i tried to make an mod. but while starting the game and getting my item i just get an pink and black block. in the console it says: Model definition for location extendedemeralds:EmeraldNugget#inventory not found

here are my files.

emerald_nugget.json (Item Json)

Spoiler

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

ItemEmeraldNugget.java (Item FIle)

Spoiler

package me.johni.extendedemeralds.items;

import me.johni.extendedemeralds.ExtendedEmeralds;
import net.minecraft.item.Item;

public class ItemEmeraldNugget extends Item {
    
    public ItemEmeraldNugget() {
        this.setUnlocalizedName("emeraldnugget");
        this.setCreativeTab(ExtendedEmeralds.ee1);
    }

}
 

ExtendedEmeralds.java (Main File)

Spoiler

package me.johni.extendedemeralds;

import me.johni.extendedemeralds.items.ItemEmeraldNugget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
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.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@Mod(modid = ExtendedEmeralds.MODID, version = ExtendedEmeralds.VERSION)
public class ExtendedEmeralds {
    
    public static final String MODID = "extendedemeralds";
    public static final String VERSION = "1.0";
    
    /* Items */
    public static Item enugget = new ItemEmeraldNugget();
    
    
    public static CreativeTabs ee1 = new CreativeTabs("ExtendedEmeralds") {
        @Override
        @SideOnly(Side.CLIENT)
        public Item getTabIconItem() {
            return Items.emerald;
        }
    };
    
    
    @EventHandler
    public void PreInit(FMLPreInitializationEvent e) {
        ItemStack stackEmerald = new ItemStack(Items.emerald);
        ItemStack stackGoldNugget = new ItemStack(Items.gold_nugget, 9);
        
        GameRegistry.addShapelessRecipe(stackGoldNugget, stackEmerald);
        
    }
    
    @EventHandler
    public void Init(FMLInitializationEvent e) {
        GameRegistry.registerItem(enugget, "EmeraldNugget");
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(enugget, 0, new ModelResourceLocation(MODID + ":emerald_nugget", "inventory"));
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent e) {

        
    }
    
    

}
 

My Folder structure is in the file attached. also in the file you can see that i have an png too!

 

hope someone can help me.

folder struck.PNG

Link to comment
Share on other sites

You should use the registry events to register your items. Here is a good link for reference: http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/#comment-249433

 

Don't use Minecraft.getMinecraft().getRenderItem().getItemModelMesher() , use ModelLoader.setCustomResourceLocation.

 

IDs (mod, item, block, etc) should all be lowercase, both in code and assets (class/field names are fine to be mixed case, but registry names modid etc should all be lowercase)

 

Which version of MC/Forge?

 

Also, you should put your code on a github repo, it makes it much easier to look at :) plus version control is cool

Link to comment
Share on other sites

MC and Forge version 1.8. could you tell me where i typed something in uppercase? because you sayd to type everything in lowercase.

 

 

EDIT: i tried using modelloader and thats my new line : ModelLoader.setCustomModelResourceLocation(enugget, 0, new ModelResourceLocation(MODID + ":emerald_nugget", "inventory"));

 

but i get the same error : [15:16:27] [Client thread/ERROR] [FML]: Model definition for location extendedemeralds:EmeraldNugget#inventory not found

Edited by JohniClark
Link to comment
Share on other sites

3 minutes ago, JohniClark said:

MC and Forge version 1.8. could you tell me where i typed something in uppercase? because you sayd to type everything in lowercase.

Ok, 1.8 is getting old, so you should really think about updating. I doubt it will continue to be supported for very long, considering we're at 1.12.

 

Continue registering things in init/preinit where applicabile, since the registry events are 1.11+ (although I thought I saw someone say later 1.10.2 had them).

In your main class Init you call GameRegistry.register(enugget, "EmeraldNugget");, I believe that should be lowercase, and the same as your asset names.

Link to comment
Share on other sites

1 hour ago, JohniClark said:

can i add you somewhere. so that you can help me better?

You're better off continuing to post here, I'm not always available to help, and there are plenty of others here just as knowledgeable as I am, and even more experienced with forge than me.

Link to comment
Share on other sites

I know what the problem is but let me mention a couple things before I get to that. Looking at your code I think you probably based your effort off of one of my tutorials or github examples.

 

For an item model to show up, it needs to be 1) instantiated, 2) registered with a registry name 3) have a model JSON file with matching name in proper asset location, 4) have a texture with name pointed to by the model JSON.

 

Recently I've been improving a few things. I don't think they're causing you trouble in your case, but you should still probably update as follows.

 

In the JSON, the one you posted was copied from some vanilla and the scaling was modified because I think I wanted to make a bigger item than normal. If you just want a regular sized model you can use the following instead:

{
    "parent": "item/generated",
    "textures": {
        "layer0": "extendedemeralds:items/emerald_nugget"
    }
}

The second thing is to do what Ugdhar suggested and register using the ModelLoader instead of the item mesher.

 

However, I don't your error is caused by  that in your case it is explicitly telling you that the model is not found. That means it knows there is supposed to be a model therefore it means your item is registered at least as an item. Almost every time this happens to me it means that I have a typographical error somewhere and the names don't match.

 

Now one of the things that changed around 1.8 is they introduced the registry name as being separate from the unlocalized name. The registry name is the string used as the key for the registry and the unlocalized name is used for looking up localization in the lang file. There is no reason for them to be different but they can be so most people keep them the same.

 

Your problem is that when you register in the GameRegistry you use the wrong name -- it doesn't match your model file name. You put "EmeraldNugget" when it should be "emerald_nugget".

 

Generally to avoid having to type the name twice and have chance for errors, people instead now put a setRegistryName() call in the constructor and when using the GameRegistry register method you don't put any string at all. 

 

Be careful if you try to get fancy by trying to get the unlocalized name to set the registry name because the setUnlocalizedName() and getUnlocalizedName() are not symmetric -- you get a different thing back because it adds "item." to the front of the name. I get around this by creating a method for setting both names at once like this:

 

    // Need to call this on item instance prior to registering the item
    // chainable
    public static Item setItemName(Item parItem, String parItemName) {
        parItem.setRegistryName(parItemName);
        parItem.setUnlocalizedName(parItemName);
        return parItem;
       } 

 

Note I personally think it is a very weird thing to have the registry name in the item (or block which works the same way) but that's the way it works.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

42 minutes ago, JohniClark said:

I did register it as emerald_nugget in the gameregistry afterwards but i still get the same error : [Client thread/ERROR] [FML]: Model definition for location extendedemeralds:emerald_nugget#inventory not found

Post the entire fml-client-latest.log.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://youtube.com/shorts/gqLTSMymgUg?si=5QOeSvA4TTs-bL46
    • CubeHaven is a SMP server with unique features that can't be found on the majority of other servers! Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132 3 different stores: - CubeHaven Store: Our store to purchase using real money. - Bitcoin Store: Store for Bitcoin. Bitcoin can be earned from playing the server. Giving options for players if they want to spend real money or grind to obtain exclusive packages. - Black Market: A hidden store for trading that operates outside our traditional stores, like custom enchantments, exclusive items and more. Some of our features include: Rank Up: Progress through different ranks to unlock new privileges and perks. 📈 Skills: RPG-style skill system that enhances your gaming experience! 🎮 Leaderboards: Compete and shine! Top players are rewarded weekly! 🏆 Random Teleporter: Travel instantly across different worlds with a click! 🌐 Custom World Generation: Beautifully generated world. 🌍 Dungeons: Explore challenging and rewarding dungeons filled with treasures and monsters. 🏰 Kits: Unlock ranks and gain access to various kits. 🛠️ Fishing Tournament: Compete in a friendly fishing tournament! 🎣 Chat Games: Enjoy games right within the chat! 🎲 Minions: Get some help from your loyal minions. 👥 Piñata Party: Enjoy a festive party with Piñatas! 🎉 Quests: Over 1000 quests that you can complete! 📜 Bounty Hunter: Set a bounty on a player's head. 💰 Tags: Displayed on nametags, in the tab list, and in chat. 🏷️ Coinflip: Bet with other players on coin toss outcomes, victory, or defeat! 🟢 Invisible & Glowing Frames: Hide your frames for a cleaner look or apply a glow to it for a beautiful look. 🔲✨[ Player Warp: Set your own warp points for other players to teleport to. 🌟 Display Shop: Create your own shop and sell to other players! 🛒 Item Skins: Customize your items with unique skins. 🎨 Pets: Your cute loyal companion to follow you wherever you go! 🐾 Cosmetics: Enhance the look of your character with beautiful cosmetics! 💄 XP-Bottle: Store your exp safely in a bottle for later use! 🍶 Chest & Inventory Sorting: Keep your items neatly sorted in your inventory or chest! 📦 Glowing: Stand out from other players with a colorful glow! ✨ Player Particles: Over 100 unique particle effects to show off. 🎇 Portable Inventories: Over virtual inventories with ease. 🧳 And a lot more! Become part of our growing community today! Discord: https://cubehaven.net/discord Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132
    • # Problematic frame: # C [libopenal.so+0x9fb4d] It is always the same issue - this refers to the Linux OS - so your system may prevent Java from working   I am not familiar with Linux - check for similar/related issues  
    • Create a new instance and start with Embeddium/Oculus and Valkyrien Skies Try different builds of Embeddium/Valkyrien Skies until you find a working combination - then add the rest of your mods one by one or in groups
  • Topics

×
×
  • Create New...

Important Information

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