    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class ItemLilyPad extends ItemColored
    007    {
    008        public ItemLilyPad(int par1)
    009        {
    010            super(par1, false);
    011        }
    012
    013        /**
    014         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    015         */
    016        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    017        {
    018            MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
    019
    020            if (var4 == null)
    021            {
    022                return par1ItemStack;
    023            }
    024            else
    025            {
    026                if (var4.typeOfHit == EnumMovingObjectType.TILE)
    027                {
    028                    int var5 = var4.blockX;
    029                    int var6 = var4.blockY;
    030                    int var7 = var4.blockZ;
    031
    032                    if (!par2World.canMineBlock(par3EntityPlayer, var5, var6, var7))
    033                    {
    034                        return par1ItemStack;
    035                    }
    036
    037                    if (!par3EntityPlayer.func_82247_a(var5, var6, var7, var4.sideHit, par1ItemStack))
    038                    {
    039                        return par1ItemStack;
    040                    }
    041
    042                    if (par2World.getBlockMaterial(var5, var6, var7) == Material.water && par2World.getBlockMetadata(var5, var6, var7) == 0 && par2World.isAirBlock(var5, var6 + 1, var7))
    043                    {
    044                        par2World.setBlockWithNotify(var5, var6 + 1, var7, Block.waterlily.blockID);
    045
    046                        if (!par3EntityPlayer.capabilities.isCreativeMode)
    047                        {
    048                            --par1ItemStack.stackSize;
    049                        }
    050                    }
    051                }
    052
    053                return par1ItemStack;
    054            }
    055        }
    056
    057        @SideOnly(Side.CLIENT)
    058        public int func_82790_a(ItemStack par1ItemStack, int par2)
    059        {
    060            return Block.waterlily.getRenderColor(par1ItemStack.getItemDamage());
    061        }
    062    }