The bug
When you summon a lightning bolt with the /summon
command, it will appear +0.5x and +0.5z from the coordinates you specified.
How to reproduce
Easy way to test this: Stand in the centre of a block and type /summon lightning_bolt ~ ~ ~
. The lightning bolt will hit the corner of the block you're on in the direction of +x and +z, instead of the centre of the block. You can type /summon lightning_bolt ~-1 ~ ~-1
to see it hit the opposite corner. The lightning bolt is not rounding off to the nearest block corner, as you can have it strike the centre of a block by standing on the corner of a block and entering the command with integer coordinates. This works with absolute coordinates as well.
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.client.renderer.entity.RenderLightningBolt.doRender(EntityLightningBolt, double, double, double, float, float)
offsets the x and z coordinate by 0.5. If this is removed the method net.minecraft.world.WorldServer.updateBlocks()
should offset the x- and z-coordinates of the spawned lightning bolts by 0.5.
Confirmed