1.17.x PacketPlayOutEntityTeleport Seems to Ignore Yaw

Discussion in 'Spigot Plugin Development' started by pollitoyeye, Jun 13, 2021.

  1. I am trying to set the location and yaw of a "fake entity" that was spawned using packets.
    In older versions calling setLocation on the nms entity would work but now it seems to ignore the yaw.
    Did anything change in 1.17 respecting to this? The pitch seems to work tho.
    This is my current code, most of the variables are reflection but it's pretty easy to understand what they are.
    Code (Text):
    setLocationMethod.invoke(nmsEntity, new Object[] { loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), 0 });
    Object packet = packetPlayOutEntityTeleportConstructor.newInstance(new Object[] { nmsEntity });
    Object entityPlayer = getHandlePlayer.invoke(CraftPlayerClass.cast(p), new Object[] {});
    Object playerConnection = playerConnectionField.get(entityPlayer);
    sendPacketMethod.invoke(playerConnection, new Object[] { packet });
    Edit:
    I checked the values inside the packet. It seems to have relation with the yaw but it doesn't seem to work.
    For Yaw = -2 E = -1
    For Yaw = 180, E = 127
    For Yaw = 90, E = 64
    For Yaw = 272, E = -63
     
    #1 pollitoyeye, Jun 13, 2021
    Last edited: Jun 14, 2021
  2. Solved this sending a PacketPlayOutEntityHeadRotation packet too.
    PacketPlayOutEntityTeleport doesn't seem to be working correctly with yaw.
     
    • Useful Useful x 1