IF you want to create the item, you'll need to make an item class like normal and then override the onItemUse method in Item and use the following code in the overridden method.
You will need to change Block.cocoaPlant.blockID to the ID of your grape block and Block.wood.blockID to the ID of the block you want to plant the grape on.
int i1 = par3World.getBlockId(par4, par5, par6);
int j1 = par3World.getBlockMetadata(par4, par5, par6);
if (i1 == Block.wood.blockID && BlockLog.limitToValidMetadata(j1) == 3)
{
if (par7 == 0)
{
return false;
}
if (par7 == 1)
{
return false;
}
if (par7 == 2)
{
--par6;
}
if (par7 == 3)
{
++par6;
}
if (par7 == 4)
{
--par4;
}
if (par7 == 5)
{
++par4;
}
if (par3World.isAirBlock(par4, par5, par6))
{
int k1 = Block.blocksList[block.cocoaPlant.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, 0);
par3World.setBlock(par4, par5, par6, Block.cocoaPlant.blockID, k1, 2);
if (!par2EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
}
return true;
}