-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 1.7.10, Minecraft 1.8, Minecraft 1.8.1-pre2, Minecraft 1.8.1-pre5, Minecraft 1.8.1, Minecraft 1.8.7, Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w47b, Minecraft 15w47c, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 1.10.2, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w14a, Minecraft 17w17a, Minecraft 1.12 Pre-Release 2, Minecraft 1.12 Pre-Release 3, Minecraft 1.12 Pre-Release 5, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 18w16a, Minecraft 18w21a, Minecraft 1.13-pre5, Minecraft 1.13, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w50a, Minecraft 1.14 Pre-Release 5, 1.14.4, 19w40a, 1.15 Pre-release 3, 1.16 Pre-release 1, 1.16.1, 1.16.2, 20w51a, 21w03a, 1.17, 1.17.1, 21w38a, 21w40a, 1.18 Release Candidate 1, 1.18, 1.18.1, 1.18.2, 22w14a, 22w18a, 1.19 Pre-release 1, 1.19, 1.19.2, 1.19.3, 1.20.1 Release Candidate 1, 1.20.1, 23w45a, 1.20.3 Release Candidate 1, 24w03b, 1.21, 1.21.4 Pre-Release 1
-
Confirmed
-
Entities
-
Normal
-
Platform
The bug
Lightning sometimes does damage multiple times, instead of only once (which would be the expected behavior).
To reproduce
- Summon a zombie pigman
- Summon a Lightning bolt nearby with /summon minecraft:lightning_bolt
The pigman will sometimes take damage twice.
Code analysis
Based on 1.11 decompiled using MCP 9.35 rc1
Lightning bolts have two fields which are important for the following:
- lightningState: Initialized to 2
- boltLivingTime: Initialized to a random integer between 1 and 3 (both inclusive)
Every time a lightning bolt is updated it does the following:
- Reduce lightningState by 1
- If lightningState < 0
- If boltLivingTime: Set dead
- Else if lightningState < random integer between -9 and 0 (both inclusive)
- Reduce boltLivingTime by 1
- Set lightningState to 1
- If lightningState >= 0: Deal damage to entities
This means a lightning bolt can try to deal damage to entities up to 8 times with the last strike being in the 35th tick after the lightning bolt was created. This allows it to deal 20 damage to a player which would kill him.
- relates to
-
MC-114217 Lightning strikes are randomized server and client side resulting in too short or too long lightning strikes client side
- Open