mojira.dev
MC-76615

Lightning bolt summoned by /summon is offset +0.5x and +0.5z

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.

Comments 3

Because lightning bolts are invalid entities. They aren't even entities (try viewing it's NBT data and @e cannot target it!).

Avantir_Yihn

marcono1234

Erik Broes

Confirmed

/summon, coordinate, lightning, lightning_bolt, skeleton-horse-trap

Minecraft 1.8.1, Minecraft 1.8.2-pre4, Minecraft 1.8.3, Minecraft 1.8.8, Minecraft 15w49b, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 17w06a

Minecraft 18w30b

Retrieved