2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.item;
|
2012-11-04 19:14:51 +01:00
|
|
|
|
2012-11-06 21:49:43 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2012-12-17 21:21:53 +01:00
|
|
|
import com.pahimar.ee3.EquivalentExchange3;
|
|
|
|
import com.pahimar.ee3.lib.CustomItemRarity;
|
|
|
|
import com.pahimar.ee3.lib.Strings;
|
|
|
|
|
2012-12-13 16:01:41 +01:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.EnumRarity;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.MathHelper;
|
2012-11-06 21:49:43 +01:00
|
|
|
import cpw.mods.fml.common.Side;
|
|
|
|
import cpw.mods.fml.common.asm.SideOnly;
|
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
|
|
|
2012-11-04 19:14:51 +01:00
|
|
|
/**
|
|
|
|
* 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);
|
2012-12-01 04:45:54 +01:00
|
|
|
this.setIconCoord(10, 0);
|
2012-11-06 21:49:43 +01:00
|
|
|
this.setItemName(Strings.ALCHEMY_DUST_NAME);
|
|
|
|
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
2012-11-30 21:45:32 +01:00
|
|
|
maxStackSize = 64;
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2012-11-06 21:49:43 +01:00
|
|
|
public int getIconFromDamage(int meta) {
|
2012-11-30 21:45:32 +01:00
|
|
|
|
2012-12-01 04:45:54 +01:00
|
|
|
int i = MathHelper.clamp_int(meta, 0, 5);
|
2012-11-06 21:49:43 +01:00
|
|
|
return (this.iconIndex + i);
|
|
|
|
}
|
2012-11-30 21:45:32 +01:00
|
|
|
|
2012-12-01 04:45:54 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2012-11-30 21:45:32 +01:00
|
|
|
public String getItemNameIS(ItemStack stack) {
|
|
|
|
|
2012-11-20 01:49:39 +01:00
|
|
|
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 5);
|
|
|
|
return super.getItemName() + "." + alchemyDustNames[meta];
|
2012-11-06 21:49:43 +01:00
|
|
|
}
|
2012-11-30 21:45:32 +01:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2012-11-06 21:49:43 +01:00
|
|
|
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-06 21:49:43 +01:00
|
|
|
}
|
2012-11-30 21:45:32 +01:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2012-11-06 21:49:43 +01:00
|
|
|
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-06 21:49:43 +01:00
|
|
|
}
|
2012-11-30 21:45:32 +01:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void getSubItems(int id, CreativeTabs creativeTab, List list) {
|
|
|
|
|
2012-11-20 01:49:39 +01:00
|
|
|
for (int meta = 0; meta < 6; ++meta) {
|
2012-11-06 21:49:43 +01:00
|
|
|
list.add(new ItemStack(id, 1, meta));
|
|
|
|
}
|
|
|
|
}
|
2012-11-04 19:14:51 +01:00
|
|
|
|
|
|
|
}
|