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