From 5202b2e6df3b353aafe04fef557fc348e17bd885 Mon Sep 17 00:00:00 2001 From: joo Date: Thu, 28 Apr 2016 04:01:24 +0100 Subject: [PATCH] Add support for Minecraft 1.9.1 (protocol 108) and 1.9.2 (protocol 109). --- minecraft/__init__.py | 4 ++++ minecraft/networking/packets.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/minecraft/__init__.py b/minecraft/__init__.py index 4ee6c48..7c013f0 100644 --- a/minecraft/__init__.py +++ b/minecraft/__init__.py @@ -8,6 +8,8 @@ __version__ = "0.1.0" SUPPORTED_PROTOCOL_VERSIONS = ( 47, 107, + 108, + 109, ) SUPPORTED_MINECRAFT_VERSIONS = { @@ -21,4 +23,6 @@ SUPPORTED_MINECRAFT_VERSIONS = { '1.8.7': 47, '1.8.8': 47, '1.9': 107, + '1.9.1': 108, + '1.9.2': 109, } diff --git a/minecraft/networking/packets.py b/minecraft/networking/packets.py index 3fff58d..009ab10 100644 --- a/minecraft/networking/packets.py +++ b/minecraft/networking/packets.py @@ -287,14 +287,14 @@ class JoinGamePacket(Packet): 0x23 if context.protocol_version >= 107 else 0x01) packet_name = "join game" - definition = [ + get_definition = staticmethod(lambda context: [ {'entity_id': Integer}, {'game_mode': UnsignedByte}, - {'dimension': Byte}, + {'dimension': Integer if context.protocol_version >= 108 else Byte}, {'difficulty': UnsignedByte}, {'max_players': UnsignedByte}, {'level_type': String}, - {'reduced_debug_info': Boolean}] + {'reduced_debug_info': Boolean}]) class ChatMessagePacket(Packet):