Only send the teleport packet if its a painting disguise

This commit is contained in:
libraryaddict 2014-06-16 04:56:00 +12:00
parent eb78492fcf
commit afaf6c16e6

View File

@ -316,16 +316,17 @@ public class PacketsManager {
spawnPackets[0].getModifier().write(2, (int) Math.floor(loc.getY() * 32D));
spawnPackets[0].getModifier().write(8, yaw);
// Make the teleport packet to make it visible..
spawnPackets[1] = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
StructureModifier<Object> mods = spawnPackets[1].getModifier();
mods.write(0, disguisedEntity.getEntityId());
mods.write(1, (int) Math.floor(loc.getX() * 32D));
mods.write(2, (int) Math.floor(loc.getY() * 32D));
mods.write(3, (int) Math.floor(loc.getZ() * 32D));
mods.write(4, yaw);
mods.write(5, pitch);
if (disguise.getType() == DisguiseType.PAINTING) {
// Make the teleport packet to make it visible..
spawnPackets[1] = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
StructureModifier<Object> mods = spawnPackets[1].getModifier();
mods.write(0, disguisedEntity.getEntityId());
mods.write(1, (int) Math.floor(loc.getX() * 32D));
mods.write(2, (int) Math.floor(loc.getY() * 32D));
mods.write(3, (int) Math.floor(loc.getZ() * 32D));
mods.write(4, yaw);
mods.write(5, pitch);
}
}
if (spawnPackets[1] == null) {
// Make a packet to turn his head!