Add support for Minecraft pre-release 1.12-pre5 (protocol 332).

This commit is contained in:
joo 2017-05-20 04:17:52 +01:00
parent a1570bd3a9
commit b7290cf327
2 changed files with 15 additions and 7 deletions

View File

@ -57,6 +57,7 @@ SUPPORTED_MINECRAFT_VERSIONS = {
'1.12-pre2': 329,
'1.12-pre3': 330,
'1.12-pre4': 331,
'1.12-pre5': 332,
}
SUPPORTED_PROTOCOL_VERSIONS = sorted(SUPPORTED_MINECRAFT_VERSIONS.values())

View File

@ -293,7 +293,8 @@ class KeepAlivePacket(Packet):
class KeepAlivePacketClientbound(KeepAlivePacket):
@staticmethod
def get_id(context):
return 0x20 if context.protocol_version >= 318 else \
return 0x1F if context.protocol_version >= 332 else \
0x20 if context.protocol_version >= 318 else \
0x1F if context.protocol_version >= 107 else \
0x00
@ -309,7 +310,8 @@ class KeepAlivePacketServerbound(KeepAlivePacket):
class JoinGamePacket(Packet):
@staticmethod
def get_id(context):
return 0x24 if context.protocol_version >= 318 else \
return 0x23 if context.protocol_version >= 332 else \
0x24 if context.protocol_version >= 318 else \
0x23 if context.protocol_version >= 107 else \
0x01
@ -327,7 +329,8 @@ class JoinGamePacket(Packet):
class ChatMessagePacket(Packet):
@staticmethod
def get_id(context):
return 0x10 if context.protocol_version >= 317 else \
return 0x0F if context.protocol_version >= 332 else \
0x10 if context.protocol_version >= 317 else \
0x0F if context.protocol_version >= 107 else \
0x02
@ -403,7 +406,8 @@ class PlayerPositionAndLookPacket(Packet):
class DisconnectPacketPlayState(Packet):
@staticmethod
def get_id(context):
return 0x1B if context.protocol_version >= 318 else \
return 0x1A if context.protocol_version >= 332 else \
0x1B if context.protocol_version >= 318 else \
0x1A if context.protocol_version >= 107 else \
0x40
@ -424,7 +428,8 @@ class SetCompressionPacketPlayState(Packet):
class PlayerListItemPacket(Packet):
@staticmethod
def get_id(context):
return 0x2E if context.protocol_version >= 318 else \
return 0x2D if context.protocol_version >= 332 else \
0x2E if context.protocol_version >= 318 else \
0x2D if context.protocol_version >= 107 else \
0x38
@ -731,7 +736,8 @@ class ChatPacket(Packet):
class PositionAndLookPacket(Packet):
@staticmethod
def get_id(context):
return 0x0E if context.protocol_version >= 318 else \
return 0x0F if context.protocol_version >= 332 else \
0x0E if context.protocol_version >= 318 else \
0x0D if context.protocol_version >= 107 else \
0x06
@ -756,7 +762,8 @@ class TeleportConfirmPacket(Packet):
class AnimationPacketServerbound(Packet):
@staticmethod
def get_id(context):
return 0x1C if context.protocol_version >= 318 else \
return 0x1D if context.protocol_version >= 332 else \
0x1C if context.protocol_version >= 318 else \
0x1A if context.protocol_version >= 107 else \
0x0A