001package net.minecraft.item;
002
003import net.minecraft.block.Block;
004import net.minecraft.entity.player.EntityPlayer;
005import net.minecraft.world.World;
006
007public class ItemSnow extends ItemBlockWithMetadata
008{
009    public ItemSnow(int par1, Block par2Block)
010    {
011        super(par1, par2Block);
012    }
013
014    /**
015     * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
016     * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
017     */
018    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
019    {
020        if (par1ItemStack.stackSize == 0)
021        {
022            return false;
023        }
024        else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
025        {
026            return false;
027        }
028        else
029        {
030            int i1 = par3World.getBlockId(par4, par5, par6);
031
032            if (i1 == Block.snow.blockID)
033            {
034                Block block = Block.blocksList[this.getBlockID()];
035                int j1 = par3World.getBlockMetadata(par4, par5, par6);
036                int k1 = j1 & 7;
037
038                if (k1 <= 6 && par3World.checkNoEntityCollision(block.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlockMetadataWithNotify(par4, par5, par6, k1 + 1 | j1 & -8, 2))
039                {
040                    par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
041                    --par1ItemStack.stackSize;
042                    return true;
043                }
044            }
045
046            return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
047        }
048    }
049}