This commit is contained in:
Elias Fleckenstein 2021-01-26 17:42:45 +01:00
parent 953a2f2cd1
commit e9f9d96eb1
1 changed files with 11 additions and 0 deletions

View File

@ -147,6 +147,17 @@ minetest.register_craftitem("mcl_core:apple", {
local gapple_hunger_restore = minetest.item_eat(4)
local function eat_gapple(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
if placer and not placer: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, placer, itemstack) or itemstack
end
end
elseif pointed_thing.type == "object" then
return itemstack
end
local regen_duration, absorbtion_factor = 5, 1
if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then
regen_duration, absorbtion_factor = 20, 4