diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index c176e022..40201afa 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -25,6 +25,14 @@ minetest.register_tool("mcl_farming:hoe_wood", { description = "Wood Hoe", inventory_image = "farming_tool_woodhoe.png", on_place = function(itemstack, user, pointed_thing) + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.setting_getbool("creative_mode") then itemstack:add_wear(65535/60) @@ -65,6 +73,14 @@ minetest.register_tool("mcl_farming:hoe_stone", { description = "Stone Hoe", inventory_image = "farming_tool_stonehoe.png", on_place = function(itemstack, user, pointed_thing) + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.setting_getbool("creative_mode") then itemstack:add_wear(65535/132) @@ -100,6 +116,14 @@ minetest.register_tool("mcl_farming:hoe_iron", { description = "Iron Hoe", inventory_image = "farming_tool_steelhoe.png", on_place = function(itemstack, user, pointed_thing) + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.setting_getbool("creative_mode") then itemstack:add_wear(65535/251) @@ -143,6 +167,14 @@ minetest.register_tool("mcl_farming:hoe_gold", { description = "Golden Hoe", inventory_image = "farming_tool_goldhoe.png", on_place = function(itemstack, user, pointed_thing) + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.setting_getbool("creative_mode") then itemstack:add_wear(65535/33) @@ -187,6 +219,14 @@ minetest.register_tool("mcl_farming:hoe_diamond", { description = "Diamond Hoe", inventory_image = "farming_tool_diamondhoe.png", on_place = function(itemstack, user, pointed_thing) + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if user and not user:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack + end + end + if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.setting_getbool("creative_mode") then itemstack:add_wear(65535/1562)