Jump to content

Items Missing Model w/o error


Helinos

Recommended Posts

I'm new to modding and I'm currently in the process of making my first mod, all it does at the moment is add two items.

However, I can't seem to find the reason to why the items won't render (Missing model), I have the Jsons, Pngs, i believe I have everything set up correctly, the items show up in game, and I can't even find an error in the console.

But they don't   have   a model.

 

Minecraft 1.10.2

Forge 1.10.2-12.18.3.2185

Eclipse neon.2

 

Code:

-Download

https://www.dropbox.com/s/8rs0dhk9hzdc8z1/Basic.zip?dl=0

 

-Basic.java

package com.helinos.basic;

import com.helinos.basic.init.ModItems;
import com.helinos.basic.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class Basic {

    @Instance
    public static Basic instance;
    
    @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
    public static CommonProxy proxy;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
        System.out.println("Pre Init");
        
        ModItems.init();
        ModItems.register();
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        System.out.println("Init");
        proxy.init();
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
        System.out.println("Post Init");        
    }
}

-Reference.java

package com.helinos.basic;

public class Reference {
    
    public static final String MOD_ID = "helinosbasicmod";
    public static final String NAME = "Helinos' Basic Mod";
    public static final String VERSION = "1.0";
    public static final String ACCEPTED_VERSIONS = "[1.10.2]" ;
    
    public static final String CLIENT_PROXY_CLASS = "com.helinos.basic.proxy.ClientProxy";
    public static final String SERVER_PROXY_CLASS = "com.helinos.basic.proxy.ServerProxy";

    public static enum BasicItems
    {
        SMALLDIAMONDCHUNK("smalldiamondchunk", "ItemSmallDiamondChunk"),
        LARGEDIAMONDCHUNK("largediamondchunk", "ItemLargeDiamondChunk");
        
        private String unlocalizedName;
        private String registryName;
        
        BasicItems(String unlocalizedName, String registryName) {
            this.unlocalizedName = unlocalizedName;
            this.registryName = registryName;
        }
        
        public String getUnlocalizedName() {
            return unlocalizedName;
        }
        
        public String getRegistryName() {
            return registryName;
        }
    }
}

-ModItems.java

package com.helinos.basic.init;

import com.helinos.basic.Reference;
import com.helinos.basic.items.ItemLargeDiamondChunk;
import com.helinos.basic.items.ItemSmallDiamondChunk;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {
    
    public static Item smalldiamondchunk;
    public static Item largediamondchunk;

    public static void init()
    {
        smalldiamondchunk = new ItemSmallDiamondChunk();
        largediamondchunk = new ItemLargeDiamondChunk();
    }
        
    public static void register()
    {
        GameRegistry.register(smalldiamondchunk);
        GameRegistry.register(largediamondchunk);
    }
        
    public static void registerRenders()
    {
        registerRender(smalldiamondchunk);    
        registerRender(largediamondchunk);
    }
        
    private static void registerRender(Item item)
    {
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }
}

-SmallDiamondChunk.java & Json

Spoiler

package com.helinos.basic.items;

import com.helinos.basic.Reference;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class ItemSmallDiamondChunk extends Item {
    
    public ItemSmallDiamondChunk() {
        setUnlocalizedName(Reference.BasicItems.SMALLDIAMONDCHUNK.getUnlocalizedName());
        setRegistryName(Reference.BasicItems.SMALLDIAMONDCHUNK.getRegistryName());
        this.setCreativeTab(CreativeTabs.MATERIALS);
    }
}

LargeDiamondChunk.java is the same with "Large" instead of "Small" in all cases


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

LargeDiamondChunk.json is the same with "Large" instead of "Small" in all cases

-Smaller Files

Spoiler

CommonProxy.java


package com.helinos.basic.proxy;

public interface CommonProxy {

    public void init();
}

ClientProxy.java


package com.helinos.basic.proxy;

import com.helinos.basic.init.ModItems;

public class ClientProxy implements CommonProxy{

    @Override
    public void init() {
        ModItems.registerRenders();
    }

}

ServerProxy.java


package com.helinos.basic.proxy;

public class ServerProxy implements CommonProxy{

    @Override
    public void init() {}

}

 

Log

Spoiler

[13:57:45] [Client thread/INFO] [FML]: MinecraftForge v12.18.3.2185 Initialized
[13:57:45] [Client thread/INFO] [FML]: Replaced 231 ore recipes
[13:57:45] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[13:57:45] [Client thread/INFO] [FML]: Searching E:\Modding\Basic\run\mods for mods
[13:57:46] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[13:57:46] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, helinosbasicmod] at CLIENT
[13:57:46] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, helinosbasicmod] at SERVER
[13:57:46] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Helinos's Basic Mod
[13:57:46] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[13:57:46] [Client thread/INFO] [FML]: Found 423 ObjectHolder annotations
[13:57:46] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations
[13:57:46] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[13:57:46] [Client thread/INFO] [FML]: Applying holder lookups
[13:57:46] [Client thread/INFO] [FML]: Holder lookups applied
[13:57:46] [Client thread/INFO] [FML]: Applying holder lookups
[13:57:46] [Client thread/INFO] [FML]: Holder lookups applied
[13:57:46] [Client thread/INFO] [FML]: Applying holder lookups
[13:57:46] [Client thread/INFO] [FML]: Holder lookups applied
[13:57:46] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[13:57:46] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[13:57:46] [Client thread/INFO] [STDOUT]: [com.helinos.basic.Basic:preInit:26]: Pre Init
[13:57:46] [Client thread/INFO] [FML]: Applying holder lookups
[13:57:46] [Client thread/INFO] [FML]: Holder lookups applied
[13:57:46] [Client thread/INFO] [FML]: Injecting itemstacks
[13:57:46] [Client thread/INFO] [FML]: Itemstack injection complete
[13:57:49] [Sound Library Loader/INFO]: Starting up SoundSystem...
[13:57:50] [Thread-8/INFO]: Initializing LWJGL OpenAL
[13:57:50] [Thread-8/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[13:57:50] [Thread-8/INFO]: OpenAL initialized.
[13:57:50] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: UP_TO_DATE Target: null
[13:57:50] [Sound Library Loader/INFO]: Sound engine started
[13:57:53] [Client thread/INFO] [FML]: Max texture size: 16384
[13:57:53] [Client thread/INFO]: Created: 16x16 textures-atlas
[13:57:54] [Client thread/INFO] [STDOUT]: [com.helinos.basic.Basic:init:35]: Init
[13:57:54] [Client thread/INFO] [FML]: Injecting itemstacks
[13:57:54] [Client thread/INFO] [FML]: Itemstack injection complete
[13:57:54] [Client thread/INFO] [STDOUT]: [com.helinos.basic.Basic:postInit:42]: Post Init
[13:57:54] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[13:57:54] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Helinos's Basic Mod
[13:57:57] [Client thread/INFO]: SoundSystem shutting down...
[13:57:57] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[13:57:57] [Sound Library Loader/INFO]: Starting up SoundSystem...
[13:57:58] [Thread-10/INFO]: Initializing LWJGL OpenAL
[13:57:58] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[13:57:58] [Thread-10/INFO]: OpenAL initialized.
[13:57:58] [Sound Library Loader/INFO]: Sound engine started
[13:58:01] [Client thread/INFO] [FML]: Max texture size: 16384
[13:58:01] [Client thread/INFO]: Created: 512x512 textures-atlas
[13:58:02] [Client thread/WARN]: Skipping bad option: lastServer:
[13:58:04] [Server thread/INFO]: Starting integrated minecraft server version 1.10.2
[13:58:04] [Server thread/INFO]: Generating keypair

 

Screenshot:

 OztGfZj.png

ada0f1f9d6d80d80b5561313ab8cb5d9.png

 

 

Link to comment
Share on other sites

ModelLoader.setCustomModelResourceLocation needs to be called in preInit rather than init. Also, resource paths (like your json filenames) should be all lowercase.

 

4 minutes ago, Burpingdog1 said:

I think the problem is in your moditems file, you forgot to give it the destination to your mod folder
 


new ModelResourceLocation(Reference.MODID+":"+item.getRegistryName(), "inventory")

This is incorrect - Item#getRegistryName() already includes the modid.

 

 

Link to comment
Share on other sites

9 minutes ago, Jay Avery said:

ModelLoader.setCustomModelResourceLocation needs to be called in preInit rather than init. Also, resource paths (like your json filenames) should be all lowercase.

This worked

If anyone ever references this (which they probably won't) I moved "proxy.init" in basic.java from init to preinit

Link to comment
Share on other sites

37 minutes ago, Burpingdog1 said:

oh, whats the difference between using Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register and  ModelLoader.setCustomModelResourceLocation ?

The second one works.  The first one is an old, out dated, unreliable method that has been deprecated in favor of the latter.

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

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.