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