diff --git a/mods/ITEMS/mcl_core/craftitems.lua b/mods/ITEMS/mcl_core/craftitems.lua index 122445095f..b27a6ca6a3 100644 --- a/mods/ITEMS/mcl_core/craftitems.lua +++ b/mods/ITEMS/mcl_core/craftitems.lua @@ -144,17 +144,41 @@ minetest.register_craftitem("mcl_core:apple", { _mcl_saturation = 2.4, }) --- TODO: Status effects +local gapple_hunger_restore = minetest.item_eat(4) + +local function eat_gapple(itemstack, placer, pointed_thing) + local regen_duration, absorbtion_factor = 5, 1 + if itemstack:get_name() == "mcl_core:apple_gold_enchanted" then + regen_duration, absorbtion_factor = 20, 4 + mcl_potions.fire_resistance_func(placer, 1, 300) + mcl_potions.leaping_func(placer, 1, 300) + end + mcl_potions.swiftness_func(placer, absorbtion_factor, 120) -- TODO: Absorbtion + mcl_potions.regeneration_func(placer, 2, regen_duration) + return gapple_hunger_restore(itemstack, placer, pointed_thing) +end + minetest.register_craftitem("mcl_core:apple_gold", { - -- TODO: Add special highlight color when this item is special + -- TODO: Add special highlight color description = S("Golden Apple"), _doc_items_longdesc = S("Golden apples are precious food items which can be eaten."), wield_image = "mcl_core_apple_golden.png", inventory_image = "mcl_core_apple_golden.png", stack_max = 64, - -- TODO: Reduce to 4 when it's ready - on_place = minetest.item_eat(20), - on_secondary_use = minetest.item_eat(20), - groups = { food = 2, eatable = 20, can_eat_when_full = 1 }, + on_place = eat_gapple, + on_secondary_use = eat_gapple, + groups = { food = 2, eatable = 4, can_eat_when_full = 1 }, + _mcl_saturation = 9.6, +}) + +minetest.register_craftitem("mcl_core:apple_gold_enchanted", { + description = S("Enchanted Golden Apple"), + _doc_items_longdesc = S("Golden apples are precious food items which can be eaten."), + wield_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay, + inventory_image = "mcl_core_apple_golden.png" .. mcl_enchanting.overlay, + stack_max = 64, + on_place = eat_gapple, + on_secondary_use = eat_gapple, + groups = { food = 2, eatable = 4, can_eat_when_full = 1 }, _mcl_saturation = 9.6, }) diff --git a/mods/ITEMS/mcl_core/depends.txt b/mods/ITEMS/mcl_core/depends.txt index 60ece3906d..fb9861814b 100644 --- a/mods/ITEMS/mcl_core/depends.txt +++ b/mods/ITEMS/mcl_core/depends.txt @@ -5,3 +5,4 @@ mcl_util mcl_worlds doc_items doc? +mcl_enchanting