Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 75 lines 2.2 kB view raw
1package net.minecraft.server; 2 3import java.io.DataInputStream; 4import java.io.DataOutputStream; 5import java.io.IOException; 6 7public class Packet20NamedEntitySpawn extends Packet { 8 9 public int a; 10 public String b; 11 public int c; 12 public int d; 13 public int e; 14 public byte f; 15 public byte g; 16 public int h; 17 18 public Packet20NamedEntitySpawn() { 19 } 20 21 public Packet20NamedEntitySpawn(EntityHuman entityhuman) { 22 this.a = entityhuman.id; 23 this.b = entityhuman.name; 24 this.c = MathHelper.floor(entityhuman.locX * 32.0D); 25 this.d = MathHelper.floor(entityhuman.locY * 32.0D); 26 this.e = MathHelper.floor(entityhuman.locZ * 32.0D); 27 this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F)); 28 this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F)); 29 ItemStack itemstack = entityhuman.inventory.getItemInHand(); 30 31 this.h = itemstack == null ? 0 : itemstack.id; 32 } 33 34 public void a(DataInputStream datainputstream) throws IOException { 35 this.a = datainputstream.readInt(); 36 // uberbukkit 37 if (this.pvn >= 11) { 38 this.b = a(datainputstream, 16); 39 } else { 40 this.b = datainputstream.readUTF(); 41 } 42 43 this.c = datainputstream.readInt(); 44 this.d = datainputstream.readInt(); 45 this.e = datainputstream.readInt(); 46 this.f = datainputstream.readByte(); 47 this.g = datainputstream.readByte(); 48 this.h = datainputstream.readShort(); 49 } 50 51 public void a(DataOutputStream dataoutputstream) throws IOException { 52 dataoutputstream.writeInt(this.a); 53 // uberbukkit 54 if (this.pvn >= 11) { 55 a(this.b, dataoutputstream); 56 } else { 57 dataoutputstream.writeUTF(this.b); 58 } 59 60 dataoutputstream.writeInt(this.c); 61 dataoutputstream.writeInt(this.d); 62 dataoutputstream.writeInt(this.e); 63 dataoutputstream.writeByte(this.f); 64 dataoutputstream.writeByte(this.g); 65 dataoutputstream.writeShort(this.h); 66 } 67 68 public void a(NetHandler nethandler) { 69 nethandler.a(this); 70 } 71 72 public int a() { 73 return 28; 74 } 75}