From 61d9695226f6c05bc00184ec4adb3aea031ac30a Mon Sep 17 00:00:00 2001 From: TheSnoozer Date: Tue, 19 Sep 2017 18:30:51 -0400 Subject: [PATCH] support 1.12.2 --- README.rst | 2 +- minecraft/__init__.py | 3 +++ minecraft/networking/packets/keep_alive_packet.py | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 20354a9..7da46d0 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ pyCraft is compatible with the following Minecraft releases: * 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4 * 1.10, 1.10.1, 1.10.2 * 1.11, 1.11.1, 1.11.2 -* 1.12, 1.12.1 +* 1.12, 1.12.1, 1.12.2 In addition, some development snapshots and pre-release versions are supported: ``_ contains a full list of supported Minecraft versions diff --git a/minecraft/__init__.py b/minecraft/__init__.py index 8b980bf..26a5ada 100644 --- a/minecraft/__init__.py +++ b/minecraft/__init__.py @@ -64,6 +64,9 @@ SUPPORTED_MINECRAFT_VERSIONS = { '17w31a': 336, '1.12.1-pre1': 337, '1.12.1': 338, + '1.12.2-pre1': 339, + '1.12.2-pre2': 339, + '1.12.2': 340, } SUPPORTED_PROTOCOL_VERSIONS = sorted(SUPPORTED_MINECRAFT_VERSIONS.values()) diff --git a/minecraft/networking/packets/keep_alive_packet.py b/minecraft/networking/packets/keep_alive_packet.py index e762d63..71287d7 100644 --- a/minecraft/networking/packets/keep_alive_packet.py +++ b/minecraft/networking/packets/keep_alive_packet.py @@ -1,11 +1,13 @@ from .packet import Packet from minecraft.networking.types import ( - VarInt + VarInt, Long ) class KeepAlivePacket(Packet): packet_name = "keep alive" - definition = [ - {'keep_alive_id': VarInt}] + get_definition = staticmethod(lambda context: [ + {'keep_alive_id': Long} if context.protocol_version >= 339 + else {'keep_alive_id': VarInt} + ])