mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-12-24 01:27:52 +01:00
Add support for Minecraft pre-release 16w36a (protocol 305).
Add max_length property to ChatPacket.
This commit is contained in:
parent
41394126ab
commit
c4ed8e6d68
@ -26,6 +26,7 @@ SUPPORTED_MINECRAFT_VERSIONS = {
|
||||
'16w33a': 303,
|
||||
'16w35a': 304,
|
||||
'16w36a': 305,
|
||||
'16w38a': 306,
|
||||
}
|
||||
|
||||
SUPPORTED_PROTOCOL_VERSIONS = sorted(SUPPORTED_MINECRAFT_VERSIONS.values())
|
||||
|
@ -86,9 +86,12 @@ class Packet(object):
|
||||
@context.setter
|
||||
def context(self, _context):
|
||||
self._context = _context
|
||||
if _context is not None:
|
||||
self.id = self.get_id(_context)
|
||||
self.definition = self.get_definition(_context)
|
||||
self._context_changed()
|
||||
|
||||
def _context_changed(self):
|
||||
if self._context is not None:
|
||||
self.id = self.get_id(self._context)
|
||||
self.definition = self.get_definition(self._context)
|
||||
else:
|
||||
self.id = None
|
||||
self.definition = None
|
||||
@ -700,6 +703,16 @@ class ChatPacket(Packet):
|
||||
return 0x02 if context.protocol_version >= 107 else \
|
||||
0x01
|
||||
|
||||
@staticmethod
|
||||
def get_max_length(context):
|
||||
return 256 if context.protocol_version >= 305 else \
|
||||
100
|
||||
|
||||
@property
|
||||
def max_length(self):
|
||||
if self.context is not None:
|
||||
return self.get_max_length(self.context)
|
||||
|
||||
packet_name = "chat"
|
||||
definition = [
|
||||
{'message': String}]
|
||||
|
Loading…
Reference in New Issue
Block a user