package net.minecraft.item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.item.EntityFireworkRocket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class ItemFirework extends Item
{
private static final String __OBFID = "CL_00000031";
/**
* Description : Callback for item usage. If the item does something special on right clicking, he will have one of
* those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS. Args : stack,
* player, world, x, y, z, side, hitX, hitY, hitZ
*/
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (!p_77648_3_.isRemote)
{
EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(p_77648_3_, (double)((float)p_77648_4_ + p_77648_8_), (double)((float)p_77648_5_ + p_77648_9_), (double)((float)p_77648_6_ + p_77648_10_), p_77648_1_);
p_77648_3_.spawnEntityInWorld(entityfireworkrocket);
if (!p_77648_2_.capabilities.isCreativeMode)
{
--p_77648_1_.stackSize;
}
return true;
}
else
{
return false;
}
}
/**
* allows items to add custom lines of information to the mouseover description
*/
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_)
{
if (p_77624_1_.hasTagCompound())
{
NBTTagCompound nbttagcompound = p_77624_1_.getTagCompound().getCompoundTag("Fireworks");
if (nbttagcompound != null)
{
if (nbttagcompound.hasKey("Flight", 99))
{
p_77624_3_.add(StatCollector.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight"));
}
NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);
if (nbttaglist != null && nbttaglist.tagCount() > 0)
{
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
ArrayList arraylist = new ArrayList();
ItemFireworkCharge.func_150902_a(nbttagcompound1, arraylist);
if (arraylist.size() > 0)
{
for (int j = 1; j < arraylist.size(); ++j)
{
arraylist.set(j, " " + (String)arraylist.get(j));
}
p_77624_3_.addAll(arraylist);
}
}
}
}
}
}
}