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

I am interested in making some sort of meta items, like the 16 dyes.

But I cant seem to register / get meta data properly.

Can someone introduce a way to properly register meta items?

Basically, you need this in your item class:

 

Note: this is for my mod and one of the meta's outright doesn't exist and several only exist if IC2 is loaded.  Or would, if IC2 didn't handle them.  I've got them in here as I have several items that all use the same metadata numbers (itemA:3 is the same material as itemB:3 and itemC:3, even if itemB:3 is illogical and not used).

 

    @SideOnly(Side.CLIENT)
    public void getSubItems(Item item, CreativeTabs tab, List list) {
        list.add(new ItemStack(item, 1, 0));
        list.add(new ItemStack(item, 1, 1));
        //list.add(new ItemStack(item, 1, 2));
        list.add(new ItemStack(item, 1, 3));
        list.add(new ItemStack(item, 1, 4));
        /*if(Loader.isModLoaded("IC2")){
            list.add(new ItemStack(item, 1, 6));
            list.add(new ItemStack(item, 1, 7));
            list.add(new ItemStack(item, 1, );
            list.add(new ItemStack(item, 1, 9));
    	}*/
    }

 

Then you need the names, so you can localize them:

 

    public String getUnlocalizedName(ItemStack stack) {
    	switch(stack.getItemDamage()) {
    	case 0:
    		return "item.small_iron_dust";
    	case 1:
    		return "item.small_gold_dust";
    	case 2:
    		return "item.small_diamond_dust";//non-existent.  placeholder to match metadata across several items
    	case 3:
    		return "item.small_flour_dust";
    	case 4:
    		return "item.small_sugar_dust";
    	case 5:
    		return "item.small_limonite_dust";//non-existent.  placeholder to match metadata across several items
    	case 6:
    		return "item.small_tin_dust";//implemented by IC2, placeholder
    	case 7:
    		return "item.small_copper_dust";//implemented by IC2, placeholder
    	case 8:
    		return "item.small_lead_dust";//implemented by IC2, placeholder
    	case 9:
    		return "item.small_uranium_dust";//implemented by IC2, placeholder
    	}
        return "item.small_dust"; //Just in case, return something
    }

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.

  • Author

Thx for the help.

BTW, is it possible to get meta within an item?

EG, if meta is 1, shoot an arrow,

if meta is 2, shoot a flying TNT

You can get it from the ItemStack, yes.

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.

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.