1.16.5 NMS entity body rotation

Discussion in 'Spigot Plugin Development' started by Lolok, Jun 5, 2021.

  1. When I summon an NMS villager that only a player could see through PacketPlayOutSpawnEntityLiving the villager always has yaw at 0.0, as the body didn't rotate. I tried setLocation, setPositionRotation and setYawPitch but nothing works... how can I rotate the body of an NMS entity before showing it?
     
  2. I use villager.getControllerLook().a(lookAtLocation.getX(), lookAtLocation.getY(), lookAtLocation.getZ()); for custom entities.
    In your case you may want to look at the field float aC

    keep in mind that head rotation requires PacketPlayOutEntityHeadRotation
     
  3. You need two packets:
    PacketPlayOutEntityLook - Control body rotation
    PacketPlayOutEntityHeadRotation - Control head rotation
     
    • Like Like x 1