From 13f9418201d07e9b1440c3e1038bd8539fe64416 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Sun, 13 Jan 2019 11:51:03 -0600 Subject: [PATCH] Send head yaw, use setPositionAndRotation --- .../fml/network/FMLPlayMessages.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java index 733f0e8ea..01d0eb456 100644 --- a/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java +++ b/src/main/java/net/minecraftforge/fml/network/FMLPlayMessages.java @@ -39,7 +39,7 @@ public class FMLPlayMessages private final int entityId; private final UUID uuid; private final double posX, posY, posZ; - private final byte pitch, yaw; + private final byte pitch, yaw, headYaw; private final short velX, velY, velZ; private final PacketBuffer buf; @@ -54,6 +54,7 @@ public class FMLPlayMessages this.posZ = e.posZ; this.pitch = (byte) MathHelper.floor(e.rotationPitch * 256.0F / 360.0F); this.yaw = (byte) MathHelper.floor(e.rotationYaw * 256.0F / 360.0F); + this.headYaw = (byte) (e.getRotationYawHead() * 256.0F / 360.0F); this.velX = (short)(MathHelper.clamp(e.motionX, -3.9D, 3.9D) * 8000.0D); this.velY = (short)(MathHelper.clamp(e.motionY, -3.9D, 3.9D) * 8000.0D); this.velZ = (short)(MathHelper.clamp(e.motionZ, -3.9D, 3.9D) * 8000.0D); @@ -61,7 +62,7 @@ public class FMLPlayMessages } private SpawnEntity(int typeId, int entityId, UUID uuid, double posX, double posY, double posZ, - byte pitch, byte yaw, short velX, short velY, short velZ, PacketBuffer buf) + byte pitch, byte yaw, byte headYaw, short velX, short velY, short velZ, PacketBuffer buf) { this.entity = null; this.typeId = typeId; @@ -72,6 +73,7 @@ public class FMLPlayMessages this.posZ = posZ; this.pitch = pitch; this.yaw = yaw; + this.headYaw = headYaw; this.velX = velX; this.velY = velY; this.velZ = velZ; @@ -89,6 +91,7 @@ public class FMLPlayMessages buf.writeDouble(msg.posZ); buf.writeByte(msg.pitch); buf.writeByte(msg.yaw); + buf.writeByte(msg.headYaw); buf.writeShort(msg.velX); buf.writeShort(msg.velY); buf.writeShort(msg.velZ); @@ -105,7 +108,7 @@ public class FMLPlayMessages buf.readInt(), new UUID(buf.readLong(), buf.readLong()), buf.readDouble(), buf.readDouble(), buf.readDouble(), - buf.readByte(), buf.readByte(), + buf.readByte(), buf.readByte(), buf.readByte(), buf.readShort(), buf.readShort(), buf.readShort(), buf ); @@ -127,8 +130,9 @@ public class FMLPlayMessages } EntityTracker.updateServerPosition(e, msg.posX, msg.posY, msg.posZ); - e.rotationPitch = (float)(msg.pitch * 360) / 256.0F; - e.rotationYaw = (float)(msg.yaw * 360) / 256.0F; + e.setPositionAndRotation(msg.posX, msg.posY, msg.posZ, (msg.pitch * 360) / 256.0F, (msg.yaw * 360) / 256.0F); + e.setRotationYawHead((msg.headYaw * 360) / 256.0F); + e.setRenderYawOffset((msg.headYaw * 360) / 256.0F); Entity[] parts = e.getParts(); if (parts != null)