Minecraft – Removing Lightnings’s extra damage by fire

minecraft-commandsminecraft-java-edition

So, I would like to summon Lightnings on players so that they receive roughly 2 hearts of damage.

With my current system, it looks like if you stay for a moment in the fire you receive double damage.

I don't care to remove all fire blocks from the map in order to fix this…

Here's how I set up the command blocks:

/testfor @e[type=Item] {Item:{id:minecraft:nether_star}}

comparator with repeaters to add a delay and then

/scoreboard players set @e[type=Item] Light 1 {Item:{id:minecraft:nether_star}}
/execute @e[score_Light_min=1] ~ ~ ~ execute @a[r=6] ~ ~ ~ effect @p fire_resistance 6 1 true
/execute @e[score_Light_min=1] ~ ~ ~ execute @e[r=6] ~ ~ ~ summon LightningBolt

As you can see I tried giving the hit players fire resistance, but they still get that weird damage right after the get struck by the bolt…

Best Answer

Lightning, regardless of whether or not you are standing in fire, will often hit an entity twice in a row. You can see this by standing in water and summoning a bunch of LightningBolts and watching your health.

To get around this, you could give the player a high level of resistance 1 tick after the lightning strikes so that they take no damage from the second hit (if it occurs). For example:

execute @p ~ ~ ~ summon LightningBolt

A 1 tick delay so the first hit counts, and then:

effect @p minecraft:resistance 1 5