Jump to content

Recommended Posts

Posted

Hi!

 

I keep getting an error when loading my "ingot"

 

  Quote
[19:32:40] [Client thread/ERROR] [FML]: Exception loading model for variant bot:copper_ingot#inventory for item "bot:copper_ingot", blockstate location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model bot:copper_ingot#inventory with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:338) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

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_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 23 more

 

The ingot is a black and purple texture on loading,  the error above i get multiple times when loading

 

This is my copper_ingot.json

 

{
    "parent": "item/generated,
    "textures":
    {
    "layer0": "bot:items/copper_ingot"
    },
}

 

and this is my registering

 

package Fatal1tyGC.BitofTuts.init;

import Fatal1tyGC.BitofTuts.Reference;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

public static Item copper_ingot;

public static void init(){
	copper_ingot = new Item().setUnlocalizedName("copper_ingot").setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64);
}

public static void register(){
	registerItem(copper_ingot);
}

public static void registerRenders(){
	registerRender(copper_ingot);
}

public static void registerItem(Item item){
	GameRegistry.register(item.setRegistryName("copper_ingot"));
	System.out.println("Registered Item: " + item.getUnlocalizedName().substring(5));
	//GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
}

public static void registerRender(Item item){
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));	
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

}

}

 

The mod id = "bot"

I rechecked everything like 4 times but cant find what is the exact problem,  i hope someone can help me with this!

 

Posted

Im calling it in the init ->

 

package Fatal1tyGC.BitofTuts;

import Fatal1tyGC.BitofTuts.init.ModItems;
import Fatal1tyGC.BitofTuts.proxy.CommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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.MODID, name = Reference.NAME, version = Reference.VERSION)

public class BitofTuts {

@SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)
public static CommonProxy proxy;

@Mod.Instance("bot")
public static BitofTuts instance;

@EventHandler()
public static void preInit(FMLPreInitializationEvent event){
	ModItems.init();
	ModItems.register();
}

@EventHandler()	
public static void init(FMLInitializationEvent event){
	proxy.registerRenders();
}

@EventHandler()
public static void postIn(FMLPostInitializationEvent event){
	System.out.println();
}

}

 

This is the ClientProxy

 

package Fatal1tyGC.BitofTuts.proxy;

import Fatal1tyGC.BitofTuts.init.ModItems;

public class ClientProxy extends CommonProxy{

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

}

 

 

 

Posted
  On 8/3/2016 at 6:10 PM, luckie12 said:

Im calling it in the init ->

 

package Fatal1tyGC.BitofTuts;

import Fatal1tyGC.BitofTuts.init.ModItems;
import Fatal1tyGC.BitofTuts.proxy.CommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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.MODID, name = Reference.NAME, version = Reference.VERSION)

public class BitofTuts {

@SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)
public static CommonProxy proxy;

@Mod.Instance("bot")
public static BitofTuts instance;

@EventHandler()
public static void preInit(FMLPreInitializationEvent event){
	ModItems.init();
	ModItems.register();
}

@EventHandler()	
public static void init(FMLInitializationEvent event){
	proxy.registerRenders();
}

@EventHandler()
public static void postIn(FMLPostInitializationEvent event){
	System.out.println();
}

}

 

renders should only happen on the client proxy

Doing stuff n' things

Posted

I have this too -> i forgot to add it, sorry

 

package Fatal1tyGC.BitofTuts.proxy;

import Fatal1tyGC.BitofTuts.init.ModItems;

public class ClientProxy extends CommonProxy{

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

}

 

ClientProxy.java

Posted

What is this:

ModelLoader.setCustomModelResourceLocation

i never seen it before..

why arent you using:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

that's how i made it register renders..

Doing stuff n' things

Posted

This is the log

 

 

 

  Reveal hidden contents

 

Posted

package Fatal1tyGC.BitofTuts.init;

import Fatal1tyGC.BitofTuts.Reference;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

public static Item copper_ingot;

public static void init(){
	copper_ingot = new Item().setUnlocalizedName("copper_ingot").setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64);
}

public static void register(){
	registerItem(copper_ingot);
}

public static void registerRenders(){
	registerRender(copper_ingot);
}

public static void registerItem(Item item){
	GameRegistry.register(item.setRegistryName("copper_ingot"));
	System.out.println("Registered Item: " + item.getUnlocalizedName().substring(5));
	//GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
}

public static void registerRender(Item item){
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));	
	//ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getRegistryName(),"inventory"));
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getRegistryName(), "inventory"));
}

}


There you go :-)

Posted

My registerRender:

 

	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

 

  Reveal hidden contents

 

 

Same errors...

 

 

2accb0a0887d49e989e112200f7dc40b.png

 

how the structure is like

 

This is my JSON:

 

{
    "parent": "item/generated,
    "textures":
    {
    "layer0": "bot:items/copper_ingot"
    },
}

Posted

Sorry, but ModelLoader.setCustomModelResourceLocation is the Forge-provided method for registering your model for an item/block, and should be initialized in your preInit, not init.

Don't use Minecraft.getMinecraft().getRenderItem().getItemModelMesher. Bit more info on why, here: http://www.minecraftforge.net/forum/index.php?topic=35986.0

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

Sadly, that was not the fix :( Still getting the same errors and black/pink texture

 

 

  Reveal hidden contents

 

Posted
  On 8/3/2016 at 6:50 PM, Matryoshika said:

Sorry, but ModelLoader.setCustomModelResourceLocation is the Forge-provided method for registering your model for an item/block, and should be initialized in your preInit, not init.

Don't use Minecraft.getMinecraft().getRenderItem().getItemModelMesher. Bit more info on why, here: http://www.minecraftforge.net/forum/index.php?topic=35986.0

its fine for me... 1.10.2

works perfectly

 

 

Doing stuff n' things

Posted

Eh,, the model is supposed to be an Iron ingot cover, like with a new texture...

 

I dont have anything insidemy bot/models/item

folder,only the copper_ingot.json,

which is:

 

{
    "parent": "item/generated",
    "textures":
    {
    "layer0": "bot:items/copper_ingot"
    },
}

Posted
  On 8/3/2016 at 6:53 PM, SHsuperCM said:

  Quote

Sorry, but ModelLoader.setCustomModelResourceLocation is the Forge-provided method for registering your model for an item/block, and should be initialized in your preInit, not init.

Don't use Minecraft.getMinecraft().getRenderItem().getItemModelMesher. Bit more info on why, here: http://www.minecraftforge.net/forum/index.php?topic=35986.0

its fine for me... 1.10.2

works perfectly

 

Here's a quote from @jeffryfisher explaining it a bit better:

  Quote

Right, the mesher's timing was very sensitive. Not only did it need to wait until Init, but it had to be in the right order with some other things and it was easy to screw up, hence it was deprecated (and there's a special level of modder Hell reserved for tutorial writers who subsequently told people to use it anyway).

 

As several forum experts have mentioned in about 100 threads here over the last year+, the loader can and should be called in preInit. It is preferred because it's timing is not subject to the same disruption as the mesher.

 

@luckie12

You can look through my own GitHub and compare against what I have: https://github.com/Matryoshika/Underworld/tree/master/src/main/java/se/Matryoshika/Underworld/Content/Rendering

The Renderers are called from the ClientProxy in preInit.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

ok now i really have no clue of what's going on... its a bit wierd for me because my ModItems class and ModBlocks class look a bit diffrent...  im using a diffrent way of registring and registring renders.... i might not be able to help anymore....

 

 

Doing stuff n' things

Posted

Im getting confused too, this is what i have:

 

Reference.java

package Fatal1tyGC.BitofTuts;

public class Reference {

public static final String MODID = "bot";
public static final String NAME = "BitofTuts";
public static final String VERSION = "1.0";
public static final String SERVER_PROXY_CLASS = "Fatal1tyGC.BitofTuts.proxy.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "Fatal1tyGC.BitofTuts.proxy.ClientProxy";

}

 

CommonProxy.java

package Fatal1tyGC.BitofTuts.proxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class CommonProxy {

public void preInit(FMLPreInitializationEvent event){

    }

    public void init(FMLInitializationEvent event) {

    }


    public void postInit(FMLPostInitializationEvent event) {

    }
}

 

ModItems.java

 

package Fatal1tyGC.BitofTuts.init;

import Fatal1tyGC.BitofTuts.Reference;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

public static Item copper_ingot;

public static void init(){
	copper_ingot = new Item().setUnlocalizedName("copper_ingot").setCreativeTab(CreativeTabs.MISC).setMaxStackSize(64);
}

public static void register(){
	registerItem(copper_ingot);
}

public static void registerRenders(){
	registerRender(copper_ingot);
}

public static void registerItem(Item item){
	GameRegistry.register(item.setRegistryName("copper_ingot"));
	System.out.println("Registered Item: " + item.getUnlocalizedName().substring(5));
	//GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
}

public static void registerRender(Item item){
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));	
	//ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getRegistryName(),"inventory"));
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

}

 

 

ClientProxy.java

 

package Fatal1tyGC.BitofTuts.proxy;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import Fatal1tyGC.BitofTuts.init.ModItems;

public class ClientProxy extends CommonProxy{

public void PreInit(FMLPreInitializationEvent event){
	ModItems.registerRenders();
}

public void registerRenders() {
	ModItems.registerRenders();
}

}

 

copper_ingot.json

{
    "parent": "item/generated",
    "textures":
    {
    "layer0": "bot:items/copper_ingot"
    },
}

 

And my main file

BitofTuts.java

package Fatal1tyGC.BitofTuts;

import Fatal1tyGC.BitofTuts.init.ModItems;
import Fatal1tyGC.BitofTuts.proxy.CommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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.MODID, name = Reference.NAME, version = Reference.VERSION)

public class BitofTuts {

@SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)
public static CommonProxy proxy;

@Mod.Instance("bot")
public static BitofTuts instance;

@EventHandler()
public static void preInit(FMLPreInitializationEvent event){
	ModItems.init();
	ModItems.register();
}

@EventHandler()	
public static void init(FMLInitializationEvent event){
	//proxy.registerRenders();
}

@EventHandler()
public static void postIn(FMLPostInitializationEvent event){
	System.out.println();
}

}

Posted
  On 8/3/2016 at 7:01 PM, Matryoshika said:

@luckie12

You can look through my own GitHub and compare against what I have: https://github.com/Matryoshika/Underworld/tree/master/src/main/java/se/Matryoshika/Underworld/Content/Rendering

The Renderers are called from the ClientProxy in preInit.

why is your item rendering in a diffrent class? it just makes the whole adding an item more complicated... i made an automatic way of registring blocks/items and their renders....

 

i could just tweak one line to move over to modelloader but then from what i understand i need it to go through preInit?

can you confirm that that's it? ill try it if yes..

Doing stuff n' things

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.