001 package net.minecraft.src; 002 003 public class ItemRedstone extends Item 004 { 005 public ItemRedstone(int par1) 006 { 007 super(par1); 008 this.setCreativeTab(CreativeTabs.tabRedstone); 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.getBlockId(par4, par5, par6) != Block.snow.blockID) 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 (!par3World.isAirBlock(par4, par5, par6)) 050 { 051 return false; 052 } 053 } 054 055 if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) 056 { 057 return false; 058 } 059 else 060 { 061 if (Block.redstoneWire.canPlaceBlockAt(par3World, par4, par5, par6)) 062 { 063 --par1ItemStack.stackSize; 064 par3World.setBlockWithNotify(par4, par5, par6, Block.redstoneWire.blockID); 065 } 066 067 return true; 068 } 069 } 070 }