package micdoodle8.mods.galacticraft.core.items;
import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem;
import micdoodle8.mods.galacticraft.core.util.GCCoreUtil;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemOilCanister extends ItemCanisterGeneric implements ISortableItem
{
// protected IIcon[] icons = new IIcon[7];
public ItemOilCanister(String assetName)
{
super(assetName);
this.setAllowedFluid(ConfigManagerCore.useOldOilFluidID ? "oilgc" : "oil");
this.setContainerItem(this);
//this.setTextureName(Constants.TEXTURE_PREFIX + assetName);
}
/*@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
for (int i = 0; i < this.icons.length; i++)
{
this.icons[i] = iconRegister.registerIcon(this.getIconString() + "_" + i);
}
}*/
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
if (itemStack.getMaxDamage() - itemStack.getItemDamage() == 0)
{
return "item.empty_liquid_canister";
}
if (itemStack.getItemDamage() == 1)
{
return "item.oil_canister";
}
return "item.oil_canister_partial";
}
/*@Override
public IIcon getIconFromDamage(int par1)
{
final int damage = 6 * par1 / this.getMaxDamage();
if (this.icons.length > damage)
{
return this.icons[this.icons.length - damage - 1];
}
return super.getIconFromDamage(damage);
}*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> tooltip, boolean par4)
{
if (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage() > 0)
{
tooltip.add(GCCoreUtil.translate("gui.message.oil.name") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()));
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, this.getMaxDamage()));
par3List.add(new ItemStack(par1, 1, 1));
}
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
{
if (ItemCanisterGeneric.EMPTY == par1ItemStack.getItemDamage())
{
par1ItemStack.setTagCompound(null);
}
else if (par1ItemStack.getItemDamage() <= 0)
{
par1ItemStack.setItemDamage(1);
}
}
@Override
public EnumSortCategoryItem getCategory(int meta)
{
return EnumSortCategoryItem.CANISTER;
}
}