local modname = core.get_current_modname()
local S = core.get_translator(core.get_current_modname())
local scale = mcl_ruby_stuff.scale

-- future-proof for mcl_farming to expose this later (which would be common-sense)
local hoe_common_defs = mcl_farming.hoe_common_defs
if not hoe_common_defs then
	local hoe_tt = S("Turns block into farmland")
	local hoe_longdesc = S("Hoes are essential tools for growing crops. They are used to create farmland in order to plant seeds on it. Hoes can also be used as very weak weapons in a pinch.")
	local hoe_usagehelp = S("Use the hoe on a cultivatable block (by rightclicking it) to turn it into farmland. Dirt, grass blocks and grass paths are cultivatable blocks. Using a hoe on coarse dirt turns it into dirt.")

	local hoe_common_defs = {
		longdesc = hoe_longdesc,
		usagehelp = hoe_usagehelp,
		groups = { hoe = 1, tool = 1 },
		diggroups = { hoey = {} },
		craft_shapes = {
			{
				{ "material", "material" },
				{ "mcl_core:stick", "" },
				{ "mcl_core:stick", "" }
			},
			{
				{ "material", "material" },
				{ "", "mcl_core:stick" },
				{ "", "mcl_core:stick" }
			}
		},
		_placement_def = {
			["mcl_lush_caves:rooted_dirt"] = "default",
			["mcl_core:dirt_with_grass"] = "default",
			["mcl_core:grass_path"] = "default",
			["mcl_core:dirt"] = "default",
			["mcl_core:coarse_dirt"] = "default",
			inherit = "placeable_on_actionable",
		},
	}
end

mcl_tools.register_set("ruby", {
	craftable = true,
	material = modname .. ":ruby",
	uses = 1796 * scale, -- right between diamond and netherite
	level = 5,
	speed = 8.5,
	max_drop_level = 5,
	groups = { dig_speed_class = 5, enchantability = 10 }
}, {
	["pick"] = {
		description = S("Ruby Pickaxe"),
		inventory_image = "mcl_ruby_stuff_pick.png",
		tool_capabilities = {
			full_punch_interval = 0.83333333,
			damage_groups = { fleshy = 6 }
		},
		_mcl_upgradable = true,
		_mcl_upgrade_item = "mcl_tools:pick_netherite"
	},
	["shovel"] = {
		description = S("Ruby Shovel"),
		inventory_image = "mcl_ruby_stuff_shovel.png",
		tool_capabilities = {
			full_punch_interval = 1,
			damage_groups = { fleshy = 6 }
		},
		_mcl_upgradable = true,
		_mcl_upgrade_item = "mcl_tools:shovel_netherite"
	},
	["sword"] = {
		description = S("Ruby Sword"),
		inventory_image = "mcl_ruby_stuff_sword.png",
		tool_capabilities = {
			full_punch_interval = 0.625,
			damage_groups = { fleshy = 8 }
		},
		_mcl_upgradable = true,
		_mcl_upgrade_item = "mcl_tools:sword_netherite"
	},
	["axe"] = {
		description = S("Ruby Axe"),
		inventory_image = "mcl_ruby_stuff_axe.png",
		tool_capabilities = {
			full_punch_interval = 1,
			damage_groups = { fleshy = 10 }
		},
		_mcl_upgradable = true,
		_mcl_upgrade_item = "mcl_tools:axe_netherite"
	},
	["hoe"] = {
		description = S("Ruby Hoe"),
		inventory_image = "mcl_ruby_stuff_hoe.png",
		tool_capabilities = {
			full_punch_interval = 0.25,
			damage_groups = { fleshy = 1 },
		},
		_mcl_upgradable = true,
		_mcl_upgrade_item = "mcl_farming:hoe_netherite",
	},
})

core.register_alias("mcl_ruby_stuff:pick", "mcl_ruby_stuff:pick_ruby")
core.register_alias("mcl_ruby_stuff:shovel", "mcl_ruby_stuff:shovel_ruby")
core.register_alias("mcl_ruby_stuff:sword", "mcl_ruby_stuff:sword_ruby")
core.register_alias("mcl_ruby_stuff:axe", "mcl_ruby_stuff:axe_ruby")
core.register_alias("mcl_ruby_stuff:ruby_hoe", "mcl_ruby_stuff:hoe_ruby")
