Posted January 25, 201510 yr 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?
January 25, 201510 yr 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.
January 25, 201510 yr 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
January 25, 201510 yr 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.