From 32f7051eb85bfe54ac21475be6366db7aff8743d Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 4 Oct 2016 19:18:45 +0200 Subject: [PATCH] Fix sapling placement handling of on_rightclick and CONTENT_IGNORE --- mods/default/trees.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 5cd7e156..0b95742c 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -435,12 +435,17 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, sapling_name, minp_relative, maxp_relative, interval) -- Position of sapling local pos = pointed_thing.under - local node = minetest.get_node(pos) - local pdef = minetest.registered_nodes[node.name] + local node = minetest.get_node_or_nil(pos) + local pdef = node and minetest.registered_nodes[node.name] + + if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then + return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) + end + if not pdef or not pdef.buildable_to then pos = pointed_thing.above - node = minetest.get_node(pos) - pdef = minetest.registered_nodes[node.name] + node = minetest.get_node_or_nil(pos) + pdef = node and minetest.registered_nodes[node.name] if not pdef or not pdef.buildable_to then return itemstack end