From 5099d7c552028c00d5131a9c41f09103cec5b2b3 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Sat, 28 Jan 2017 07:51:55 +0100 Subject: [PATCH] fix "Item frames won't accept green beans, bean poles, grapes, trellis, or cocoa beans." , issue https://github.com/MinetestForFun/server-minetestforfun-skyblock/issues/205 --- mods/farming/beanpole.lua | 20 +++++++++++++------- mods/farming/cocoa.lua | 4 +++- mods/farming/grapes.lua | 21 +++++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/mods/farming/beanpole.lua b/mods/farming/beanpole.lua index e37755c..c46006c 100644 --- a/mods/farming/beanpole.lua +++ b/mods/farming/beanpole.lua @@ -28,6 +28,8 @@ minetest.register_craftitem("farming:beans", { minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"}) minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0}) + elseif minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then + return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing) else return end @@ -77,23 +79,27 @@ minetest.register_node("farming:beanpole", { sounds = default.node_sound_leaves_defaults(), on_place = function(itemstack, placer, pointed_thing) + local top = { + x = pointed_thing.above.x, + y = pointed_thing.above.y + 1, + z = pointed_thing.above.z + } - if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + if minetest.is_protected(pointed_thing.above, placer:get_player_name()) + or minetest.is_protected(top, placer:get_player_name()) then -- MFF crabman(18/06/2015) return end local nodename = minetest.get_node(pointed_thing.under).name + if minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then + return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing) + end + if minetest.get_item_group(nodename, "soil") < 2 then return end - local top = { - x = pointed_thing.above.x, - y = pointed_thing.above.y + 1, - z = pointed_thing.above.z - } - nodename = minetest.get_node(top).name if nodename ~= "air" then diff --git a/mods/farming/cocoa.lua b/mods/farming/cocoa.lua index 519847f..49fbdcf 100644 --- a/mods/farming/cocoa.lua +++ b/mods/farming/cocoa.lua @@ -17,7 +17,9 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname) if not minetest.registered_nodes[under.name] then return end - + if minetest.registered_nodes[under.name].on_rightclick and not placer:get_player_control().sneak then + return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack, pointed_thing) + end -- check if pointing at jungletree if under.name ~= "default:jungletree" or minetest.get_node(pt.above).name ~= "air" then diff --git a/mods/farming/grapes.lua b/mods/farming/grapes.lua index fac76cd..e9d0b60 100644 --- a/mods/farming/grapes.lua +++ b/mods/farming/grapes.lua @@ -23,6 +23,8 @@ minetest.register_craftitem("farming:grapes", { minetest.set_node(pointed_thing.under, {name = "farming:grapes_1"}) minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0}) + elseif minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then + return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing) else return end @@ -72,23 +74,26 @@ minetest.register_node("farming:trellis", { sounds = default.node_sound_leaves_defaults(), on_place = function(itemstack, placer, pointed_thing) - - if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + local top = { + x = pointed_thing.above.x, + y = pointed_thing.above.y + 1, + z = pointed_thing.above.z + } + if minetest.is_protected(pointed_thing.above, placer:get_player_name()) + or minetest.is_protected(top, placer:get_player_name()) then -- MFF crabman(18/06/2015) return end local nodename = minetest.get_node(pointed_thing.under).name + if minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then + return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing) + end + if minetest.get_item_group(nodename, "soil") < 2 then return end - local top = { - x = pointed_thing.above.x, - y = pointed_thing.above.y + 1, - z = pointed_thing.above.z - } - nodename = minetest.get_node(top).name if nodename ~= "air" then