2021-09-30 17:05:54 +02:00
# aiocraft
2023-11-20 17:50:53 +01:00
**an asyncio-driven headless client library for block game with packet definitions**
2023-11-20 19:25:50 +01:00
aiocraft is a collection of types, definitions and utils to build minecraft clients without the official Java implementation
2023-11-20 17:50:53 +01:00
2023-11-20 19:25:50 +01:00
it is built on top of [PrismarineJS/minecraft-data ](https://github.com/PrismarineJS/minecraft-data ), which contains definitions for all types across all versions
2023-11-20 17:50:53 +01:00
2024-02-20 15:57:11 +01:00
aiocraft provides a raw implementation of a client but it isn't ready to be used, if you're looking for a convenient client library take a look at ** [Treepuncher ](https://git.alemi.dev/treepuncher.git/about )**
2023-11-20 17:50:53 +01:00
## Packets
2023-11-20 19:25:50 +01:00
the whole Minecraft protocol from `0.30c` to `1.19.3` is compiled and available
feature flags to only include certain protocol versions are planned
all types and packets are instantiable and serializable on all supported protocols:
2023-11-20 23:19:09 +01:00
```py
2023-11-20 23:22:36 +01:00
from aiocraft.proto.play.serverbound import PacketPosition
2023-11-20 23:19:09 +01:00
2023-11-20 23:22:36 +01:00
a_packet = PacketPosition(x=-4.0, y=64.0, z=10.5, onGround=True)
2023-11-20 17:50:53 +01:00
await client.dispatcher.write(a_packet)
```
## Client
2024-02-20 15:57:11 +01:00
an abstract client implementation is provided, but it's supposed to be extended (like in ** [Treepuncher ](https://git.alemi.dev/treepuncher.git/about )**)
2023-11-20 19:25:50 +01:00
the abstract client implements flows for all game phases and both a `.join()` or a `.info()` method to easily start the login flow
2023-11-20 17:50:53 +01:00
## Types
aiocraft defines these minecraft types:
* `Dimension`
* `Difficulty`
* `Gamemode`
* `GameProfile`
* `Enchantment`
* `BlockPos`
* `Item` (without constants)
* `Texture`
* `Player`
more types are planned but still not generated:
* `Entity`
* `Block`
* `Item` (with constants)
## World
2023-11-20 19:25:50 +01:00
a chunk parser is provided with native code (Rust + PyO3). It is pretty fast but the abstract client doesn't make use of it
2023-11-20 17:50:53 +01:00