From 023be609df69cedf2ad842b8f18f0fdb4fdaf37d Mon Sep 17 00:00:00 2001 From: James David Clarke Date: Sat, 13 Jan 2024 16:32:02 +0000 Subject: [PATCH] Added mcl_potions._clear_cached_entity_data function to clear non-player effects --- mods/ITEMS/mcl_potions/functions.lua | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 24aa2e402..a989f93cd 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -427,24 +427,30 @@ end, -50) -- ███████╗╚█████╔╝██║░░██║██████╔╝██╔╝░░░██████╔╝██║░░██║░░╚██╔╝░░███████╗ -- ╚══════╝░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝░░░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝ + +function mcl_potions._clear_cached_entity_data(entity) + EF.invisible[entity] = nil + EF.poisoned[entity] = nil + EF.regenerating[entity] = nil + EF.strong[entity] = nil + EF.weak[entity] = nil + EF.water_breathing[entity] = nil + EF.leaping[entity] = nil + EF.swift[entity] = nil + EF.night_vision[entity] = nil + EF.fire_proof[entity] = nil + EF.bad_omen[entity] = nil + EF.withering[entity] = nil +end + function mcl_potions._clear_cached_player_data(player) - EF.invisible[player] = nil - EF.poisoned[player] = nil - EF.regenerating[player] = nil - EF.strong[player] = nil - EF.weak[player] = nil - EF.water_breathing[player] = nil - EF.leaping[player] = nil - EF.swift[player] = nil - EF.night_vision[player] = nil - EF.fire_proof[player] = nil - EF.bad_omen[player] = nil - EF.withering[player] = nil + mcl_potions._clear_cached_entity_data(player) meta = player:get_meta() meta:set_int("night_vision", 0) end + function mcl_potions._reset_player_effects(player, set_hud) if not player:is_player() then