Commit Graph

87 Commits

Author SHA1 Message Date
joo
252e60a6e2 Add support for Minecraft 20w45a to 20w48a (protocol 2^30+5 to 2^30+7). 2020-12-02 16:27:28 +01:00
joo
969419da3f Fix: non-monotonic protocol versions are not correctly handled
After 1.16.3, Mojang started publishing snapshot, pre-release and release
candidate versions of Minecraft with protocol version numbers of the form
`(1 << 30) | n' where 'n' is a small non-negative integer increasing with each
such version; the release versions continued to use the old format. For
example, these are the last 8 published Minecraft versions as of this commit:

release           1.16.3      uses protocol version 753
pre-release       1.16.4-pre1 uses protocol version 1073741825 == (1 << 30) | 1
pre-release       1.16.4-pre2 uses protocol version 1073741826 == (1 << 30) | 2
release candidate 1.16.4-rc1  uses protocol version 1073741827 == (1 << 30) | 3
release           1.16.4      uses protocol version 754
snapshot          20w45a      uses protocol version 1073741829 == (1 << 30) | 5
snapshot          20w46a      uses protocol version 1073741830 == (1 << 30) | 6
snapshot          20w48a      uses protocol version 1073741831 == (1 << 30) | 7

This means that protocol versions no longer increase monotonically with respect
to publication history, a property that was assumed to hold in much of
pyCraft's code relating to support of multiple protocol versions. This commit
rectifies the issue by replacing any comparison of protocol versions by their
numerical value with a comparison based on their publication time.

Newly defined is the dictionary `minecraft.PROTOCOL_VERSION_INDICES', which
maps each known protocol version to its index in the protocol chronology. As
such, the bound method `minecraft.PROTOCOL_VERSION_INDICES.get` can be used as
a key function for the built-in `sorted`, `min` and `max` functions to collate
protocol versions chronologically.

Two utility functions are provided for direct comparison of protocol versions:
    `minecraft.utility.protocol_earlier` and
    `minecraft.utility.protocol_earlier_eq`.

Additionally, four methods are added to the `ConnectionContext` type to ease
the most common cases where the protocol of a given context must be compared to
a given version number:
    `minecraft.connection.ConnectionContext.protocol_earlier`,
    `minecraft.connection.ConnectionContext.protocol_earlier_eq`,
    `minecraft.connection.ConnectionContext.protocol_later` and
    `minecraft.connection.ConnectionContext.protocol_later_eq`.
2020-12-02 15:11:39 +01:00
Vesek
4a4b699b85 Add support for Minecraft 1.16.4-pre1, 1.16.4-pre2, 1.16.4-rc1 and 1.16.4 (protocols 1073741825, 1073741826, 1073741827 and 754) 2020-12-01 05:20:30 +01:00
joo
903c20f9e2 Add support for Minecraft 1.16.3-pre1 and 1.16.3 (protocols 752 and 753) 2020-09-12 07:02:22 +02:00
joo
3f4a5d46a6 Update README with supported versions; increment package version 2020-08-17 11:31:02 +02:00
joo
4c35517157 Fix support for Minecraft 20w06a to 1.16.2 (protocols 701 to 751) 2020-08-17 11:25:30 +02:00
Sillyfrog
8a098b399b Support for v1.16.2 2020-08-13 22:19:04 +10:00
Sillyfrog
3dcefae645 v1.16.1 support 2020-06-26 17:46:33 +10:00
Sillyfrog
0d28271c96 v1.16 release support 2020-06-24 13:50:29 +10:00
Sillyfrog
b582029099 Support for 1.16-rc1 2020-06-19 09:18:29 +10:00
Tristan Gosselin-Hane
9c08c6c9f5 Added support for snapshots 20w20a and 20w20b 2020-05-14 21:37:25 -04:00
Tristan Gosselin-Hane
d26aacec28 Added support for snapshot 20w19a 2020-05-07 11:58:08 -04:00
Tristan Gosselin-Hane
8cb02e7f7f Added support for snapshot 20w18a 2020-05-04 12:04:04 -04:00
Tristan Gosselin-Hane
180c698ce1 Added support for snapshot 20w17a 2020-04-22 16:36:19 -04:00
Tristan Gosselin-Hane
7380bc2c61 Added support for snapshots 20w13b, 20w14a, 20w15a, 20w16a 2020-04-17 00:07:41 -04:00
Tristan Gosselin-Hane
428a599f40 Added support for snapshot 20w13a 2020-04-16 20:54:51 -04:00
Tristan Gosselin-Hane
76f7b4bdc9 Added support for snapshot 20w12a 2020-03-20 15:00:31 -04:00
Tristan Gosselin-Hane
5c6edf5e44 Added support for snapshot versions up to 20w11a 2020-03-17 00:23:35 -04:00
joo
ff9a0813b6 Add support for 1.15.2-pre1 to 1.15.2 (protocols 576 to 578) 2020-01-23 18:02:10 +01:00
joo
b38adc1aa1 Add pre-release versions between 1.14.4 and 1.15.1; update test config 2020-01-08 16:15:42 +01:00
Sillyfrog
51c618aeb5 Support v1.15.1 2019-12-23 21:53:16 -05:00
Sillyfrog
e1afabcba5 Add support for v1.15 2019-12-23 21:53:10 -05:00
joodicator
bbbd3fb195 Add pre-release versions for 1.14.3 and 1.14.4 2019-08-16 00:16:41 +02:00
Jim Chen
c80cfd50fe
Upgrade to 1.14.4(Same Packet Format) 2019-07-26 09:10:35 +08:00
Sillyfrog
d90f08c503 Update to v1.14.3 (same packet format) 2019-06-25 15:13:17 +02:00
joodicator
234e57716c Increment package version to 0.6.0 2019-05-29 18:47:14 +02:00
joodicator
d1e1da85c8 Declare support for 1.14.2 pre-releases 1-4 (481-484); update README 2019-05-29 18:26:06 +02:00
Sillyfrog
6d9d15845a Support for 1.14.2 (same packet format) 2019-05-29 15:37:25 +10:00
joodicator
7b1567c352 Improve test coverage wrt protocol versions; other fixes/improvements
Improvements to the test suite:
* List release version names and numbers in minecraft/__init__.py.
* Make some tests, which previously ran for *all* protocol versions,
  run only for release protocol versions (to improve test performance).
* Make some tests, which previously ran only for the latest protocol
  version, run for all release protocol versions (to improve coverage).
* Print each protocol version being tested to the debug log, to help
  identify sources of errors.
* Use the `nose-timer' plugin to show the run time of each test.

Fix errors revealed by increased test coverage:
* Fix: SoundEffectPacket.Pitch is not serialised correctly for early
  protocol versions.
* Fix: handleExceptionTest finishes later than necessary because
  the test overrode an exception handler used internally by
  `_FakeServerTest', causing the server thread to time out after 4s.
* Add support for multiple exception handlers in `Connection'
  (required for the above).

Improvements to data descriptors:
* Make syntax of property declarations more consistent/Pythonic.
* Factor the definition of several aliasing properties into the
  utility methods `attribute_alias' and `multi_attribute_alias',
  which construct suitable data descriptors.
* Define and use the named tuple `Direction' for (pitch, yaw) values.
2019-05-14 18:41:58 +02:00
joodicator
b3cf00a856 Add support for Minecraft 1.14.1 Pre Release 1 to 1.14.1 (protocols 478 to 480) 2019-05-13 22:25:40 +02:00
joodicator
612fa8e324 Add support for Minecraft 18w43a to 1.14 (protocols 441 to 477)
This commit introduces two backward-incompatible changes which may break
existing code:

(1) `networking.packets.clientbound.play.SpawnObjectPacket.EntityType'
is no longer accessible as an attribute of the the `SpawnObjectPacket'
class: the values now depend on a `ConnectionContext`, and must be
accessed through an instance, or using `SpawnObjectPacket.field_enum'.
See the text of the `AttributeError` raised from the descriptor for
`SpawnObjectPacket.EntityType` for the full details.

(2) For some subclasses of `networking.types.Type', it is necessary to
call the methods `read_with_context' and `send_with_context' instead of
`read' and `send', supplying a `ConnectionContext' for those data types
- currently only `Position` - whose layout depends on it.
2019-05-11 08:43:51 +02:00
joo
527f3d3146 Add support for Minecraft 1.13.2-pre1, 1.13.2-pre2 and 1.13.2 (protocols 402 to 404). 2018-10-26 19:58:20 +01:00
joo
0eec179f48 Add support for Minecraft 1.13.1 and 1.13.1-pre2 (protocols 400 to 401). 2018-08-23 07:42:28 +01:00
joo
720868fab7 Add support for Minecraft 18w80a to 1.13.1-pre1 (protocols 394 to 399). 2018-08-19 18:11:12 +01:00
joo
adc8d15ddc Add support for Minecraft 1.13 and 1.13-pre3 to pre10 (protocols 385 to 393).
Add clientbound.login.PluginRequestPacket and serverbound.login.PluginResponsePacket.
2018-07-19 09:50:13 +01:00
joo
201e075591 Add support for Minecraft pre-release 1.13-pre2 (protocol 384). 2018-06-20 09:50:20 +01:00
joo
0a1776f97a Add support for Minecraft versions 18w22a to 1.13-pre1 (protocols 380 to 383). 2018-06-05 01:14:19 +01:00
joo
f22447b97a Add support for Minecraft snapshot 18w21b (protocol 379). 2018-05-25 19:35:32 +01:00
joo
bbf7200220 Add support for Minecraft snapshot 18w21a (protocol 378). 2018-05-24 12:59:06 +01:00
joo
52c0671f4f Add support for Minecraft snapshots 18w03a-18w20c (protocol 354-377). 2018-05-20 06:58:23 +01:00
joo
f492adfeff Add support for Minecraft snapshots 17w43a-18w02a (protocol 341-353).
Add support declaration for Minecraft version 1.8.9 (protocol 47).
2018-01-13 01:12:28 +00:00
joo
1766b30983 Remove duplicates from SUPPORTED_PROTOCOL_VERSIONS. 2018-01-07 23:56:31 +00:00
TheSnoozer
61d9695226 support 1.12.2 2017-09-19 18:30:51 -04:00
joo
9e7e75f9a7 Increment package version to 0.5.0. 2017-08-03 19:08:36 +01:00
joo
33cd42848e Add version data for Minecraft 1.12.1 (protocol 338). 2017-08-03 18:48:36 +01:00
joo
5aa2d3df59 Add support for Minecraft 17w31a and 1.12.1-pre1 (protocols 336 and 337). 2017-08-03 18:31:00 +01:00
joo
991f0b3da6 Increment package version to 0.4.0. 2017-06-09 09:25:56 +01:00
joo
8d1dcec3e2 Add version data for Minecraft 1.12 (protocol 335). 2017-06-07 22:06:01 +01:00
joo
bcf22b8312 Add version data for Minecraft pre-release 1.12-pre7 (protocol 334). 2017-06-02 21:32:11 +01:00
joo
0cc96f7dc5 Add version data for Minecraft pre-release 1.12-pre6 (protocol 333). 2017-05-29 17:31:04 +01:00