With this pack you can choose what can cause damage to an entity, by adding a tag ("noDamage:<cause>") to them.
Valid causes:
- anvil (Damage caused by a falling anvil)
- blockExplosion (Damage caused from a non-Entity explosion. For example, an exploding bed)
- campfire (Damage caused by Campfires)
- charging (Unused)
- contact (Damage caused by physically touching an Entity or Block. For example, touching a Sweet Berry bush or Pufferfish)
- drowning (Damage caused by an Entity being out of air and inside a liquid block)
- entityAttack (Damage caused by an Entity attack)
- entityExplosion (Damage caused by an Entity explosion. For example, a Creeper or Wither)
- fall (Damage caused by falling onto the ground)
- fallingBlock (Damage caused by falling blocks. Note: Anvils and Stalactites have their own damage causes)
- fire (Damage caused by catching on fire)
- fireTick (Damage caused by burning over time)
- fireworks (Damage caused by fireworks)
- flyIntoWall (Damage caused by flying into a wall at high speed while gliding with Elytra)
- freezing (Damage caused by staying inside a Powder Snow block)
- lava (Damage caused by touching a Lava block)
- lightning (Damage caused by being struck by lightning)
- maceSmash (Damage caused by mace smash)
- magic (Damage caused by magical attacks. For example, Evoker Fang or Conduit Block)
- magma (Damage caused by touching a Magma block)
- none (Damage caused by no source. For example, from a command or script)
- override (Damage caused by an indirect source. For example, setting a mob's health to 0 in a behavior pack)
- piston (Damage caused by a Piston)
- projectile (Damage caused by a projectile)
- ramAttack (Damage caused by Goat ramming)
- selfDestruct (Damage caused by the /kill command)
- sonicBoom (Damage caused by the Warden's Sonic Boom attack)
- soulCampfire (Damage caused by a Soul Campfire)
- stalactite (Damage caused by a falling Stalactite block)
- stalagmite (Damage caused by touching a Stalagmite block)
- starve (Damage caused over time by having an empty hunger bar)
- suffocation (Damage caused by an Entity being out of air and inside a non-liquid block)
- temperature (Damage caused by an Entity being in an inhabitable climate. For example, a Snow Golem in a biome with a temperature greater than 1)
- thorns (Damage caused by the Thorns armor enchantment and by the Guardian thorns effect)
- void (Damage caused over time by falling into the void)
- wither (Damage caused by the Wither effect. For example, from touching a Wither Rose)
Examples:
- /tag @p add "noDamage:fall" (No fall damage for @p)
- /tag @s add "noDamage:lava" (No lava damage for @s)
- /tag Hajsori add "noDamage:drowning" (No drowning damage for Hajsori)

