Updated:
Quickest: creative mode
/gamemode creative
Creative players take no damage, except from the void and /kill. To keep playing survival, use the effect below. See the gamemode guide.
Resistance V
# Java
/effect give @s minecraft:resistance infinite 4 true
# Bedrock
/effect @s resistance 99999 4 true
Each Resistance level cuts damage by 20%, so level V blocks almost everything. Levels count from 0 in commands, so level V is 4. The final true hides the particles. Java's infinite works from 1.19.4.
Resistance does not stop the void or /kill. To stop hunger as well, add Saturation:
/effect give @s minecraft:saturation infinite 0 true
Turn off one kind of damage (game rules)
| Damage | Java 1.21.11+ | Java 1.21.10 and earlier | Bedrock |
|---|---|---|---|
| Falling | minecraft:fall_damage | fallDamage | falldamage |
| Fire and lava | minecraft:fire_damage | fireDamage | firedamage |
| Drowning | minecraft:drowning_damage | drowningDamage | drowningdamage |
/gamerule minecraft:fall_damage false
That example uses the 1.21.11+ name. Game rules affect everyone in the world. The game rule list has the rest.
Make a mob invincible (Java)
/summon minecraft:villager ~ ~ ~ {Invulnerable:1b}
/data merge entity @e[type=minecraft:villager,limit=1,sort=nearest] {Invulnerable:1b}
A mob with Invulnerable:1b ignores attacks, explosions and other damage, which is handy for shop villagers and pets. Set {Invulnerable:0b} to undo it. Bedrock has no such data, so give the mob Resistance instead.
Undo it
# Java
/effect clear @s minecraft:resistance
# Bedrock (removes every effect)
/effect @s clear
Set game rules back to true.
When it does not work
- You still take a little damage: the level is too low. Use
4(level V). - "infinite" gives an error: you are on Java before 1.19.4 or on Bedrock. Use a number of seconds.
- You die in the void: nothing on this page blocks void damage.
Common questions
- Is Resistance 255 stronger? No. Level V already blocks the damage.
- Can I still attack? Yes. Resistance only changes the damage you take.
- Only me on a server? Use the effect. Game rules apply to everyone.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.