From c4bedb37e068f1c89326695fa3698f2d5197e4d9 Mon Sep 17 00:00:00 2001
From: the-real-herowl <wiktor_t-i@proton.me>
Date: Tue, 2 Apr 2024 03:57:14 +0200
Subject: [PATCH] Brewing fully works with the new system

---
 mods/ITEMS/mcl_potions/init.lua    | 4 ++--
 mods/ITEMS/mcl_potions/potions.lua | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua
index 3f9955630..4c46ec9bd 100644
--- a/mods/ITEMS/mcl_potions/init.lua
+++ b/mods/ITEMS/mcl_potions/init.lua
@@ -405,7 +405,7 @@ local mod_table = {
 
 local function extend_dur(potionstack)
 	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
 	local potionstack = ItemStack(potionstack)
 	local meta = potionstack:get_meta()
@@ -424,7 +424,7 @@ end
 
 local function enhance_pow(potionstack)
 	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
 	local potionstack = ItemStack(potionstack)
 	local meta = potionstack:get_meta()
diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua
index 3c6b62070..0f59a3b97 100644
--- a/mods/ITEMS/mcl_potions/potions.lua
+++ b/mods/ITEMS/mcl_potions/potions.lua
@@ -250,6 +250,7 @@ function mcl_potions.register_potion(def)
 	pdef.on_place = on_use
 	pdef.on_secondary_use = on_use
 
+	local internal_def = table.copy(pdef)
 	minetest.register_craftitem(modname..":"..name, pdef)
 
 	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
 		if not def._effect_list then sdef.instant = true end
 		mcl_potions.register_splash(name, splash_desc, color, sdef)
-		pdef.has_splash = true
+		internal_def.has_splash = true
 	end
 
 	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
 		if not def._effect_list then ldef.instant = true end
 		mcl_potions.register_lingering(name, ling_desc, color, ldef)
-		pdef.has_lingering = true
+		internal_def.has_lingering = true
 	end
 
 	if def.has_arrow then
@@ -320,10 +321,10 @@ function mcl_potions.register_potion(def)
 		adef.custom_effect = def.custom_effect
 		if not def._effect_list then adef.instant = true end
 		mcl_potions.register_arrow(name, arr_desc, color, adef)
-		pdef.has_arrow = true
+		internal_def.has_arrow = true
 	end
 
-	mcl_potions.registered_potions[modname..":"..name] = pdef
+	mcl_potions.registered_potions[modname..":"..name] = internal_def
 end
 
 mcl_potions.register_potion({