ohh yeah figured it out
@Override
public ActionResultType onItemUse(ItemUseContext context) {
World world = context.getWorld();
BlockPos pos = context.getPos();
PlayerEntity playerIn = context.getPlayer();
ItemStack item = context.getItem();
Hand handIn = context.getHand();
if (!world.isRemote && world.getBlockState(pos).getBlock() == Blocks.MOSSY_COBBLESTONE)
{
(( ServerWorld)world).setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
item.damageItem(1, playerIn, (entity) -> {entity.sendBreakAnimation(handIn);;});
playerIn.inventory.addItemStackToInventory(new ItemStack(ItemInit.moss));
}
return super.onItemUse(context);
}