From bbbd3fb195de0ac8fdac426f77a2837d14a09031 Mon Sep 17 00:00:00 2001 From: joodicator Date: Fri, 16 Aug 2019 00:16:41 +0200 Subject: [PATCH] Add pre-release versions for 1.14.3 and 1.14.4 --- minecraft/__init__.py | 22 ++++++++++++++++++---- minecraft/networking/connection.py | 12 ++++++------ tests/fake_server.py | 4 ++-- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/minecraft/__init__.py b/minecraft/__init__.py index be86a21..06e4a3a 100644 --- a/minecraft/__init__.py +++ b/minecraft/__init__.py @@ -6,8 +6,11 @@ with a MineCraft server. # The version number of the most recent pyCraft release. __version__ = "0.6.0" -# A dict mapping the name of each Minecraft version supported by pyCraft to -# the corresponding protocol version number. +# A dict mapping the ID string of each Minecraft version supported by pyCraft +# to the corresponding protocol version number. The ID string of a version is +# the key used to identify it in +# , or the 'id' +# key in "version.json" in the corresponding ".jar" file distributed by Mojang. SUPPORTED_MINECRAFT_VERSIONS = { '1.8': 47, '1.8.1': 47, @@ -181,15 +184,26 @@ SUPPORTED_MINECRAFT_VERSIONS = { '1.14.2 Pre-Release 3': 483, '1.14.2 Pre-Release 4': 484, '1.14.2': 485, + '1.14.3-pre1': 486, + '1.14.3-pre2': 487, + '1.14.3-pre3': 488, + '1.14.3-pre4': 489, '1.14.3': 490, + '1.14.4-pre1': 491, + '1.14.4-pre2': 492, + '1.14.4-pre3': 493, + '1.14.4-pre4': 494, + '1.14.4-pre5': 495, + '1.14.4-pre6': 496, + '1.14.4-pre7': 497, '1.14.4': 498, } # Those Minecraft versions supported by pyCraft which are "release" versions, # i.e. not development snapshots or pre-release versions. RELEASE_MINECRAFT_VERSIONS = { - name: protocol for (name, protocol) in SUPPORTED_MINECRAFT_VERSIONS.items() - if __import__('re').match(r'\d+(\.\d+)+$', name)} + vid: protocol for (vid, protocol) in SUPPORTED_MINECRAFT_VERSIONS.items() + if __import__('re').match(r'\d+(\.\d+)+$', vid)} # The protocol versions of SUPPORTED_MINECRAFT_VERSIONS, without duplicates, # in ascending numerical (and hence chronological) order. diff --git a/minecraft/networking/connection.py b/minecraft/networking/connection.py index f78f10c..f696743 100644 --- a/minecraft/networking/connection.py +++ b/minecraft/networking/connection.py @@ -73,13 +73,13 @@ class Connection(object): object. If None, no authentication is attempted and the server is assumed to be running in offline mode. :param username: Username string; only applicable in offline mode. - :param initial_version: A Minecraft version string or protocol version - number to use if the server's protocol version - cannot be determined. (Although it is now - somewhat inaccurate, this name is retained for - backward compatibility.) + :param initial_version: A Minecraft version ID string or protocol + version number to use if the server's protocol + version cannot be determined. (Although it is + now somewhat inaccurate, this name is retained + for backward compatibility.) :param allowed_versions: A set of versions, each being a Minecraft - version string or protocol version number, + version ID string or protocol version number, restricting the versions that the client may use in connecting to the server. :param handle_exception: The final exception handler. This is triggered diff --git a/tests/fake_server.py b/tests/fake_server.py index 9893b81..90aafc1 100644 --- a/tests/fake_server.py +++ b/tests/fake_server.py @@ -422,10 +422,10 @@ class _FakeServerTest(unittest.TestCase): """ server_version = VERSIONS[-1] - # The Minecraft version name that the server will support. + # The Minecraft version ID that the server will support. client_versions = None - # The set of Minecraft version names or protocol version numbers that the + # The set of Minecraft version IDs or protocol version numbers that the # client will support. If None, the client supports all possible versions. server_type = FakeServer