## Calculates and notifies the player how much end force is required to perform the desired ability
## Runs from `end_force/player/manager` when the ReqForceAmnt score is higher than 0
## @s = a player

## Calculates how much is needed to perform the action
scoreboard objectives add temp dummy
scoreboard players operation @s temp = @s ReqForceAmnt
scoreboard players operation @s temp -= @s CurrentForce

## Notify player via the actionbar
# titleraw @s actionbar { "rawtext": [  { "translate": "ui.end_force_requirement_1" }, { "score": {"name": "@s", "objective": "temp" } }, { "translate": "ui.end_force_requirement_2" } ] }


titleraw @s[tag=!ToggleForceMessage] actionbar { "rawtext": [  { "translate": "ui.end_force_requirement.need_more" } ] }
titleraw @s[tag=ToggleForceMessage] actionbar { "rawtext": [  { "translate": "ui.end_force_requirement.how_to_get" } ] }

tag @s[tag=ToggleForceMessage] add RemoveToggle
tag @s[tag=!RemoveToggle] add ToggleForceMessage
tag @s[tag=RemoveToggle] remove ToggleForceMessage
tag @s remove RemoveToggle


## Tell the end force meter shake and play a sound
tag @s add ShakeMeter
function end_force/player/title_ui
playsound player.need_more_end_force @s

## Reset ReqForceAmnt and temp
scoreboard players set @s ReqForceAmnt 0
scoreboard players reset @s temp