    001    package net.minecraft.src;
    002
    003    public class ItemFireball extends Item
    004    {
    005        public ItemFireball(int par1)
    006        {
    007            super(par1);
    008            this.setCreativeTab(CreativeTabs.tabMisc);
    009        }
    010
    011        /**
    012         * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
    013         * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
    014         */
    015        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    016        {
    017            if (par3World.isRemote)
    018            {
    019                return true;
    020            }
    021            else
    022            {
    023                if (par7 == 0)
    024                {
    025                    --par5;
    026                }
    027
    028                if (par7 == 1)
    029                {
    030                    ++par5;
    031                }
    032
    033                if (par7 == 2)
    034                {
    035                    --par6;
    036                }
    037
    038                if (par7 == 3)
    039                {
    040                    ++par6;
    041                }
    042
    043                if (par7 == 4)
    044                {
    045                    --par4;
    046                }
    047
    048                if (par7 == 5)
    049                {
    050                    ++par4;
    051                }
    052
    053                if (!par2EntityPlayer.func_82247_a(par4, par5, par6, par7, par1ItemStack))
    054                {
    055                    return false;
    056                }
    057                else
    058                {
    059                    int var11 = par3World.getBlockId(par4, par5, par6);
    060
    061                    if (var11 == 0)
    062                    {
    063                        par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
    064                        par3World.setBlockWithNotify(par4, par5, par6, Block.fire.blockID);
    065                    }
    066
    067                    if (!par2EntityPlayer.capabilities.isCreativeMode)
    068                    {
    069                        --par1ItemStack.stackSize;
    070                    }
    071
    072                    return true;
    073                }
    074            }
    075        }
    076    }