Is there any way to make lightning bolts deal no damage?

I'm making a game that requires for a lightning bolt to be spawned above everyone's heads every 3 seconds (so that they can be tracked). However, if a player is standing directly below another player when the lightning strikes, the lightning deals damage to the player above. Is there any NBT tag I could use to negate lightning damage? If not, can you think of any other possible workarounds?


Solution 1:

When summoning a LightningBolt with /summon, NBT input is ignored, so there is no NBT data you can provide.

As an alternative, 1.9 introduces a new block called the End Gateway, which produces beams of light similar to beacons. Unlike beacons, there is no need for a specific structure and the beam will go through all blocks (both upwards and downwards).

You could potentially setblock an end gateway at Y0 via /execute to produce the same sort of effect without damaging the player. The Age long tag for end gateways will create a magenta beam of light so long as the value is below 200, so you can use that to specify the duration the beam should last for.

/execute @p ~ ~ ~ /setblock ~ 0 ~ minecraft:end_gateway 0 replace {Age:160l}

Note that end gateway blocks will not teleport entities if the ExitPortal compound is not defined, but its beam will still become yellow if an entity enters it while Age is 200 or higher. If you wanted yellow beams instead of magenta, you could create the end gateway as well as summon an entity that will despawn after a set amount of time.

For example, the following creates an end gateway with an AreaEffectCloud entity inside it that will despawn after 100 ticks (5 seconds):

/execute @p ~ ~ ~ /setblock ~ 0 ~ minecraft:end_gateway 0 replace {Age:200l}
/execute @p ~ ~ ~ /summon AreaEffectCloud ~ 0 ~ {Duration:100}