2015-03-07 12:51:28 +01:00
|
|
|
package ellpeck.actuallyadditions.items;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-03-07 12:51:28 +01:00
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheDusts;
|
2015-04-06 15:51:59 +02:00
|
|
|
import ellpeck.actuallyadditions.util.INameableItem;
|
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
2015-03-07 02:23:31 +01:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.EnumRarity;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2015-04-04 05:20:19 +02:00
|
|
|
public class ItemDust extends Item implements INameableItem{
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
|
|
public static final TheDusts[] allDusts = TheDusts.values();
|
|
|
|
|
|
|
|
public ItemDust(){
|
|
|
|
this.setHasSubtypes(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName(){
|
|
|
|
return "itemDust";
|
|
|
|
}
|
|
|
|
|
2015-04-04 05:20:19 +02:00
|
|
|
@Override
|
|
|
|
public String getOredictName(){
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
@Override
|
|
|
|
public int getMetadata(int damage){
|
|
|
|
return damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public EnumRarity getRarity(ItemStack stack){
|
2015-06-12 19:12:06 +02:00
|
|
|
return stack.getItemDamage() >= allDusts.length ? EnumRarity.common : allDusts[stack.getItemDamage()].rarity;
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("all")
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void getSubItems(Item item, CreativeTabs tab, List list){
|
|
|
|
for(int j = 0; j < allDusts.length; j++){
|
|
|
|
list.add(new ItemStack(this, 1, j));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUnlocalizedName(ItemStack stack){
|
2015-06-12 19:12:06 +02:00
|
|
|
return this.getUnlocalizedName() + (stack.getItemDamage() >= allDusts.length ? " ERROR!" : allDusts[stack.getItemDamage()].getName());
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IIcon getIcon(ItemStack stack, int pass){
|
|
|
|
return this.itemIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int getColorFromItemStack(ItemStack stack, int pass){
|
2015-06-12 19:12:06 +02:00
|
|
|
return stack.getItemDamage() >= allDusts.length ? 0 : allDusts[stack.getItemDamage()].color;
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerIcons(IIconRegister iconReg){
|
2015-03-29 15:29:05 +02:00
|
|
|
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
}
|