I just wanted to know because I'm not the best when it comes to commands. These are the things I tried: /effect give @p poison 1 100 true but fast poison doesn't work. Then I tried /attribute base set @p minecraft:max_health 1 attribute base set @p minecraft:max_health 20 To try to mess with the regeneration system. Finally I tried /effect give @a instant_health 1 99 true and summon tnt ~4.5 ~ ~ But I had to be too precise with the tnt.


3 Answers 3



Note: This data pack is in beta, and is in the works. If you have any bugs please let me know, and I'll add it to the known bugs list. Also, this is not tested in any version other then 1.16.4

I created a data pack that allows you to set health and deal damage to a player(for mobs use data modify instead). First off, you can get the data pack here. After installing it, make sure it says in chat that it was installed.

How To Use

Dealing Damage

To damage a player, set that player's damage scoreboard to how much damage you want to apply(negatives heal players), then run the function editor:deal_damage as the player you want to damage and you are done.

Setting Health

To set the health of a player, set that player's sethealth scoreboard to what health you want that player to have, then run the function editor:set_health as the player you want to edit health and you are done.

Remember: 1 heart is 2 HP, and a half a heart is 1 HP, default max health is 20 HP(10 hearts)

The Commands

To damage players:

scoreboard players set <selector> damage <value>
execute as <selector> run function editor:deal_damage

To set player health:

scoreboard players set <selector> sethealth <value>
execute as <selector> run function editor:set_health

How It Works

What the data pack does is set the max health of the player to what health you want to set, and gives the player the instant health effect so it will update the player health, setting the player's health to max, then it sets the max health to be what it originally was.

Known Bugs

  • A bug that shows the player as dead, even though they are not. (Its a Minecraft bug)


All Incompatibilities are being worked on to be compatible

  • An existing helmet/item in the helmet slot with the max health attribute

Finding Bugs/Issues


If you find any bugs, please report it. Also add how you found the bug, so I can recreate it, and fix it, videos/screenshots of bugs are preferred.


If you have any performance issues while running the data pack, please report it. Also add what performance issues you are getting, low tps, low fps, etc. Videos/screenshots and computer specs do help!

Where to report

To report bugs/issues, use either comments on this answer, or the issues page on the GitHub download link.

Terms of Use

If you use this in a data pack to publish, I would like for you to put the GitHub link to the data pack somewhere for others who may want it, Thanks. You are welcome to edit the data pack to whatever you want, just don't break it! :)


It depends on what version you are using, but here are 2 different videos for setting a player's health: (You can also search for "minecraft setting player health" to find these results)


1.12, this one uses the attribute that @rexillion was talking about:

Your last option is to use the Health Boost effect just like a golden or enchanted golden apple does, though this only works for increasing health, not decreasing. Your command would look something like this: /effect give @p minecraft:absorption [time] [strength of effect]

  • 1
    Could you give a quick summary and/or the command to do it?
    – Penguin
    Dec 8, 2020 at 19:50
  • The 1.16/1.15 method only limits player health. It doesn’t damage the player. Once the limit is back at default, the player’s hp will be what it originally was. Also OP might not want to use datapacks. Dec 8, 2020 at 20:31

You can give the player an item with a specific attribute like a leather helmet.

  • What attribute are you talking about? What if the player already has a helmet on? Dec 8, 2020 at 18:26
  • @randomuser922 You can add the attribute to the helmet they are already wearing
    – rexillion
    Dec 8, 2020 at 18:42
  • 2
    You need to explain how you do that
    – Penguin
    Dec 8, 2020 at 19:49
  • The command that James Read did
    – rexillion
    Dec 9, 2020 at 14:57
  • @rexillion Which one? Dec 9, 2020 at 18:04

Not the answer you're looking for? Browse other questions tagged .