Hey everyone, this script is actually not made by me, but by TuSKe Enjoyer. Same thing as block overlay skript, but it will outline the hitbox of entities with particles.
Requirements:
- SkBee
-Skript-Reflect
import:
org.bukkit.World
function displayEntityHitBox(player: player, entity: entity, color: color = white):
set {_boundingBox} to {_entity}.getBoundingBox()
set {_minX} to {_boundingBox}.getMinX()
set {_minY} to {_boundingBox}.getMinY()
set {_minZ} to {_boundingBox}.getMinZ()
set {_maxX} to {_boundingBox}.getMaxX()
set {_maxZ} to {_boundingBox}.getMaxZ()
set {_height} to {_boundingBox}.getHeight()
set {_point::1} to location({_minX}, {_minY}, {_minZ}, ({_player}'s world))
set {_point::2} to location({_maxX}, {_minY}, {_minZ}, ({_player}'s world))
set {_point::3} to location({_maxX}, {_minY}, {_maxZ}, ({_player}'s world))
set {_point::4} to location({_minX}, {_minY}, {_maxZ}, ({_player}'s world))
loop 2 times:
loop 4 times:
draw 1 of dust using dustOption({_color}, 0.5) at getLineLocation(({_point::%loop-integer-2%} ~ {_offset}), (({_point::%loop-integer-2 + 1%} ? {_point::1}) ~ {_offset})) to {_player}
if loop-integer-1 is 1:
draw 1 of dust using dustOption({_color}, 0.5) at getLineLocation(({_point::%loop-integer-2%}), ({_point::%loop-integer-2%} ~ vector(0,{_height},0))) to {_player}
draw 1 of dust using dustOption(red, 0.5) at getLineLocation(({_point::%loop-integer-2%} ~ vector(0,((y-coord of location of {_entity}'s eyes) - {_minY}),0)), (({_point::%loop-integer-2 + 1%} ? {_point::1}) ~ vector(0,((y-coord of location of {_entity}'s eyes) - {_minY}),0))) to {_player}
set {_offset} to vector(0,{_height},0)
draw 1 of dust using dustOption(blue, 0.5) at getLineLocation((location of {_entity}'s eyes), (location 2 meters infront of {_entity}'s eyes), 20) to {_player}
function getLineLocation(location1: location, location2: location, density: integer=10) :: locations:
set {_vector} to vector between {_location1} and {_location2}
add {_location1} to {_return::*}
loop {_density} times:
set vector length of {_vector} to loop-integer/{_density} * (distance between {_location1} and {_location2})
add ({_location1} ~ {_vector}) to {_return::*}
return {_return::*}
every tick:
loop all players:
loop all entities in radius 20 of loop-player:
loop-player-1 is not loop-entity-2
displayEntityHitBox(loop-player-1, loop-entity-2)