From 261684ea90df169acfff27192df28603c369bf40 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 7 May 2021 04:13:36 +0000 Subject: [PATCH] Handle entity rotation packets --- mosfet/game.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mosfet/game.py b/mosfet/game.py index 8be3e5e..0f863a5 100644 --- a/mosfet/game.py +++ b/mosfet/game.py @@ -49,6 +49,7 @@ class Game: register(self.handle_spawn_living, SpawnLivingEntityPacket) register(self.handle_entity_position, clientbound.play.EntityPositionDeltaPacket) register(self.handle_entity_position_rotation, EntityPositionRotationPacket) + register(self.handle_entity_look, clientbound.play.EntityLookPacket) register(self.handle_destroy_entities, DestroyEntitiesPacket) register(self.handle_spawn_player, clientbound.play.SpawnPlayerPacket) register(self.handle_respawn, clientbound.play.RespawnPacket) @@ -442,8 +443,14 @@ class Game: player.x += packet.delta_x / 4096.0 player.y += packet.delta_y / 4096.0 player.z += packet.delta_z / 4096.0 + player.yaw = packet.yaw + player.pitch = packet.pitch - #if player.player_uuid == '0c123cfa-1697-4427-9413-4b645dee7ec0': print(packet) + def handle_entity_look(self, packet): + player = self.g.players.get(packet.entity_id, None) + if player: + player.yaw = packet.yaw + player.pitch = packet.pitch def handle_entity_teleport(self, packet): mob = self.g.mobs.get(packet.entity_id, None)