Jump to content

Recommended Posts

Posted

I am trying to code my first mod and everything is working but i can't get the game to register my item.

Here is the code plz Help.

package AlphaPlayz.Lava.init;

import AlphaPlayz.Lava.Reference;
import AlphaPlayz.Lava.items.ItemCheese;

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

public class ModItems {

    public static Item cheese;
    
    public static void init(){
        cheese = new ItemCheese(); 
    }
    
    public static void register() {
        ForgeRegistry.ITEMS.register(cheese);
    }
        
    public static void registerRenders(){
            registerRender(cheese);
        }
        
    private static void registerRender(Item item){
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
        }
    }

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.