Fix sus stew item frame duplication bug

This commit is contained in:
Eliy21 2024-01-21 08:43:02 +00:00
parent 473c85c543
commit c0a5c63601

View file

@ -79,6 +79,21 @@ local function eat_stew(itemstack, user, pointed_thing)
end end
local function eat_stew_delayed(itemstack, user, pointed_thing) local function eat_stew_delayed(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
if user and not user:get_player_control().sneak then
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node(pointed_thing.under)
if user and not user:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
end
end
end
elseif pointed_thing.type == "object" then
return itemstack
end
-- Wrapper for handling mcl_hunger delayed eating -- Wrapper for handling mcl_hunger delayed eating
local name = user:get_player_name() local name = user:get_player_name()
mcl_hunger.eat_internal[name]._custom_itemstack = itemstack -- Used as comparison to make sure the custom wrapper executes only when the same item is eaten mcl_hunger.eat_internal[name]._custom_itemstack = itemstack -- Used as comparison to make sure the custom wrapper executes only when the same item is eaten