From 0876e76b40100dc67f536e2090f1dcf131868d38 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 5 Feb 2019 22:05:56 +0100 Subject: [PATCH] Fix crash when using chorus fruit on cake --- mods/ITEMS/mcl_end/chorus_plant.lua | 2 +- mods/PLAYER/mcl_hunger/hunger.lua | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index 9793862e4..41a91a479 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -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() diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index 461c5f675..fc200f001 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -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)