diff --git a/forge/forge_client/src/net/minecraft/src/forge/PacketHandlerClient.java b/forge/forge_client/src/net/minecraft/src/forge/PacketHandlerClient.java index 1e697f0ba..c26cbacff 100644 --- a/forge/forge_client/src/net/minecraft/src/forge/PacketHandlerClient.java +++ b/forge/forge_client/src/net/minecraft/src/forge/PacketHandlerClient.java @@ -85,9 +85,12 @@ public class PacketHandlerClient implements IPacketHandler double posX = (double)packet.posX / 32D; double posY = (double)packet.posY / 32D; double posZ = (double)packet.posZ / 32D; + float yaw = (float)(packet.yaw * 360) / 256.0F; + float pitch = (float)(packet.pitch * 360) / 256.0F; + float yawHead = (float)(packet.yawHead * 360) / 256.0F; try { - Entity entity = (Entity)(cls.getConstructor(World.class, double.class, double.class, double.class).newInstance(world, posX, posY, posZ)); + Entity entity = (Entity)(cls.getConstructor(World.class).newInstance(world)); if (entity instanceof IThrowableEntity) { Minecraft mc = ModLoader.getMinecraftInstance(); @@ -95,11 +98,9 @@ public class PacketHandlerClient implements IPacketHandler ((IThrowableEntity)entity).setThrower(thrower); } - entity.serverPosX = packet.posX; - entity.serverPosY = packet.posY; - entity.serverPosZ = packet.posZ; - entity.rotationYaw = 0.0F; - entity.rotationPitch = 0.0F; + entity.serverPosX = packet.posX; + entity.serverPosY = packet.posY; + entity.serverPosZ = packet.posZ; Entity parts[] = entity.getParts(); if (parts != null) @@ -112,6 +113,17 @@ public class PacketHandlerClient implements IPacketHandler } entity.entityId = packet.entityID; + entity.setPositionAndRotation(posX, posY, posZ, yaw, pitch); + + if (entity instanceof EntityLiving) + { + ((EntityLiving)entity).rotationYawHead = yawHead; + } + + if (packet.metadata != null) + { + entity.getDataWatcher().updateWatchedObjectsFromList((List)packet.metadata); + } if (packet.throwerID > 0) { diff --git a/forge/forge_common/net/minecraft/src/forge/packets/PacketEntitySpawn.java b/forge/forge_common/net/minecraft/src/forge/packets/PacketEntitySpawn.java index 8d6ed7e71..6b79ec8a7 100644 --- a/forge/forge_common/net/minecraft/src/forge/packets/PacketEntitySpawn.java +++ b/forge/forge_common/net/minecraft/src/forge/packets/PacketEntitySpawn.java @@ -5,6 +5,8 @@ import java.io.DataOutputStream; import java.io.IOException; import net.minecraft.src.Entity; +import net.minecraft.src.EntityLiving; +import net.minecraft.src.DataWatcher; import net.minecraft.src.MathHelper; import net.minecraft.src.forge.ISpawnHandler; import net.minecraft.src.forge.IThrowableEntity; @@ -13,16 +15,20 @@ import net.minecraft.src.forge.NetworkMod; public class PacketEntitySpawn extends ForgePacket { + public int modID; public int entityID; + public int typeID; public int posX; public int posY; public int posZ; + public byte yaw; + public byte pitch; + public byte yawHead; + public int throwerID; public int speedX; public int speedY; public int speedZ; - public int typeID; - public int modID; - public int throwerID; + public Object metadata; private ISpawnHandler handler; public PacketEntitySpawn(){} @@ -37,6 +43,11 @@ public class PacketEntitySpawn extends ForgePacket typeID = type; modID = MinecraftForge.getModID(mod); + yaw = (byte)(ent.rotationYaw * 256.0F / 360.0F); + pitch = (byte)(ent.rotationPitch * 256.0F / 360.0F); + yawHead = (byte)(ent instanceof EntityLiving ? ((EntityLiving)ent).rotationYawHead * 256.0F / 360.0F : 0); + metadata = ent.getDataWatcher(); + if (ent instanceof IThrowableEntity) { Entity owner = ((IThrowableEntity)ent).getThrower(); @@ -68,6 +79,10 @@ public class PacketEntitySpawn extends ForgePacket data.writeInt(posX); data.writeInt(posY); data.writeInt(posZ); + data.writeByte(yaw); + data.writeByte(pitch); + data.writeByte(yawHead); + ((DataWatcher)metadata).writeWatchableObjects(data); data.writeInt(throwerID); if (throwerID != 0) { @@ -89,6 +104,10 @@ public class PacketEntitySpawn extends ForgePacket posX = data.readInt(); posY = data.readInt(); posZ = data.readInt(); + yaw = data.readByte(); + pitch = data.readByte(); + yawHead = data.readByte(); + metadata = DataWatcher.readWatchableObjects(data); throwerID = data.readInt(); if (throwerID != 0) {