2012-01-17 23:26:20 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
2012-07-29 09:33:13 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2012-01-17 23:26:20 +01:00
|
|
|
import java.io.IOException; // CraftBukkit
|
|
|
|
|
|
|
|
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;
|
2012-07-29 09:33:13 +02:00
|
|
|
private DataWatcher i;
|
|
|
|
private List j;
|
2012-01-17 23:26:20 +01:00
|
|
|
|
|
|
|
public Packet20NamedEntitySpawn() {}
|
|
|
|
|
|
|
|
public Packet20NamedEntitySpawn(EntityHuman entityhuman) {
|
|
|
|
this.a = entityhuman.id;
|
|
|
|
|
|
|
|
// CraftBukkit start - limit name length to 16 characters
|
|
|
|
if (entityhuman.name.length() > 16) {
|
|
|
|
this.b = entityhuman.name.substring(0, 16);
|
2012-07-22 08:18:00 +02:00
|
|
|
} else {
|
2012-01-17 23:26:20 +01:00
|
|
|
this.b = entityhuman.name;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
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;
|
2012-07-29 09:33:13 +02:00
|
|
|
this.i = entityhuman.getDataWatcher();
|
2012-01-17 23:26:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
|
|
|
|
this.a = datainputstream.readInt();
|
|
|
|
this.b = a(datainputstream, 16);
|
|
|
|
this.c = datainputstream.readInt();
|
|
|
|
this.d = datainputstream.readInt();
|
|
|
|
this.e = datainputstream.readInt();
|
|
|
|
this.f = datainputstream.readByte();
|
|
|
|
this.g = datainputstream.readByte();
|
|
|
|
this.h = datainputstream.readShort();
|
2012-07-29 09:33:13 +02:00
|
|
|
this.j = DataWatcher.a(datainputstream);
|
2012-01-17 23:26:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
|
|
|
|
dataoutputstream.writeInt(this.a);
|
|
|
|
a(this.b, dataoutputstream);
|
|
|
|
dataoutputstream.writeInt(this.c);
|
|
|
|
dataoutputstream.writeInt(this.d);
|
|
|
|
dataoutputstream.writeInt(this.e);
|
|
|
|
dataoutputstream.writeByte(this.f);
|
|
|
|
dataoutputstream.writeByte(this.g);
|
|
|
|
dataoutputstream.writeShort(this.h);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.i.a(dataoutputstream);
|
2012-01-17 23:26:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void handle(NetHandler nethandler) {
|
|
|
|
nethandler.a(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int a() {
|
|
|
|
return 28;
|
|
|
|
}
|
|
|
|
}
|