fix wrong angle encoding

This commit is contained in:
p2r3
2025-08-12 16:51:59 +03:00
parent 3b9ca68a57
commit 8daefc4f1f
2 changed files with 3 additions and 3 deletions

2
main.c
View File

@@ -170,7 +170,7 @@ void handlePacket (int client_fd, int length, int packet_id) {
player->y = cy;
player->z = cz;
if (packet_id == 0x1E) {
player->yaw = yaw / 180.0f * 127.0f;
player->yaw = (short)yaw % 180 * 127 / 180;
player->pitch = pitch / 90.0f * 127.0f;
}

View File

@@ -37,8 +37,8 @@ typedef struct {
short x;
short y;
short z;
uint8_t yaw;
uint8_t pitch;
int8_t yaw;
int8_t pitch;
uint8_t hotbar;
uint16_t inventory_items[41];
uint8_t inventory_count[41];