HeightBoxLib
Hitbox related library datapack for geting the height of an entity.
Usage
Execute as an entity at itself and run hblib:util/get_height or any of the other variants.
The height position of both the entity's eye anchor and the hitbox height will be outputted as hblib:hitbox eye and hblib:hitbox out in storage.
The height and eye values can be obtained in score as #Eye hblib.number and #Total hblib.number
Example: Making an entity face a torso of a player
##This is from the targetted entity
scoreboard players set #Player hblib.number 1
function hblib:util/get_height
##Full - Eye height
scoreboard players operation #Temp plate_havoc.temp = #Total hblib.number
scoreboard players operation #Temp plate_havoc.temp -= #Eye hblib.number
#Full /2
scoreboard players operation #Temp2 plate_havoc.temp = #Total hblib.number
scoreboard players operation #Temp2 plate_havoc.temp /= #2 plate_havoc.temp
#Halved + Temp
execute store result storage plate_havoc:custom torso double 0.01 run scoreboard players operation #Temp plate_havoc.temp += #Temp2 plate_havoc.temp
execute anchored eyes as 00000000-0000-0005-0000-0001000007e9 run function plate_havoc:game/misc/face_torso/execute with storage plate_havoc:custom
Variants
hblib:util/get_height | Gets height of an entity's hitbox
hblib:util/get_height_dy | Height of an entity's hitbox -0.01
hblib:util/get_halved | Height of an entity's hitbox /2.
| Version | Minecraft | Loader | Download |
|---|---|---|---|
|
Release 6 6 |
1.20.3, 1.20.3-pre1, 1.20.3-pre2, 1.20.3-pre3, 1.20.3-pre4, 1.20.4, 1.20.5, 1.20.5-pre1, 1.20.5-pre2, 1.20.5-pre3, 1.20.5-pre4, 1.20.5-rc1, 1.20.5-rc2, 1.20.5-rc3, 1.20.6, 1.21, 1.21-pre1, 1.21-pre2, 1.21-pre3, 1.21-pre4, 1.21-rc1, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.2-pre1, 1.21.2-pre2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 23w45a, 23w46a, 23w51a, 23w51b, 24w03a, 24w03b, 24w04a, 24w05a, 24w05b, 24w06a, 24w07a, 24w09a, 24w10a, 24w11a, 24w12a, 24w13a, 24w14a, 24w18a, 24w19a, 24w19b, 24w20a, 24w21a, 24w21b, 24w33a, 24w34a, 24w35a, 24w36a, 24w37a, 24w38a, 24w39a, 24w40a, 24w44a, 24w45a, 24w46a, 26.1, 26.1.1, 26.1.2, 26.2, 26.3-snapshot-1, 26.3-snapshot-10, 26.3-snapshot-2, 26.3-snapshot-3, 26.3-snapshot-4, 26.3-snapshot-5, 26.3-snapshot-6, 26.3-snapshot-7, 26.3-snapshot-8, 26.3-snapshot-9
|
datapack
|
Download |
|
Release 5 5 |
1.21.11
|
datapack
|
Download |
|
Release 4 4 |
1.21.8
|
datapack
|
Download |
|
3 3+mod |
1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4
|
fabric, forge, neoforge, quilt
|
Download |
|
3 |
1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4
|
datapack
|
Download |
|
Release 2 2 |
1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4
|
datapack
|
Download |