Brewing fully works with the new system

This commit is contained in:
the-real-herowl 2024-04-02 03:57:14 +02:00
parent f60f50041d
commit c4bedb37e0
2 changed files with 7 additions and 6 deletions

View File

@ -405,7 +405,7 @@ local mod_table = {
local function extend_dur(potionstack) local function extend_dur(potionstack)
local def = potions[potionstack:get_name()] local def = potions[potionstack:get_name()]
if not def then return false end -- somehow, it initially always fails if not def then return false end
if not def.has_plus then return false end -- bail out if can't be extended if not def.has_plus then return false end -- bail out if can't be extended
local potionstack = ItemStack(potionstack) local potionstack = ItemStack(potionstack)
local meta = potionstack:get_meta() local meta = potionstack:get_meta()
@ -424,7 +424,7 @@ end
local function enhance_pow(potionstack) local function enhance_pow(potionstack)
local def = potions[potionstack:get_name()] local def = potions[potionstack:get_name()]
if not def then return false end -- somehow, it initially always fails if not def then return false end
if not def.has_potent then return false end -- bail out if has no potent variant if not def.has_potent then return false end -- bail out if has no potent variant
local potionstack = ItemStack(potionstack) local potionstack = ItemStack(potionstack)
local meta = potionstack:get_meta() local meta = potionstack:get_meta()

View File

@ -250,6 +250,7 @@ function mcl_potions.register_potion(def)
pdef.on_place = on_use pdef.on_place = on_use
pdef.on_secondary_use = on_use pdef.on_secondary_use = on_use
local internal_def = table.copy(pdef)
minetest.register_craftitem(modname..":"..name, pdef) minetest.register_craftitem(modname..":"..name, pdef)
if def.has_splash or def.has_splash == nil then if def.has_splash or def.has_splash == nil then
@ -270,7 +271,7 @@ function mcl_potions.register_potion(def)
sdef.on_splash = def.custom_splash_effect sdef.on_splash = def.custom_splash_effect
if not def._effect_list then sdef.instant = true end if not def._effect_list then sdef.instant = true end
mcl_potions.register_splash(name, splash_desc, color, sdef) mcl_potions.register_splash(name, splash_desc, color, sdef)
pdef.has_splash = true internal_def.has_splash = true
end end
if def.has_lingering or def.has_lingering == nil then if def.has_lingering or def.has_lingering == nil then
@ -292,7 +293,7 @@ function mcl_potions.register_potion(def)
ldef.while_lingering = def.custom_linger_effect ldef.while_lingering = def.custom_linger_effect
if not def._effect_list then ldef.instant = true end if not def._effect_list then ldef.instant = true end
mcl_potions.register_lingering(name, ling_desc, color, ldef) mcl_potions.register_lingering(name, ling_desc, color, ldef)
pdef.has_lingering = true internal_def.has_lingering = true
end end
if def.has_arrow then if def.has_arrow then
@ -320,10 +321,10 @@ function mcl_potions.register_potion(def)
adef.custom_effect = def.custom_effect adef.custom_effect = def.custom_effect
if not def._effect_list then adef.instant = true end if not def._effect_list then adef.instant = true end
mcl_potions.register_arrow(name, arr_desc, color, adef) mcl_potions.register_arrow(name, arr_desc, color, adef)
pdef.has_arrow = true internal_def.has_arrow = true
end end
mcl_potions.registered_potions[modname..":"..name] = pdef mcl_potions.registered_potions[modname..":"..name] = internal_def
end end
mcl_potions.register_potion({ mcl_potions.register_potion({