I'm making a map for 1.11, and I need to test for a zombie with a certain health. I tried:
/testfor @e[type=zombie] {CustomName:"HEROBRINE",Health:9s}
But it didn't work.
minecraft-commandsminecraft-java-edition
I'm making a map for 1.11, and I need to test for a zombie with a certain health. I tried:
/testfor @e[type=zombie] {CustomName:"HEROBRINE",Health:9s}
But it didn't work.
Best Answer
The
Health
tag's datatype was changed from Short to Float in 1.9, while the oldHealF
tag was removed. To declare a Float, you append the numerical value with an "f". You can also check the custom name with thename
parameter in the selector instead of detecting it through raw NBT data:However, because the datatype is Float, it is highly unlikely that its health will be exactly 9.0. If at any point the mob takes a fraction of health, it essentially becomes impossible to detect the health of non-player entities.