From 9365493696b5c52e708e1b901c13309e4294c44c Mon Sep 17 00:00:00 2001
From: Wuzzy <Wuzzy2@mail.ru>
Date: Thu, 12 Nov 2020 16:43:12 +0100
Subject: [PATCH] Fix fire resistance bad protect against magmablock

---
 mods/ITEMS/mcl_nether/init.lua       | 3 +++
 mods/ITEMS/mcl_potions/functions.lua | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua
index aac92839a..6497dfb53 100644
--- a/mods/ITEMS/mcl_nether/init.lua
+++ b/mods/ITEMS/mcl_nether/init.lua
@@ -96,6 +96,9 @@ minetest.register_node("mcl_nether:magma", {
 	sounds = mcl_sounds.node_sound_stone_defaults(),
 	-- From walkover mod
 	on_walk_over = function(loc, nodeiamon, player)
+		if minetest.global_exists("mcl_potions") and mcl_potions.player_has_effect(player, "fire_proof") then
+			return
+		end
 		-- Hurt players standing on top of this block
 		if player:get_hp() > 0 then
 			if mod_death_messages then
diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua
index 64b098ab8..f1384ab30 100644
--- a/mods/ITEMS/mcl_potions/functions.lua
+++ b/mods/ITEMS/mcl_potions/functions.lua
@@ -503,6 +503,14 @@ function mcl_potions._load_player_effects(player)
 
 end
 
+-- Returns true if player has given effect
+function mcl_potions.player_has_effect(player, effect_name)
+	if not EF[effect_name] then
+		return false
+	end
+	return EF[effect_name][player] ~= nil
+end
+
 minetest.register_on_leaveplayer( function(player)
 	mcl_potions._save_player_effects(player)
 	mcl_potions._reset_player_effects(player) -- clearout the buffer to prevent looking for a player not there