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

EDIT: The tutorial I linked from the wiki was missing a *very* important bit of code!

GameRegistry.registerItem(genericItem,"Generic Item");

After adding this for each item, they both show up now. Now I just have to figure out why LanguageRegistry.addName isn't setting the in-game item name properly. :P

/EDIT

 

DISCLAIMER - I am new to Minecraft mod creation, please don't hate me for it. I promise I have coded before(although not in Java), and I am very good at taking a little bit of information a long way. :P

 

I'm attempting to go off of the tutorial at http://www.minecraftforge.net/wiki/Basic_Items to create an item that I can select in Creative Mode. No grand schemes at the moment, I just want to put an item into the game. My code will compile and run, but the item doesn't show up.

 

I feel like maybe the reason this isn't working is because item IDs have gone out the window - but I haven't yet figured out how to bridge the gap from the old tutorial code to working 1.7.2 code.

 

Is there anyone who would be so kind as to post the basic 1.7.2 code/information needed to create an item?

 

EDIT: Using Forge 10.12.0.997

 

The tutorial code in the Generic Class (parts relating to items):

public class Generic 
{
    private static Item genericItem;
    private static Item genericIngot;
@EventHandler
        public void preInit(FMLPreInitializationEvent event) {
                genericItem = new GenericItem(5000);
                genericIngot = new GenericItem(5001)
                .setMaxStackSize(16).setUnlocalizedName("genericIngot");
        }
       
        @EventHandler
        public void load(FMLInitializationEvent event) {
                LanguageRegistry.addName(genericItem, "Generic Item");
                LanguageRegistry.addName(genericIngot, "Generic Ingot");
        }

But for 1.7.2 itemId isn't a property of items, so I would think simply changing to THIS would work:

@EventHandler
    public void preInit(FMLPreInitializationEvent event) 
    {
     genericItem = new GenericItem();
     
     genericIngot = new GenericItem().setMaxStackSize(16).setUnlocalizedName("genericIngot");
     
    }

But it doesn't seem to.

  • 4 weeks later...

You must put the code into preinit, not into init

www.youtube.com/HyCraftHD

www.google.com/+HyCraftHDdeMC

www.hycrafthd.de

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.