Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 113 lines 2.9 kB view raw
1package net.minecraft.server; 2 3import java.io.DataInputStream; 4import java.io.DataOutputStream; 5import java.io.IOException; 6 7public class Packet23VehicleSpawn extends Packet { 8 9 public int a; 10 public int b; 11 public int c; 12 public int d; 13 public int e; 14 public int f; 15 public int g; 16 public int h; 17 public int i; 18 19 public Packet23VehicleSpawn() { 20 } 21 22 public Packet23VehicleSpawn(Entity entity, int i) { 23 this(entity, i, 0); 24 } 25 26 public Packet23VehicleSpawn(Entity entity, int i, int j) { 27 this.a = entity.id; 28 this.b = MathHelper.floor(entity.locX * 32.0D); 29 this.c = MathHelper.floor(entity.locY * 32.0D); 30 this.d = MathHelper.floor(entity.locZ * 32.0D); 31 this.h = i; 32 this.i = j; 33 if (j > 0) { 34 double d0 = entity.motX; 35 double d1 = entity.motY; 36 double d2 = entity.motZ; 37 double d3 = 3.9D; 38 39 if (d0 < -d3) { 40 d0 = -d3; 41 } 42 43 if (d1 < -d3) { 44 d1 = -d3; 45 } 46 47 if (d2 < -d3) { 48 d2 = -d3; 49 } 50 51 if (d0 > d3) { 52 d0 = d3; 53 } 54 55 if (d1 > d3) { 56 d1 = d3; 57 } 58 59 if (d2 > d3) { 60 d2 = d3; 61 } 62 63 this.e = (int) (d0 * 8000.0D); 64 this.f = (int) (d1 * 8000.0D); 65 this.g = (int) (d2 * 8000.0D); 66 } 67 } 68 69 public void a(DataInputStream datainputstream) throws IOException { 70 this.a = datainputstream.readInt(); 71 this.h = datainputstream.readByte(); 72 this.b = datainputstream.readInt(); 73 this.c = datainputstream.readInt(); 74 this.d = datainputstream.readInt(); 75 // uberbukkit 76 if (this.pvn >= 13) { 77 this.i = datainputstream.readInt(); 78 if (this.i > 0) { 79 this.e = datainputstream.readShort(); 80 this.f = datainputstream.readShort(); 81 this.g = datainputstream.readShort(); 82 } 83 } else { 84 this.i = 0; 85 } 86 } 87 88 public void a(DataOutputStream dataoutputstream) throws IOException { 89 dataoutputstream.writeInt(this.a); 90 dataoutputstream.writeByte(this.h); 91 dataoutputstream.writeInt(this.b); 92 dataoutputstream.writeInt(this.c); 93 dataoutputstream.writeInt(this.d); 94 // uberbukkit 95 if (this.pvn >= 13) { 96 dataoutputstream.writeInt(this.i); 97 if (this.i > 0) { 98 dataoutputstream.writeShort(this.e); 99 dataoutputstream.writeShort(this.f); 100 dataoutputstream.writeShort(this.g); 101 } 102 } 103 } 104 105 public void a(NetHandler nethandler) { 106 nethandler.a(this); 107 } 108 109 public int a() { 110 // uberbukkit 111 return this.pvn >= 13 ? (21 + this.i > 0 ? 6 : 0) : 17; 112 } 113}