forked from VoxeLibre/VoxeLibre
Allow to place hoes into itemframes
This commit is contained in:
parent
4d869497fa
commit
681a9aa8c6
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue