log dimension changes

This commit is contained in:
əlemi 2021-11-12 12:23:05 +01:00
parent 1b4430f71e
commit 9327b77c3c

View file

@ -9,6 +9,7 @@ from .dispatcher import Dispatcher, ConnectionState
from .mc.mctypes import VarInt from .mc.mctypes import VarInt
from .mc.packet import Packet from .mc.packet import Packet
from .mc.identity import Token, AuthException from .mc.identity import Token, AuthException
from .mc.definitions import Dimension, Difficulty, Gamemode
from .mc import proto, encryption from .mc import proto, encryption
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
@ -282,6 +283,14 @@ class Client:
keep_alive_packet = proto.play.serverbound.packet_keep_alive.PacketKeepAlive(340, keepAliveId=packet.keepAliveId) keep_alive_packet = proto.play.serverbound.packet_keep_alive.PacketKeepAlive(340, keepAliveId=packet.keepAliveId)
await self.dispatcher.write(keep_alive_packet) await self.dispatcher.write(keep_alive_packet)
elif isinstance(packet, proto.play.clientbound.PacketRespawn):
self._logger.info(
"Loading dimension: %s (%s) in %s",
Dimension(packet.dimension).name,
Difficulty(packet.difficulty).name,
Gamemode(packet.gamemode).name
)
elif isinstance(packet, proto.play.clientbound.PacketPosition): elif isinstance(packet, proto.play.clientbound.PacketPosition):
self._logger.info("Position synchronized") self._logger.info("Position synchronized")
await self.dispatcher.write( await self.dispatcher.write(