minetest.register_tool("sparkdebug:debugwrench", {
  description = "Debug Wrench",
  inventory_image = "debugwrench.png",
  stack_max = 1,
  range = 50.0,
  on_place = function(itemstack, placer, pointed_thing)
    if pointed_thing["type"] == "node" then
      local node = minetest.get_node(pointed_thing["under"])
      if minetest.get_item_group(node["name"], "sparktech_techy") > 0 then
        local nodemeta = minetest.get_meta(pointed_thing["under"])
        local item = ItemStack(node["name"])
        if minetest.get_item_group(item:get_name(), "sparktech_energy_storeonbreak") > 0 then
          item:set_metadata(nodemeta:get_int("energy"))
        end
        minetest.dig_node(pointed_thing["under"])	--removed inventory code, this is debug wrench anyway
      end
    end
    return itemstack
  end
})
