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

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

@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>

  • Author

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

Guest
This topic is now closed to further replies.

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.