Begin 26.3 protocol support
This commit is contained in:
1 parent
bcd156e83b
commit
faff7a0bf5
5 files changed
+391
-4
No files matched your search
@@ -8,6 +8,7 @@ import select
|
||||
import sys
|
||||
import json
|
||||
import re
|
||||
import os
|
||||
|
||||
from .types import VarInt
|
||||
from .packets import clientbound, serverbound
|
||||
@@ -335,6 +336,10 @@ class Connection(object):
|
||||
for listener in self.early_outgoing_packet_listeners:
|
||||
listener.call_packet(packet)
|
||||
|
||||
if self.context.protocol_version >= 777 and os.getenv('PYCRAFT_TRACE'):
|
||||
print('[pyCraft/777] TX state={} id=0x{:02x} packet={}'.format(
|
||||
type(self.reactor).__name__, packet.id,
|
||||
packet.packet_name), flush=True)
|
||||
if self.options.compression_enabled:
|
||||
packet.write(self.socket, self.options.compression_threshold)
|
||||
else:
|
||||
@@ -409,8 +414,20 @@ class Connection(object):
|
||||
login_start_packet.name = self.auth_token.profile.name
|
||||
else:
|
||||
login_start_packet.name = self.username
|
||||
if self.context.protocol_version >= 759:
|
||||
import hashlib
|
||||
import uuid
|
||||
raw_uuid = hashlib.md5(
|
||||
('OfflinePlayer:' + login_start_packet.name).encode('utf-8')
|
||||
).digest()
|
||||
login_start_packet.player_uuid = str(
|
||||
uuid.UUID(bytes=raw_uuid, version=3))
|
||||
self.write_packet(login_start_packet)
|
||||
self.reactor = LoginReactor(self)
|
||||
if self.context.protocol_version >= 777:
|
||||
from .modern import ModernLoginReactor
|
||||
self.reactor = ModernLoginReactor(self)
|
||||
else:
|
||||
self.reactor = LoginReactor(self)
|
||||
else:
|
||||
# Determine the server's protocol version by first performing a
|
||||
# status query.
|
||||
@@ -687,6 +704,10 @@ class PacketReactor(object):
|
||||
packet_data.reset_cursor()
|
||||
|
||||
packet_id = VarInt.read(packet_data)
|
||||
if self.connection.context.protocol_version >= 777 and os.getenv('PYCRAFT_TRACE'):
|
||||
print('[pyCraft/777] RX state={} id=0x{:02x} bytes={}'.format(
|
||||
type(self).__name__, packet_id,
|
||||
len(packet_data.get_writable())), flush=True)
|
||||
|
||||
# If we know the structure of the packet, attempt to parse it
|
||||
# otherwise, just return an instance of the base Packet class.
|
||||
|
||||
Reference in new issue
Block a user