Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displayHealth(p: player, e: living entity):
- set {_health} to tag "Health" of nbt of {_e}
- set {_health} to ceil({_health})
- set {_healthtext} to ""
- while {_health} >= 2:
- set {_healthtext} to "%{_healthtext}%&4❤"
- remove 2 from {_health}
- if {_health} is 1:
- set {_healthtext} to "%{_healthtext}%&c❤"
- set {_health} to tag "Health" of nbt of {_e}
- set {_currentdamage} to max health of {_e}-ceil(ceil({_health})/2)
- if {_currentdamage} > 0:
- loop {_currentdamage} times:
- set {_healthtext} to "%{_healthtext}%&7❤"
- set {_absorption} to tag "AbsorptionAmount" of nbt of {_e}
- set {_absorption} to ceil({_absorption})
- while {_absorption} >= 2:
- set {_healthtext} to "%{_healthtext}%&6❤"
- remove 2 from {_absorption}
- if {_absorption} is 1:
- set {_healthtext} to "%{_healthtext}%&e❤"
- if "%all active potion effects of {_e}%" contain "POISON":
- replace "&4" in {_healthtext} with "&2"
- replace "&c" in {_healthtext} with "&a"
- if "%all active potion effects of {_e}%" contain "WITHER":
- replace "&4" in {_healthtext} with "&0"
- replace "&c" in {_healthtext} with "&8"
- if {_e} is a player:
- set {_entityname} to "%{_e}%"
- else:
- set {_name} to tag "CustomName" of nbt of {_e}
- if {_name} is set:
- set {_entityname} to {_name}
- else if {_name} is not set:
- set {_entityname} to getMobTypeName({_e})
- send action bar from "&7%{_entityname}% %{_healthtext}%" to {_p}
- function getMobTypeName(e: entity) :: string:
- set {_name} to "%{_e}.getType()%" in lower case
- replace "_" in {_name} with " "
- set {_splits::*} to {_name} split by ""
- set {_size} to size of {_spilts::*}
- delete {_splits::%{_size}%}
- set {_splits::1} to {_splits::1} in upper case
- loop {_splits::*}:
- set {_num} to loop-index parsed as integer - 1
- {_splits::%{_num}%} is " "
- set {_splits::%loop-index%} to {_splits::%loop-index%} in upper case
- return join {_splits::*}
- on damage:
- attacker is a player
- victim is a living entity
- victim is not armor stand
- event is not cancelled
- wait 1 tick
- if max health of victim > 50:
- set {_health} to tag "Health" of nbt of victim
- set {_maxhealth} to max health of victim*2
- add tag "AbsorptionAmount" of nbt of victim to {_health}
- if name of victim is set:
- set {_entityname} to name of victim
- else if name of {_e} is not set:
- set {_entityname} to getMobTypeName(victim)
- send action bar from "&7%{_entityname}% &c%{_health}%&7/&a%{_maxhealth}%" to attacker
- else:
- displayHealth(attacker, victim)
- on damage:
- victim is a living entity
- victim is not armor stand
- set {_victimhealth} to tag "Health" of nbt of victim
- add tag "AbsorptionAmount" of nbt of victim to {_victimhealth}
- wait 1 tick
- set {_damagedhealth} to tag "Health" of nbt of victim
- add tag "AbsorptionAmount" of nbt of victim to {_damagedhealth}
- {_victimhealth}-{_damagedhealth} > 0
- set {_yaw} to random number between 0 and 360
- set {_pitch} to -60
- set {_loc} to location 1 meter above location of victim
- set yaw of {_loc} to {_yaw}
- set pitch of {_loc} to {_pitch}
- spawn an armor stand at {_loc}
- add "{CustomName:""&c%{_victimhealth}-{_damagedhealth}%"",CustomNameVisible:1b,Invisible:1b,Marker:1b,Small:1b,NoGravity:1b}" to nbt of last spawned armor stand
- set {_holo} to last spawned armor stand
- loop 10 times:
- remove 3 from {_pitch}
- set pitch of {_loc} to {_pitch}
- set {_loc} to location 0.15 meter forwards {_loc}
- teleport {_holo} to {_loc}
- wait 1 tick
- wait 5 tick
- kill {_holo}
- on heal:
- event-entity is a living entity
- event-entity is not armor stand
- set {_health} to tag "Health" of nbt of event-entity
- add tag "AbsorptionAmount" of nbt of event-entity to {_health}
- wait 1 tick
- set {_healedhealth} to tag "Health" of nbt of event-entity
- add tag "AbsorptionAmount" of nbt of event-entity to {_healedhealth}
- abs({_healedhealth}-{_health}) > 0
- set {_yaw} to random number between 0 and 360
- set {_pitch} to -60
- set {_loc} to location 1 meter above location of event-entity
- set yaw of {_loc} to {_yaw}
- set pitch of {_loc} to {_pitch}
- spawn an armor stand at {_loc}
- add "{CustomName:""&a%abs({_healedhealth}-{_health})%"",CustomNameVisible:1b,Invisible:1b,Marker:1b,Small:1b,NoGravity:1b}" to nbt of last spawned armor stand
- set {_holo} to last spawned armor stand
- loop 10 times:
- remove 3 from {_pitch}
- set pitch of {_loc} to {_pitch}
- set {_loc} to location 0.15 meter forwards {_loc}
- teleport {_holo} to {_loc}
- wait 1 tick
- wait 5 tick
- kill {_holo}
Advertisement
Add Comment
Please, Sign In to add comment