title @s[tag=xpstorefail] actionbar {"text":"10 Levels are required","color":"red"}
execute if entity @s[nbt={SelectedItem:{id:"minecraft:potion",components:{"minecraft:custom_data":{xpstore:tag}}}}] run tag @s add bottlemain
execute if entity @s[nbt={SelectedItem:{id:"minecraft:potion",components:{"minecraft:custom_data":{xpstore:tag}}}},tag=!bottlemain] run tag @s add bottleoff
item replace entity @s[tag=bottlemain] weapon.mainhand with potion[custom_data={xpstore:tag},potion_contents={custom_color:13487615},custom_name={"text":"Empty XP Bottle","italic":false},lore=[{"text":"Drink to store up to 30 levels","italic":false,"color":"gray"},{"text":"Minimum of 10 levels required","italic":false,"color":"red"}],tooltip_display={hidden_components:[potion_contents]}]
item replace entity @s[tag=bottlemain] weapon.mainhand with glass_bottle[custom_data={xpstore:tag},potion_contents={custom_color:13487615},custom_name={"text":"Empty XP Bottle","italic":false},lore=[{"text":"Drink to store up to 30 levels","italic":false,"color":"gray"},{"text":"Minimum of 10 levels required","italic":false,"color":"red"}],tooltip_display={hidden_components:[potion_contents]}]
item replace entity @s[tag=bottleoff] weapon.offhand with potion[custom_data={xpstore:tag},potion_contents={custom_color:13487615},custom_name={"text":"Empty XP Bottle","italic":false},lore=[{"text":"Drink to store up to 30 levels","italic":false,"color":"gray"},{"text":"Minimum of 10 levels required","italic":false,"color":"red"}],tooltip_display={hidden_components:[potion_contents]}]
tag @s remove bottlemain
tag @s remove bottleoff
tag @s remove xpstorefail