| 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.world.World;
|
| 9 |
|
| 10 | public class S14PacketEntity implements Packet<INetHandlerPlayClient>
|
| 11 | {
|
| 12 | protected int entityId;
|
| 13 | protected byte posX;
|
| 14 | protected byte posY;
|
| 15 | protected byte posZ;
|
| 16 | protected byte yaw;
|
| 17 | protected byte pitch;
|
| 18 | protected boolean onGround;
|
| 19 | protected boolean field_149069_g;
|
| 20 |
|
| 21 | public S14PacketEntity()
|
| 22 | {
|
| 23 | }
|
| 24 |
|
| 25 | public S14PacketEntity(int entityIdIn)
|
| 26 | {
|
| 27 | this.entityId = entityIdIn;
|
| 28 | }
|
| 29 |
|
| 30 | /**
|
| 31 | * Reads the raw packet data from the data stream.
|
| 32 | */
|
| 33 | public void readPacketData(PacketBuffer buf) throws IOException
|
| 34 | {
|
| 35 | this.entityId = buf.readVarIntFromBuffer();
|
| 36 | }
|
| 37 |
|
| 38 | /**
|
| 39 | * Writes the raw packet data to the data stream.
|
| 40 | */
|
| 41 | public void writePacketData(PacketBuffer buf) throws IOException
|
| 42 | {
|
| 43 | buf.writeVarIntToBuffer(this.entityId);
|
| 44 | }
|
| 45 |
|
| 46 | /**
|
| 47 | * Passes this Packet on to the NetHandler for processing.
|
| 48 | */
|
| 49 | public void processPacket(INetHandlerPlayClient handler)
|
| 50 | {
|
| 51 | handler.handleEntityMovement(this);
|
| 52 | }
|
| 53 |
|
| 54 | public String toString()
|
| 55 | {
|
| 56 | return "Entity_" + super.toString();
|
| 57 | }
|
| 58 |
|
| 59 | public Entity getEntity(World worldIn)
|
| 60 | {
|
| 61 | return worldIn.getEntityByID(this.entityId);
|
| 62 | }
|
| 63 |
|
| 64 | public byte func_149062_c()
|
| 65 | {
|
| 66 | return this.posX;
|
| 67 | }
|
| 68 |
|
| 69 | public byte func_149061_d()
|
| 70 | {
|
| 71 | return this.posY;
|
| 72 | }
|
| 73 |
|
| 74 | public byte func_149064_e()
|
| 75 | {
|
| 76 | return this.posZ;
|
| 77 | }
|
| 78 |
|
| 79 | public byte func_149066_f()
|
| 80 | {
|
| 81 | return this.yaw;
|
| 82 | }
|
| 83 |
|
| 84 | public byte func_149063_g()
|
| 85 | {
|
| 86 | return this.pitch;
|
| 87 | }
|
| 88 |
|
| 89 | public boolean func_149060_h()
|
| 90 | {
|
| 91 | return this.field_149069_g;
|
| 92 | }
|
| 93 |
|
| 94 | public boolean getOnGround()
|
| 95 | {
|
| 96 | return this.onGround;
|
| 97 | }
|
| 98 |
|
| 99 | public static class S15PacketEntityRelMove extends S14PacketEntity
|
| 100 | {
|
| 101 | public S15PacketEntityRelMove()
|
| 102 | {
|
| 103 | }
|
| 104 |
|
| 105 | public S15PacketEntityRelMove(int entityIdIn, byte x, byte y, byte z, boolean onGroundIn)
|
| 106 | {
|
| 107 | super(entityIdIn);
|
| 108 | this.posX = x;
|
| 109 | this.posY = y;
|
| 110 | this.posZ = z;
|
| 111 | this.onGround = onGroundIn;
|
| 112 | }
|
| 113 |
|
| 114 | public void readPacketData(PacketBuffer buf) throws IOException
|
| 115 | {
|
| 116 | super.readPacketData(buf);
|
| 117 | this.posX = buf.readByte();
|
| 118 | this.posY = buf.readByte();
|
| 119 | this.posZ = buf.readByte();
|
| 120 | this.onGround = buf.readBoolean();
|
| 121 | }
|
| 122 |
|
| 123 | public void writePacketData(PacketBuffer buf) throws IOException
|
| 124 | {
|
| 125 | super.writePacketData(buf);
|
| 126 | buf.writeByte(this.posX);
|
| 127 | buf.writeByte(this.posY);
|
| 128 | buf.writeByte(this.posZ);
|
| 129 | buf.writeBoolean(this.onGround);
|
| 130 | }
|
| 131 | }
|
| 132 |
|
| 133 | public static class S16PacketEntityLook extends S14PacketEntity
|
| 134 | {
|
| 135 | public S16PacketEntityLook()
|
| 136 | {
|
| 137 | this.field_149069_g = true;
|
| 138 | }
|
| 139 |
|
| 140 | public S16PacketEntityLook(int entityIdIn, byte yawIn, byte pitchIn, boolean onGroundIn)
|
| 141 | {
|
| 142 | super(entityIdIn);
|
| 143 | this.yaw = yawIn;
|
| 144 | this.pitch = pitchIn;
|
| 145 | this.field_149069_g = true;
|
| 146 | this.onGround = onGroundIn;
|
| 147 | }
|
| 148 |
|
| 149 | public void readPacketData(PacketBuffer buf) throws IOException
|
| 150 | {
|
| 151 | super.readPacketData(buf);
|
| 152 | this.yaw = buf.readByte();
|
| 153 | this.pitch = buf.readByte();
|
| 154 | this.onGround = buf.readBoolean();
|
| 155 | }
|
| 156 |
|
| 157 | public void writePacketData(PacketBuffer buf) throws IOException
|
| 158 | {
|
| 159 | super.writePacketData(buf);
|
| 160 | buf.writeByte(this.yaw);
|
| 161 | buf.writeByte(this.pitch);
|
| 162 | buf.writeBoolean(this.onGround);
|
| 163 | }
|
| 164 | }
|
| 165 |
|
| 166 | public static class S17PacketEntityLookMove extends S14PacketEntity
|
| 167 | {
|
| 168 | public S17PacketEntityLookMove()
|
| 169 | {
|
| 170 | this.field_149069_g = true;
|
| 171 | }
|
| 172 |
|
| 173 | public S17PacketEntityLookMove(int p_i45973_1_, byte p_i45973_2_, byte p_i45973_3_, byte p_i45973_4_, byte p_i45973_5_, byte p_i45973_6_, boolean p_i45973_7_)
|
| 174 | {
|
| 175 | super(p_i45973_1_);
|
| 176 | this.posX = p_i45973_2_;
|
| 177 | this.posY = p_i45973_3_;
|
| 178 | this.posZ = p_i45973_4_;
|
| 179 | this.yaw = p_i45973_5_;
|
| 180 | this.pitch = p_i45973_6_;
|
| 181 | this.onGround = p_i45973_7_;
|
| 182 | this.field_149069_g = true;
|
| 183 | }
|
| 184 |
|
| 185 | public void readPacketData(PacketBuffer buf) throws IOException
|
| 186 | {
|
| 187 | super.readPacketData(buf);
|
| 188 | this.posX = buf.readByte();
|
| 189 | this.posY = buf.readByte();
|
| 190 | this.posZ = buf.readByte();
|
| 191 | this.yaw = buf.readByte();
|
| 192 | this.pitch = buf.readByte();
|
| 193 | this.onGround = buf.readBoolean();
|
| 194 | }
|
| 195 |
|
| 196 | public void writePacketData(PacketBuffer buf) throws IOException
|
| 197 | {
|
| 198 | super.writePacketData(buf);
|
| 199 | buf.writeByte(this.posX);
|
| 200 | buf.writeByte(this.posY);
|
| 201 | buf.writeByte(this.posZ);
|
| 202 | buf.writeByte(this.yaw);
|
| 203 | buf.writeByte(this.pitch);
|
| 204 | buf.writeBoolean(this.onGround);
|
| 205 | }
|
| 206 | }
|
| 207 | }
|
| 208 |
|