Commit Graph

10 Commits

Author SHA1 Message Date
joo b79f8b30eb Remove support for Python 2.7 2020-08-17 07:10:10 +02:00
joodicator a03e1a7c47 Fix: MutableRecord interprets __slots__ incorrectly (issue #133) 2019-07-03 19:53:30 +02:00
joodicator e3d2b1a368 Improve metadata and auxiliary methods of existing packets.
* Add multi-attribute aliases to some packets, for user convenience.
* Add support for writing PlayerListItemPacket.
* Add 'fields' attributes to manually-read/written packet classes,
  implementing 'field_string' where appropriate to allow enable the
  default __repr__ implementation.
* Modify data constructors where appropriate so that __repr__
  implementations match their constructor protocols.
* Improve comments on type aliases within packet classes.
* Add/modify tests to cover the new functionality.
2019-06-08 15:39:24 +02: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 d24b6eaded Update SoundEffectPacket and UseItemPacket to 1.14; misc improvements 2019-05-13 21:58:59 +02:00
joodicator e4f8b5583a Fix: networking.types.utility.__all__ is incorrect. 2019-05-13 21:24:41 +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 bea2222c58 Fix: MutableRecord.__ne__ misspelt as '__neq__'.
Add tests for MutableRecord and Position.
2018-06-21 07:06:45 +01:00
joo 4b6feda1cb Various improvements to utility types:
- Add operations for Vector.
- Move some tests into test_utility_types.py.
- Add tests for PositionAndLook and Vector.
2018-06-21 06:39:55 +01:00
joo 61598eba75 Divide minecraft.networking.types into multiple modules. 2018-06-20 09:54:17 +01:00