S2CPacketSpawnGlobalEntity .java

net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity (class, 93 lines): members: func_149049_f, func_149050_e, func_149051_d, func_149052_c, type.

net.minecraft.network.play.serverclass93 linesserver2.1 KB

Implements

API Surface (8)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
int func_149052_c()
int func_149051_d()
int func_149050_e()
int func_149049_f()
int func_149053_g()

Fields & Constants (5)

entityId
x
y
z
type

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

S2CPacketSpawnGlobalEntity.java93 lines · MCP 1.8.9 · verbatimOriginal ↗
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
}
93

Deobfuscated MCP 1.8.9 source of S2CPacketSpawnGlobalEntity from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java), stored verbatim.