pyCraft/minecraft/networking/packets/keep_alive_packet.py

18 lines
422 B
Python
Raw Normal View History

2017-08-08 23:49:20 +02:00
from .packet import Packet
from minecraft.networking.types import (
2017-09-20 00:30:51 +02:00
VarInt, Long
2017-08-08 23:49:20 +02:00
)
class AbstractKeepAlivePacket(Packet):
2017-08-08 23:49:20 +02:00
packet_name = "keep alive"
2017-09-20 00:30:51 +02:00
get_definition = staticmethod(lambda context: [
{'keep_alive_id': Long} if context.protocol_version >= 339
else {'keep_alive_id': VarInt}
])
# This alias is retained for backward compatibility:
KeepAlivePacket = AbstractKeepAlivePacket