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

mod class:

package com.example.test;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
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.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
@Mod(modid = Test.MODID, version = Test.VERSION, name = "Test")

public class Test
{
    public static final String MODID = "test";
    public static final String VERSION = "1.0";
    
    public static Item item = new CItem().setUnlocalizedName("test").setCreativeTab(CreativeTabs.tabBlock);
    
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	GameRegistry.registerItem(item, "test");
    	if(event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("test:test"));                 
    }
}

block class:

package com.example.test;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;

public class CItem extends Item {

}

error log:

[10:08:08] [Client thread/INFO]: Setting user: Player609
[10:08:09] [Client thread/INFO]: LWJGL Version: 2.9.1
[10:08:14] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Test
[10:08:14] [sound Library Loader/INFO]: Starting up SoundSystem...
[10:08:15] [Thread-9/INFO]: Initializing LWJGL OpenAL
[10:08:15] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:08:15] [Thread-9/INFO]: OpenAL initialized.
[10:08:15] [sound Library Loader/INFO]: Sound engine started
[10:08:27] [Client thread/INFO]: Created: 512x512 textures-atlas
[10:08:28] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Test
[10:08:28] [Client thread/INFO]: SoundSystem shutting down...
[10:08:28] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[10:08:28] [sound Library Loader/INFO]: Starting up SoundSystem...
[10:08:28] [Thread-11/INFO]: Initializing LWJGL OpenAL
[10:08:28] [Thread-11/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:08:28] [Thread-11/INFO]: OpenAL initialized.
[10:08:29] [sound Library Loader/INFO]: Sound engine started
[10:08:29] [Client thread/INFO]: Created: 512x512 textures-atlas
[10:08:36] [server thread/INFO]: Starting integrated minecraft server version 1.8
[10:08:36] [server thread/INFO]: Generating keypair
[10:08:36] [server thread/INFO]: Preparing start region for level 0
[10:08:38] [server thread/INFO]: Changing view distance to 12, from 10
[10:08:39] [server thread/INFO]: Player609[local:E:46eb84ee] logged in with entity id 183 at (30.842808827334615, 71.0, 102.94366312468108)
[10:08:39] [server thread/INFO]: Player609 joined the game
[10:08:40] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@4feb7abb[id=1178851a-8246-318e-85f8-1ae4517330a2,name=Player609,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:65) ~[YggdrasilAuthenticationService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:158) [YggdrasilMinecraftSessionService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:53) [YggdrasilMinecraftSessionService$1.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:50) [YggdrasilMinecraftSessionService$1.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:148) [YggdrasilMinecraftSessionService.class:?]
at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [skinManager$3.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_20]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_20]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_20]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_20]
[10:12:14] [server thread/INFO]: Saving and pausing game...
[10:12:14] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[10:12:15] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[10:12:15] [server thread/INFO]: Saving chunks for level 'New World'/The End
[10:18:53] [Client thread/INFO]: Stopping!
[10:18:53] [Client thread/INFO]: SoundSystem shutting down...
[10:18:53] [server thread/INFO]: Stopping server
[10:18:53] [server thread/INFO]: Saving players
[10:18:53] [server thread/INFO]: Saving worlds
[10:18:53] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[10:18:53] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[10:18:53] [server thread/INFO]: Saving chunks for level 'New World'/The End
[10:18:53] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
.
[10:18:47] [sound Library Loader/INFO]: Sound engine started
[10:18:49] [Client thread/INFO]: Created: 512x512 textures-atlas
[10:18:49] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Test
[10:18:49] [Client thread/INFO]: SoundSystem shutting down...
[10:18:50] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[10:18:50] [sound Library Loader/INFO]: Starting up SoundSystem...
[10:18:50] [Thread-10/INFO]: Initializing LWJGL OpenAL
[10:18:50] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:18:50] [Thread-10/INFO]: OpenAL initialized.
[10:18:50] [sound Library Loader/INFO]: Sound engine started
[10:18:51] [Client thread/INFO]: Created: 512x512 textures-atlas
[10:18:58] [Client thread/INFO]: Stopping!
[10:18:58] [Client thread/INFO]: SoundSystem shutting down...
[10:18:58] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

 

I dont see an error related to the item..

What am I doing wrong?

  • Author
    public static Item item;
    
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	item = new CItem().setUnlocalizedName("test").setCreativeTab(CreativeTabs.tabBlock);
    	GameRegistry.registerItem(item, "test");
    	if(event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("test:test"));                 
    }

  • Author

    public static Item item;
    
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	item = new CItem().setUnlocalizedName("test").setCreativeTab(CreativeTabs.tabBlock);
    	GameRegistry.registerItem(item, "test");
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	if(event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("test:test"));                 
    }

 

still not working :/

  • Author

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

 

4kz4fghv.png

    public static Item item;
    
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	item = new CItem().setUnlocalizedName("test").setCreativeTab(CreativeTabs.tabBlock);
    	GameRegistry.registerItem(item, "test");
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	if(event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("test:test"));                 
    }

 

still not working :/

 

Your preInit method has FMLInitializationEvent as its parameter instead of FMLPreInitializationEvent. This means it's still being called during init instead of preInit.

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.

    public static Item item;
    
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	item = new CItem().setUnlocalizedName("test").setCreativeTab(CreativeTabs.tabBlock);
    	GameRegistry.registerItem(item, "test");
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	if(event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("test:test"));                 
    }

 

still not working :/

 

Hi

You need to specify "inventory" in your ModelResourceLocation. This might do it right here:

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

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

Your preInit method has FMLInitializationEvent as its parameter instead of FMLPreInitializationEvent. This means it's still being called during init instead of preInit.

 

Oh wow im so dumb

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.