Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 77 lines 2.3 kB view raw
1package net.minecraft.server; 2 3import java.io.DataInputStream; 4import java.io.DataOutputStream; 5import java.io.IOException; 6import java.util.List; 7 8public class Packet24MobSpawn extends Packet { 9 10 public int a; 11 public byte b; 12 public int c; 13 public int d; 14 public int e; 15 public byte f; 16 public byte g; 17 private DataWatcher h; 18 private List i; 19 20 public Packet24MobSpawn() { 21 } 22 23 public Packet24MobSpawn(EntityLiving entityliving) { 24 this.a = entityliving.id; 25 this.b = (byte) EntityTypes.a(entityliving); 26 this.c = MathHelper.floor(entityliving.locX * 32.0D); 27 this.d = MathHelper.floor(entityliving.locY * 32.0D); 28 this.e = MathHelper.floor(entityliving.locZ * 32.0D); 29 this.f = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); 30 this.g = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); 31 this.h = entityliving.aa(); 32 } 33 34 public void a(DataInputStream datainputstream) throws IOException { 35 this.a = datainputstream.readInt(); 36 this.b = datainputstream.readByte(); 37 this.c = datainputstream.readInt(); 38 this.d = datainputstream.readInt(); 39 this.e = datainputstream.readInt(); 40 this.f = datainputstream.readByte(); 41 this.g = datainputstream.readByte(); 42 // uberbukkit 43 if (this.pvn >= 8) { 44 this.i = DataWatcher.a(datainputstream); 45 } else { 46 this.i = null; 47 } 48 } 49 50 public void a(DataOutputStream dataoutputstream) throws IOException { 51 dataoutputstream.writeInt(this.a); 52 53 byte entityType = this.b; 54 // uberbukkit - a1.1.2_01 doesn't recognize cows and sheep 55 if (this.pvn <= 2 && (this.b == 92 || this.b == 93)) entityType = 91; 56 57 dataoutputstream.writeByte(entityType); 58 dataoutputstream.writeInt(this.c); 59 dataoutputstream.writeInt(this.d); 60 dataoutputstream.writeInt(this.e); 61 dataoutputstream.writeByte(this.f); 62 dataoutputstream.writeByte(this.g); 63 // uberbukkit 64 if (this.pvn >= 8) { 65 this.h.a(dataoutputstream); 66 } 67 } 68 69 public void a(NetHandler nethandler) { 70 nethandler.a(this); 71 } 72 73 public int a() { 74 // uberbukkit 75 return this.pvn >= 8 ? 20 : 19; 76 } 77}