package net.minecraft.server; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public class Packet20NamedEntitySpawn extends Packet { public int a; public String b; public int c; public int d; public int e; public byte f; public byte g; public int h; public Packet20NamedEntitySpawn() { } public Packet20NamedEntitySpawn(EntityHuman entityhuman) { this.a = entityhuman.id; this.b = entityhuman.name; this.c = MathHelper.floor(entityhuman.locX * 32.0D); this.d = MathHelper.floor(entityhuman.locY * 32.0D); this.e = MathHelper.floor(entityhuman.locZ * 32.0D); this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F)); this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F)); ItemStack itemstack = entityhuman.inventory.getItemInHand(); this.h = itemstack == null ? 0 : itemstack.id; } public void a(DataInputStream datainputstream) throws IOException { this.a = datainputstream.readInt(); // uberbukkit if (this.pvn >= 11) { this.b = a(datainputstream, 16); } else { this.b = datainputstream.readUTF(); } this.c = datainputstream.readInt(); this.d = datainputstream.readInt(); this.e = datainputstream.readInt(); this.f = datainputstream.readByte(); this.g = datainputstream.readByte(); this.h = datainputstream.readShort(); } public void a(DataOutputStream dataoutputstream) throws IOException { dataoutputstream.writeInt(this.a); // uberbukkit if (this.pvn >= 11) { a(this.b, dataoutputstream); } else { dataoutputstream.writeUTF(this.b); } dataoutputstream.writeInt(this.c); dataoutputstream.writeInt(this.d); dataoutputstream.writeInt(this.e); dataoutputstream.writeByte(this.f); dataoutputstream.writeByte(this.g); dataoutputstream.writeShort(this.h); } public void a(NetHandler nethandler) { nethandler.a(this); } public int a() { return 28; } }