2013-05-23 21:07:28 -07:00
|
|
|
package magicbees.item;
|
2013-04-11 02:40:25 -07:00
|
|
|
|
2014-04-08 12:39:01 -07:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2022-10-12 21:09:45 +02:00
|
|
|
import java.util.List;
|
2013-05-23 21:07:28 -07:00
|
|
|
import magicbees.item.types.NuggetType;
|
2013-09-17 19:40:26 -07:00
|
|
|
import magicbees.main.CommonProxy;
|
2014-04-08 12:39:01 -07:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2013-04-11 02:40:25 -07:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-04-08 12:39:01 -07:00
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
public class ItemNugget extends Item {
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
private IIcon[] icons;
|
|
|
|
|
|
|
|
|
|
public ItemNugget() {
|
|
|
|
|
super();
|
|
|
|
|
this.setCreativeTab(CreativeTabs.tabMaterials);
|
|
|
|
|
this.setHasSubtypes(true);
|
|
|
|
|
this.setUnlocalizedName("beeNugget");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ItemStack getStackForType(NuggetType type) {
|
|
|
|
|
return new ItemStack(this, 1, type.ordinal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ItemStack getStackForType(NuggetType type, int count) {
|
|
|
|
|
return new ItemStack(this, count, type.ordinal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
|
|
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
|
|
|
|
for (NuggetType type : NuggetType.values()) {
|
|
|
|
|
if (type.isActive()) {
|
|
|
|
|
list.add(new ItemStack(item, 1, type.ordinal()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public void registerIcons(IIconRegister par1IconRegister) {
|
|
|
|
|
this.icons = new IIcon[NuggetType.values().length];
|
|
|
|
|
for (int i = 0; i < NuggetType.values().length; i++) {
|
|
|
|
|
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":nugget"
|
|
|
|
|
+ NuggetType.values()[i].name().substring(0, 1)
|
|
|
|
|
+ NuggetType.values()[i].name().substring(1).toLowerCase());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public IIcon getIconFromDamage(int meta) {
|
|
|
|
|
return icons[meta];
|
|
|
|
|
}
|
2014-08-04 01:28:57 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
@Override
|
|
|
|
|
public String getItemStackDisplayName(ItemStack stack) {
|
|
|
|
|
return NuggetType.values()[stack.getItemDamage()].getName();
|
|
|
|
|
}
|
2013-04-11 02:40:25 -07:00
|
|
|
}
|