Fix crash when using chorus fruit on cake

This commit is contained in:
Wuzzy 2019-02-05 22:05:56 +01:00
parent 9ed83bd196
commit 0876e76b40
2 changed files with 6 additions and 1 deletions

View File

@ -333,7 +333,7 @@ local eat_chorus_fruit = function(itemstack, player, pointed_thing)
local node_under = minetest.get_node(pointed_thing.under)
-- Use pointed node's on_rightclick function first, if present
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
return minetest.registered_nodes[node_under.name].on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack
return minetest.registered_nodes[node_under.name].on_rightclick(pointed_thing.under, node_under, player, itemstack) or itemstack
end
end
local count = itemstack:get_count()

View File

@ -1,6 +1,11 @@
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
local org_eat = minetest.do_item_eat
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if not user or user:is_player() == false then
return itemstack
end
-- Call on_rightclick if the pointed node defines it
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)