0x2C S2CPacketSpawnGlobalEntity

Spawns a global entity visible to all players (lightning bolt).

Clientbound (Server → Client) · PLAY · net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java

Published 2026-06-18 · Updated 2026-10-14

entityspawnlightning
Comprehensive 7/8

Fields

FieldTypeDescription
entityIdVarIntEntity ID
x/y/zfixed-point intPosition × 32
typebyteEntity type (1=lightning)

Wire Encoding

FieldTypeNotes
Entity IDVarInt
XIntx*32
YInty*32
ZIntz*32
Typebyte1=lightning

MCP References

MCPNetHandlerPlayClient.handleSpawnGlobalEntity()

Handler Interface

HNDINetHandlerPlayClient

Vanilla Source

S2CPacketSpawnGlobalEntity.java92 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.entity.effect.EntityLightningBolt;
6
import net.minecraft.network.Packet;
7
import net.minecraft.network.PacketBuffer;
8
import net.minecraft.network.play.INetHandlerPlayClient;
9
import net.minecraft.util.MathHelper;
10
11
public class S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient>
12
{
13
    private int entityId;
14
    private int x;
15
    private int y;
16
    private int z;
17
    private int type;
18
19
    public S2CPacketSpawnGlobalEntity()
20
    {
21
    }
22
23
    public S2CPacketSpawnGlobalEntity(Entity entityIn)
24
    {
25
        this.entityId = entityIn.getEntityId();
26
        this.x = MathHelper.floor_double(entityIn.posX * 32.0D);
27
        this.y = MathHelper.floor_double(entityIn.posY * 32.0D);
28
        this.z = MathHelper.floor_double(entityIn.posZ * 32.0D);
29
30
        if (entityIn instanceof EntityLightningBolt)
31
        {
32
            this.type = 1;
33
        }
34
    }
35
36
    /**
37
     * Reads the raw packet data from the data stream.
38
     */
39
    public void readPacketData(PacketBuffer buf) throws IOException
40
    {
41
        this.entityId = buf.readVarIntFromBuffer();
42
        this.type = buf.readByte();
43
        this.x = buf.readInt();
44
        this.y = buf.readInt();
45
        this.z = buf.readInt();
46
    }
47
48
    /**
49
     * Writes the raw packet data to the data stream.
50
     */
51
    public void writePacketData(PacketBuffer buf) throws IOException
52
    {
53
        buf.writeVarIntToBuffer(this.entityId);
54
        buf.writeByte(this.type);
55
        buf.writeInt(this.x);
56
        buf.writeInt(this.y);
57
        buf.writeInt(this.z);
58
    }
59
60
    /**
61
     * Passes this Packet on to the NetHandler for processing.
62
     */
63
    public void processPacket(INetHandlerPlayClient handler)
64
    {
65
        handler.handleSpawnGlobalEntity(this);
66
    }
67
68
    public int func_149052_c()
69
    {
70
        return this.entityId;
71
    }
72
73
    public int func_149051_d()
74
    {
75
        return this.x;
76
    }
77
78
    public int func_149050_e()
79
    {
80
        return this.y;
81
    }
82
83
    public int func_149049_f()
84
    {
85
        return this.z;
86
    }
87
88
    public int func_149053_g()
89
    {
90
        return this.type;
91
    }
92
}

Deobfuscated MCP 1.8.9 source of S2CPacketSpawnGlobalEntity, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java) at build time and verified present.

Deep Dive

Role in the protocol

Spawns a globally visible entity, in 1.8.9 exclusively the lightning bolt. The server broadcasts it to every player within 512 blocks of the strike (WorldServer.addWeatherEffect via sendToAllNear). The client handler converts the x32 fixed-point coordinates and, when the type byte is 1, instantiates an EntityLightningBolt in the client world. Because the entity is server-created and broadcast, it is the only lightning representation the client ever sees.

Vanilla handling

NetHandlerPlayClient.handleSpawnGlobalEntity divides each coordinate by 32.0D and builds an EntityLightningBolt only when the type byte equals 1; any other type yields a null entity and is dropped. The bolt is then added to the client world, which drives its ambient light flash and thunder sound. Server-side the packet constructor derives entityId, coordinates and type from the Entity argument passed in by WorldServer.

Why clients touch it

Two module-grade consumers in the corpus. Rise 6.1.30 and 6.2.4 ship LightningTracker, an exploit-category module that prints the strike coordinates and distance to chat on every type-1 packet. LiquidSense Dev ships LightningCheck, a world-category module with the same read pattern: it divides the fixed-point coordinates back to blocks and posts them to chat, while also storing them in static x/y/z fields that other modules can read. Both are informational, not ESP. The remaining seven client dirs (Memeware, Nekoware, Rise 5.99, Sigma, Spicy, Tenacity, November Recode 2.0) reference the packet only through vanilla NetHandlerPlayClient.

Exploit surface

The packet is a broadcast with a server-chosen entityId and position, so a malicious server can spam it to fake lightning at arbitrary coordinates; there is no client-side validation beyond the type check. The 512-block broadcast radius means a strike far outside the client's render distance still spawns an entity. No client in the corpus abuses this for teleport hacks or lightning-based exploits, and none uses it for anti-cheat purposes.

Server-Side Handling

WorldServer.addWeatherEffect calls ConfigurationManager.sendToAllNear with a 512.0D radius on the strike position, same dimension, constructing S2CPacketSpawnGlobalEntity from the EntityLightningBolt. The packet's constructor copies entityId, x*32, y*32, z*32 and type (1 for lightning) from the entity. NetHandlerPlayClient only materializes the bolt when type == 1, ignoring the entityId for lookup since the client creates the entity fresh.

Protocol Analysis

Encoding: VarInt entityId, int x*32, int y*32, int z*32, byte type. Coordinates are fixed-point at 1/32 block resolution, finer than S29's 1/8. The type byte is the only discriminator; in 1.8.9 only 1 (lightning) is ever sent. The packet predates the generic Packet<T> signature in the older clients (raw Packet with double dispatch) while Rise 6.x uses Packet<INetHandlerPlayClient>.

Anti-Cheat Landscape

No anti-cheat touches this packet. Lightning is ambient weather; there is no cheat surface to measure. The only observable abuse would be server-side strike spam to distract or desync clients, which no module in the corpus defends against. The 512-block radius is worth noting for anyone building lightning-based radar: strikes beyond render distance still arrive.

implementation Implementation Cases

The lightning broadcast packet. Rise 6.x LightningTracker and LiquidSense Dev LightningCheck both print strike coordinates to chat on type-1 packets; LiquidSense additionally caches the coordinates in static fields. No ESP, no weather control, no exploit use: the 10 clients confirm this packet is near-invisible to module authors.

LightningTracker (Rise 6.2.4, Rise 6.1.30)

Print a chat message with the coordinates and distance of every lightning strike.

A PacketReceiveEvent listener. For each S2C it divides the x32 coordinates back to blocks, rounds to two decimals, and when the type byte is 1 calls ChatUtil.display with the position and the player's distance to the strike. It is an exploit-category module but performs no world manipulation.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/LightningTracker.java

Vanilla hook: PacketReceiveEvent.
Passive and read-only; nothing is sent or cancelled. No server can detect it.
Variations: Identical file in Rise 6.1.30. Rise 5.99 has no equivalent module, and no other client in the corpus references this packet outside vanilla code.
LightningCheck (LiquidSense Dev)

Report lightning strikes to chat and expose their coordinates in static fields for other modules.

An @EventTarget onPacket handler on the LiquidBounce PacketEvent bus. For each S2CPacketSpawnGlobalEntity whose type byte is 1 it divides the x32 fixed-point coordinates by 32.0D, stores them in public static x/y/z fields, and prints a prefixed chat line with the strike position. The unused C07PacketPlayerDigging import is dead weight carried over from a copy-paste skeleton.

Source: LiquidSense Dev, me/AquaVit/liquidSense/modules/world/LightningCheck.java

Vanilla hook: LiquidBounce PacketEvent (packet event bus).
Read-only: nothing is sent or cancelled, so the module is undetectable server-side. Any abuse would live downstream of the static coordinate cache, which other modules consume.
Variations: Rise's LightningTracker computes the player's distance to the strike and formats a different chat line; LiquidSense prints raw coordinates and keeps the static cache. No other client in the corpus reads S2C.
Two consumers: Rise 6.x PacketReceiveEvent listener and LiquidSense Dev PacketEvent listener, both read-only.
Rise 6.1.30 and 6.2.4 ship byte-identical LightningTracker files. LiquidSense Dev's LightningCheck uses the LiquidBounce event bus (@EventTarget onPacket) and static coordinate fields. The other seven clients touch the packet only in net/minecraft vanilla sources (NetHandlerPlayClient, EnumConnectionState, WorldServer).

anticheat Anti-Cheat Checks

No anticheat in the 50-repo corpus runs a check on the global-entity (lightning) packet. The only genuine packet references are framework registrations: Artemis wraps PacketPlayOutSpawnEntityWeather as GPacketPlayServerSpawnEntityWeather and registers it at SERVER_PLAY + 69, and Negativity lists the packet in its PacketType enum. Every other corpus hit is keyword noise from the search term Lightning: strikeLightningEffect ban-punishment visuals in PeyangSuperbAntiCheat KickUtil, TruthfulAC Check and SafeguardAC ViolationHandler, and lightning-rod block-shape comments in NoCheatPlus. Lightning is ambient server weather with no client-trust signal, so nothing measures it.

Wiki Cross-Reference

Clientbound 0x2C: VarInt entityId, byte type, then X Y Z ints at times 32.

Type is always 1 in 1.8.9, meaning lightning bolt; other types are dropped.

Broadcast to players within 512 blocks of the strike position.

MCP 1.8.9 S2CPacketSpawnGlobalEntity implements Packet dispatching to INetHandlerPlayClient.handleSpawnGlobalEntity; wire serde is readPacketData/writePacketData via readByte, readInt, readVarIntFromBuffer.

1.8.9 callers: WorldServer.addWeatherEffect sends new S2CPacketSpawnGlobalEntity (line 984): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldServer.java

Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.

Vanilla Internals

Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.