execute if entity @s[nbt={equipment:{mainhand:{id:"minecraft:potion"}}}] run effect give @s resistance 1 1
execute if entity @s[nbt={equipment:{mainhand:{id:"minecraft:potion",components:{"minecraft:potion_contents":{potion:"minecraft:healing"}}}}}] run item replace entity @s weapon.mainhand with potion[potion_contents={custom_color:16735376,custom_effects:[{id:regeneration,duration:100,amplifier:1},{id:instant_health,duration:1,amplifier:1},{id:absorption,duration:100}]},custom_name={"text":"Witch Potion","italic":false}]
execute if entity @s[nbt={active_effects:[{id:"minecraft:instant_health",amplifier:1b}]}] run effect clear @s poison