Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How To Test For a Mob's Health
- by Spiralio
- Made for FireFury91:
- Unfortunately, there is no way to test for a mob's health with only one command block, so we will have to use a command block for each value. The number of command blocks will depend on the amount of max health your mob has. If you are unsure of this value, use the Minecraft Wiki. It will show you the mob's max health value.
- For this example, I will be using a villager. Villagers have 20 max health points, therefor I will place 20 different command blocks down. Each of the command blocks should be set to "Repeat" and "Always Active". You can get their output using a comparator or a conditional command block.
- Each of the repeat command blocks will have the following commands:
- 1st Command Block: /testfor [Player/Mob Specs] {Health:1.0f}
- 2st Command Block: /testfor [Player/Mob Specs] {Health:2.0f}
- 3st Command Block: /testfor [Player/Mob Specs] {Health:3.0f}
- 4st Command Block: /testfor [Player/Mob Specs] {Health:4.0f}
- So on...
- However, this can be unreliable. I'd recommend increments of 0.5 instead of 5 for the best results, since critical hits deal 1505 more damage.
- I hope this helps!
Advertisement
Add Comment
Please, Sign In to add comment