S18PacketEntityTeleport .java

net.minecraft.network.play.server.S18PacketEntityTeleport (class): members: getOnGround, onGround, getYaw, posZ, getEntityId, posX, posY, yaw, getPitch.

net.minecraft.network.play.serverclass117 linesserver2.9 KB

Implements

API Surface (10)

void readPacketData(PacketBuffer buf)
void writePacketData(PacketBuffer buf)
void processPacket(INetHandlerPlayClient handler)
int getEntityId()
int getX()
int getY()
int getZ()
byte getYaw()
byte getPitch()
boolean getOnGround()

Fields & Constants (7)

entityId
posX
posY
posZ
yaw
pitch
onGround

Code Graph: Dependencies (5)

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

Full Source

S18PacketEntityTeleport.java117 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.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
import net.minecraft.util.MathHelper;
9
10
public class S18PacketEntityTeleport implements Packet<INetHandlerPlayClient>
11
{
12
    private int entityId;
13
    private int posX;
14
    private int posY;
15
    private int posZ;
16
    private byte yaw;
17
    private byte pitch;
18
    private boolean onGround;
19
20
    public S18PacketEntityTeleport()
21
    {
22
    }
23
24
    public S18PacketEntityTeleport(Entity entityIn)
25
    {
26
        this.entityId = entityIn.getEntityId();
27
        this.posX = MathHelper.floor_double(entityIn.posX * 32.0D);
28
        this.posY = MathHelper.floor_double(entityIn.posY * 32.0D);
29
        this.posZ = MathHelper.floor_double(entityIn.posZ * 32.0D);
30
        this.yaw = (byte)((int)(entityIn.rotationYaw * 256.0F / 360.0F));
31
        this.pitch = (byte)((int)(entityIn.rotationPitch * 256.0F / 360.0F));
32
        this.onGround = entityIn.onGround;
33
    }
34
35
    public S18PacketEntityTeleport(int entityIdIn, int posXIn, int posYIn, int posZIn, byte yawIn, byte pitchIn, boolean onGroundIn)
36
    {
37
        this.entityId = entityIdIn;
38
        this.posX = posXIn;
39
        this.posY = posYIn;
40
        this.posZ = posZIn;
41
        this.yaw = yawIn;
42
        this.pitch = pitchIn;
43
        this.onGround = onGroundIn;
44
    }
45
46
    /**
47
     * Reads the raw packet data from the data stream.
48
     */
49
    public void readPacketData(PacketBuffer buf) throws IOException
50
    {
51
        this.entityId = buf.readVarIntFromBuffer();
52
        this.posX = buf.readInt();
53
        this.posY = buf.readInt();
54
        this.posZ = buf.readInt();
55
        this.yaw = buf.readByte();
56
        this.pitch = buf.readByte();
57
        this.onGround = buf.readBoolean();
58
    }
59
60
    /**
61
     * Writes the raw packet data to the data stream.
62
     */
63
    public void writePacketData(PacketBuffer buf) throws IOException
64
    {
65
        buf.writeVarIntToBuffer(this.entityId);
66
        buf.writeInt(this.posX);
67
        buf.writeInt(this.posY);
68
        buf.writeInt(this.posZ);
69
        buf.writeByte(this.yaw);
70
        buf.writeByte(this.pitch);
71
        buf.writeBoolean(this.onGround);
72
    }
73
74
    /**
75
     * Passes this Packet on to the NetHandler for processing.
76
     */
77
    public void processPacket(INetHandlerPlayClient handler)
78
    {
79
        handler.handleEntityTeleport(this);
80
    }
81
82
    public int getEntityId()
83
    {
84
        return this.entityId;
85
    }
86
87
    public int getX()
88
    {
89
        return this.posX;
90
    }
91
92
    public int getY()
93
    {
94
        return this.posY;
95
    }
96
97
    public int getZ()
98
    {
99
        return this.posZ;
100
    }
101
102
    public byte getYaw()
103
    {
104
        return this.yaw;
105
    }
106
107
    public byte getPitch()
108
    {
109
        return this.pitch;
110
    }
111
112
    public boolean getOnGround()
113
    {
114
        return this.onGround;
115
    }
116
}
117

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