equivalent-exchange-3/ee3_common/ee3/common/item/ItemAlchemyDust.java

99 lines
2.8 KiB
Java
Raw Normal View History

package ee3.common.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.LanguageRegistry;
import ee3.common.EquivalentExchange3;
import ee3.common.lib.CustomItemRarity;
import ee3.common.lib.Strings;
/**
* ItemAlchemyDust
*
* General class for Alchemy related dusts
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ItemAlchemyDust extends ItemEE {
2012-11-30 21:45:32 +01:00
public static final String[] alchemyDustNames = new String[] { "ash", "minium", "verdant", "azure", "amaranthine", "iridescent" };
public ItemAlchemyDust(int id) {
super(id);
this.setHasSubtypes(true);
this.setIconCoord(10, 0);
this.setItemName(Strings.ALCHEMY_DUST_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
2012-11-30 21:45:32 +01:00
maxStackSize = 64;
}
@SideOnly(Side.CLIENT)
public int getIconFromDamage(int meta) {
2012-11-30 21:45:32 +01:00
int i = MathHelper.clamp_int(meta, 0, 5);
return (this.iconIndex + i);
}
2012-11-30 21:45:32 +01:00
@SideOnly(Side.CLIENT)
2012-11-30 21:45:32 +01:00
public String getItemNameIS(ItemStack stack) {
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 5);
return super.getItemName() + "." + alchemyDustNames[meta];
}
2012-11-30 21:45:32 +01:00
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack) {
2012-11-30 21:45:32 +01:00
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 5);
if (meta == 5) {
return true;
}
else {
return false;
}
}
2012-11-30 21:45:32 +01:00
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack stack) {
2012-11-30 21:45:32 +01:00
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 11);
switch (meta) {
case 0:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.NORMAL);
case 1:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.NORMAL);
case 2:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.UNCOMMON);
case 3:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.MAGICAL);
case 4:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.EPIC);
case 5:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.LEGENDARY);
default:
return EnumRarity.common;
}
}
2012-11-30 21:45:32 +01:00
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs creativeTab, List list) {
for (int meta = 0; meta < 6; ++meta) {
list.add(new ItemStack(id, 1, meta));
}
}
}