mcl_core: don't crash if mcl_potions is not present.

mcl_potions was an undeclared dependency of mcl_core.

Unfortunately we can't declare it, even as an optional dependency,
because that would create a dependency cycle. However at least it's
optional now.
This commit is contained in:
Daniel Cassidy 2022-01-06 12:36:34 +00:00
parent 108f60e6be
commit 16fb58d9dd
1 changed files with 9 additions and 7 deletions

View File

@ -157,14 +157,16 @@ local function eat_gapple(itemstack, placer, pointed_thing)
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
mcl_potions.fire_resistance_func(placer, 1, 300)
mcl_potions.leaping_func(placer, 1, 300)
if mcl_potions then
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)
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