In on item use the par2 par3 and par4 are x y and z of the block clicked par in the world so you can do.
If(par1world.getBlockID(par2,par3,par4)==Block.bedrock){
par1world.setblock(par2,par3,par4,0);
Then all you have to do is spawn a item in the worlxld.