Fix crash when placing cocoa beans in item frame

This commit is contained in:
Wuzzy 2017-03-02 15:50:53 +01:00
parent b68224a38d
commit 064bf1effe
2 changed files with 6 additions and 6 deletions

View file

@ -17,11 +17,11 @@ function mcl_cocoas.place(itemstack, placer, pointed_thing, plantname)
return
end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack)
-- Am I right-clicking on something that has a custom on_rightclick set?
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[under.name] and minetest.registered_nodes[under.name].on_rightclick then
return minetest.registered_nodes[under.name].on_rightclick(pointed_thing.under, under, placer, itemstack) or itemstack
end
end
-- Check if pointing at jungle tree

View file

@ -229,7 +229,7 @@ minetest.register_craftitem("mcl_dye:brown", {
description = "Cocoa Beans",
stack_max = 64,
groups = dyelocal.dyes[4][3],
on_place = function(itemstack, user, pointed_thing)
on_place = function(itemstack, placer, pointed_thing)
return mcl_cocoas.place(itemstack, placer, pointed_thing, "mcl_cocoas:cocoa_1")
end,
})