Jump to content

[1.7.2]Multi-Item only showing one in creative tab


The_Fireplace

Recommended Posts

My item, which is multiple items in one ID, doesn't show all of the other items in the creative tab. I am updating from 1.6.4. Also, I am able to craft the items in-game, so I know they are registering.

Here is my code:

 

 

package f1repl4ce.unlogic.items;

import java.util.List;

import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;

public class Component extends Item{
public static final String[] itemNames = new String[] {"unlogicGem", "fireCore", "iceCore", "antiGold", "redGem", "blueGem"};
public static final String[] item_a = new String[] {"unlogicGem", "fireCore", "iceCore", "antiGold", "redGem", "blueGem"};
@SideOnly(Side.CLIENT)
private IIcon[] item_b;
public Component(int par1) {
	super();
        this.setHasSubtypes(true);
        this.setMaxDamage(0);
}
int itemcount = 6;
public String getUnlocalizedName(ItemStack par1ItemStack)
{
         int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, itemcount-1);
         return super.getUnlocalizedName() + "." + itemNames[i];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
         for (int j = 0; j < itemcount; ++j)
         {
                 par3List.add(new ItemStack(this, 1, j));
         }
}
@Override
public void registerIcons(IIconRegister par1IconRegister)
{
         this.item_b = new IIcon[item_a.length];
        
         for (int i = 0; i < item_a.length; ++i)
         {
                 this.item_b[i] = par1IconRegister.registerIcon("unlogic:" + item_a[i]);
         }
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int damage) {
        switch(damage) {
        
        default: return item_b[damage];
        }
}
}

 

 

Let me know if anything is missing and I will add it to the post.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
         for (int j = 0; j < itemcount; ++j)
         {
                 par3List.add(new ItemStack(this, 1, j));
         }
}

Let me know if anything is missing and I will add it to the post.

<cough> @Override <cough>

Link to comment
Share on other sites

Ok, used coolAlias's suggestion, now it is giving me the error: "The method getSubItems(int, CreativeTabs, List) of type Component must override or implement a supertype method"

UPDATE: The fix was to change par1 from and int to an Item.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.