From f238d902fa3493e5f37341558cbc6da769064034 Mon Sep 17 00:00:00 2001 From: alemidev Date: Sun, 15 May 2022 13:02:53 +0200 Subject: [PATCH] Changed build system to maturin to add rust extensions This meant moving the python source out of src/ . I dislike this project structure but will do for now while I think of something better. setup.cfg is no longer needed and all options are either in pyproject.toml or Cargo.toml. I still need to figure out a lot of stuff. Co-authored-by: f-tlm --- .../mc/chunk/Cargo.toml => Cargo.toml | 11 +- aiocraft/__init__.py | 12 + aiocraft/aiocraft.pyi | 13 + {src/aiocraft => aiocraft}/client.py | 0 {src/aiocraft => aiocraft}/dispatcher.py | 0 {src/aiocraft => aiocraft}/mc/__init__.py | 0 .../aiocraft => aiocraft}/mc/auth/__init__.py | 0 .../mc/auth/interface.py | 0 .../mc/auth/microsoft.py | 0 {src/aiocraft => aiocraft}/mc/auth/mojang.py | 0 {src/aiocraft => aiocraft}/mc/chunk.py | 0 {src/aiocraft => aiocraft}/mc/definitions.py | 0 {src/aiocraft => aiocraft}/mc/packet.py | 0 .../mc/proto/__init__.py | 0 .../mc/proto/handshaking/__init__.py | 0 .../proto/handshaking/clientbound/__init__.py | 0 .../proto/handshaking/serverbound/__init__.py | 0 .../packet_legacy_server_list_ping.py | 0 .../serverbound/packet_set_protocol.py | 0 .../mc/proto/login/__init__.py | 0 .../mc/proto/login/clientbound/__init__.py | 0 .../login/clientbound/packet_compress.py | 0 .../login/clientbound/packet_disconnect.py | 0 .../clientbound/packet_encryption_begin.py | 0 .../packet_login_plugin_request.py | 0 .../proto/login/clientbound/packet_success.py | 0 .../mc/proto/login/serverbound/__init__.py | 0 .../serverbound/packet_encryption_begin.py | 0 .../packet_login_plugin_response.py | 0 .../login/serverbound/packet_login_start.py | 0 .../mc/proto/play/__init__.py | 0 .../mc/proto/play/clientbound/__init__.py | 0 .../play/clientbound/packet_abilities.py | 0 .../packet_acknowledge_player_digging.py | 0 .../play/clientbound/packet_action_bar.py | 0 .../packet_advancement_progress.py | 0 .../play/clientbound/packet_advancements.py | 0 .../play/clientbound/packet_animation.py | 0 .../play/clientbound/packet_attach_entity.py | 0 .../mc/proto/play/clientbound/packet_bed.py | 0 .../play/clientbound/packet_block_action.py | 0 .../packet_block_break_animation.py | 0 .../play/clientbound/packet_block_change.py | 0 .../proto/play/clientbound/packet_boss_bar.py | 0 .../proto/play/clientbound/packet_camera.py | 0 .../mc/proto/play/clientbound/packet_chat.py | 0 .../play/clientbound/packet_clear_titles.py | 0 .../play/clientbound/packet_close_window.py | 0 .../proto/play/clientbound/packet_collect.py | 0 .../play/clientbound/packet_combat_event.py | 0 .../clientbound/packet_craft_progress_bar.py | 0 .../packet_craft_recipe_response.py | 0 .../play/clientbound/packet_custom_payload.py | 0 .../clientbound/packet_death_combat_event.py | 0 .../clientbound/packet_declare_commands.py | 0 .../clientbound/packet_declare_recipes.py | 0 .../play/clientbound/packet_destroy_entity.py | 0 .../play/clientbound/packet_difficulty.py | 0 .../clientbound/packet_end_combat_event.py | 0 .../clientbound/packet_enter_combat_event.py | 0 .../proto/play/clientbound/packet_entity.py | 0 .../play/clientbound/packet_entity_destroy.py | 0 .../play/clientbound/packet_entity_effect.py | 0 .../clientbound/packet_entity_equipment.py | 0 .../packet_entity_head_rotation.py | 0 .../play/clientbound/packet_entity_look.py | 0 .../clientbound/packet_entity_metadata.py | 0 .../clientbound/packet_entity_move_look.py | 0 .../clientbound/packet_entity_sound_effect.py | 0 .../play/clientbound/packet_entity_status.py | 0 .../clientbound/packet_entity_teleport.py | 0 .../packet_entity_update_attributes.py | 0 .../clientbound/packet_entity_velocity.py | 0 .../play/clientbound/packet_experience.py | 0 .../play/clientbound/packet_explosion.py | 0 .../play/clientbound/packet_face_player.py | 0 .../clientbound/packet_game_state_change.py | 0 .../play/clientbound/packet_held_item_slot.py | 0 .../packet_initialize_world_border.py | 0 .../play/clientbound/packet_keep_alive.py | 0 .../clientbound/packet_kick_disconnect.py | 0 .../mc/proto/play/clientbound/packet_login.py | 0 .../mc/proto/play/clientbound/packet_map.py | 0 .../play/clientbound/packet_map_chunk.py | 0 .../play/clientbound/packet_map_chunk_bulk.py | 0 .../clientbound/packet_multi_block_change.py | 0 .../clientbound/packet_named_entity_spawn.py | 0 .../clientbound/packet_named_sound_effect.py | 0 .../clientbound/packet_nbt_query_response.py | 0 .../play/clientbound/packet_open_book.py | 0 .../clientbound/packet_open_horse_window.py | 0 .../clientbound/packet_open_sign_entity.py | 0 .../play/clientbound/packet_open_window.py | 0 .../mc/proto/play/clientbound/packet_ping.py | 0 .../play/clientbound/packet_player_info.py | 0 .../clientbound/packet_playerlist_header.py | 0 .../proto/play/clientbound/packet_position.py | 0 .../clientbound/packet_rel_entity_move.py | 0 .../packet_remove_entity_effect.py | 0 .../clientbound/packet_resource_pack_send.py | 0 .../proto/play/clientbound/packet_respawn.py | 0 .../packet_scoreboard_display_objective.py | 0 .../packet_scoreboard_objective.py | 0 .../clientbound/packet_scoreboard_score.py | 0 .../clientbound/packet_scoreboard_team.py | 0 .../packet_sculk_vibration_signal.py | 0 .../packet_select_advancement_tab.py | 0 .../clientbound/packet_set_compression.py | 0 .../play/clientbound/packet_set_cooldown.py | 0 .../play/clientbound/packet_set_passengers.py | 0 .../proto/play/clientbound/packet_set_slot.py | 0 .../clientbound/packet_set_title_subtitle.py | 0 .../play/clientbound/packet_set_title_text.py | 0 .../play/clientbound/packet_set_title_time.py | 0 .../clientbound/packet_simulation_distance.py | 0 .../play/clientbound/packet_sound_effect.py | 0 .../play/clientbound/packet_spawn_entity.py | 0 .../packet_spawn_entity_experience_orb.py | 0 .../clientbound/packet_spawn_entity_living.py | 0 .../packet_spawn_entity_painting.py | 0 .../packet_spawn_entity_weather.py | 0 .../play/clientbound/packet_spawn_position.py | 0 .../play/clientbound/packet_statistics.py | 0 .../play/clientbound/packet_stop_sound.py | 0 .../play/clientbound/packet_tab_complete.py | 0 .../mc/proto/play/clientbound/packet_tags.py | 0 .../mc/proto/play/clientbound/packet_teams.py | 0 .../clientbound/packet_tile_entity_data.py | 0 .../mc/proto/play/clientbound/packet_title.py | 0 .../play/clientbound/packet_trade_list.py | 0 .../play/clientbound/packet_transaction.py | 0 .../play/clientbound/packet_unload_chunk.py | 0 .../play/clientbound/packet_unlock_recipes.py | 0 .../clientbound/packet_update_attributes.py | 0 .../clientbound/packet_update_entity_nbt.py | 0 .../play/clientbound/packet_update_health.py | 0 .../play/clientbound/packet_update_light.py | 0 .../play/clientbound/packet_update_sign.py | 0 .../play/clientbound/packet_update_time.py | 0 .../packet_update_view_distance.py | 0 .../packet_update_view_position.py | 0 .../play/clientbound/packet_vehicle_move.py | 0 .../play/clientbound/packet_window_items.py | 0 .../play/clientbound/packet_world_border.py | 0 .../clientbound/packet_world_border_center.py | 0 .../packet_world_border_lerp_size.py | 0 .../clientbound/packet_world_border_size.py | 0 .../packet_world_border_warning_delay.py | 0 .../packet_world_border_warning_reach.py | 0 .../play/clientbound/packet_world_event.py | 0 .../clientbound/packet_world_particles.py | 0 .../mc/proto/play/serverbound/__init__.py | 0 .../play/serverbound/packet_abilities.py | 0 .../serverbound/packet_advancement_tab.py | 0 .../play/serverbound/packet_arm_animation.py | 0 .../play/serverbound/packet_block_dig.py | 0 .../play/serverbound/packet_block_place.py | 0 .../mc/proto/play/serverbound/packet_chat.py | 0 .../play/serverbound/packet_client_command.py | 0 .../play/serverbound/packet_close_window.py | 0 .../packet_craft_recipe_request.py | 0 .../serverbound/packet_crafting_book_data.py | 0 .../play/serverbound/packet_custom_payload.py | 0 .../serverbound/packet_displayed_recipe.py | 0 .../play/serverbound/packet_edit_book.py | 0 .../play/serverbound/packet_enchant_item.py | 0 .../play/serverbound/packet_entity_action.py | 0 .../proto/play/serverbound/packet_flying.py | 0 .../serverbound/packet_generate_structure.py | 0 .../play/serverbound/packet_held_item_slot.py | 0 .../play/serverbound/packet_keep_alive.py | 0 .../serverbound/packet_lock_difficulty.py | 0 .../mc/proto/play/serverbound/packet_look.py | 0 .../play/serverbound/packet_name_item.py | 0 .../play/serverbound/packet_pick_item.py | 0 .../mc/proto/play/serverbound/packet_pong.py | 0 .../proto/play/serverbound/packet_position.py | 0 .../play/serverbound/packet_position_look.py | 0 .../packet_prepare_crafting_grid.py | 0 .../serverbound/packet_query_block_nbt.py | 0 .../serverbound/packet_query_entity_nbt.py | 0 .../play/serverbound/packet_recipe_book.py | 0 .../packet_resource_pack_receive.py | 0 .../play/serverbound/packet_select_trade.py | 0 .../serverbound/packet_set_beacon_effect.py | 0 .../serverbound/packet_set_creative_slot.py | 0 .../play/serverbound/packet_set_difficulty.py | 0 .../proto/play/serverbound/packet_settings.py | 0 .../proto/play/serverbound/packet_spectate.py | 0 .../play/serverbound/packet_steer_boat.py | 0 .../play/serverbound/packet_steer_vehicle.py | 0 .../play/serverbound/packet_tab_complete.py | 0 .../serverbound/packet_teleport_confirm.py | 0 .../play/serverbound/packet_transaction.py | 0 .../packet_update_command_block.py | 0 .../packet_update_command_block_minecart.py | 0 .../serverbound/packet_update_jigsaw_block.py | 0 .../play/serverbound/packet_update_sign.py | 0 .../packet_update_structure_block.py | 0 .../play/serverbound/packet_use_entity.py | 0 .../proto/play/serverbound/packet_use_item.py | 0 .../play/serverbound/packet_vehicle_move.py | 0 .../play/serverbound/packet_window_click.py | 0 .../mc/proto/status/__init__.py | 0 .../mc/proto/status/clientbound/__init__.py | 0 .../proto/status/clientbound/packet_ping.py | 0 .../status/clientbound/packet_server_info.py | 0 .../mc/proto/status/serverbound/__init__.py | 0 .../proto/status/serverbound/packet_ping.py | 0 .../status/serverbound/packet_ping_start.py | 0 {src/aiocraft => aiocraft}/mc/types.py | 0 {src/aiocraft => aiocraft}/py.typed | 0 {src/aiocraft => aiocraft}/server.py | 0 {src/aiocraft => aiocraft}/util/__init__.py | 0 {src/aiocraft => aiocraft}/util/encryption.py | 0 {src/aiocraft => aiocraft}/util/helpers.py | 0 pyproject.toml | 54 +++- setup.cfg | 29 -- src/aiocraft/__init__.py | 7 - src/aiocraft/mc/chunk/src/lib.rs | 179 ---------- src/chunk.rs | 305 ++++++++++++++++++ src/lib.rs | 19 ++ 222 files changed, 407 insertions(+), 222 deletions(-) rename src/aiocraft/mc/chunk/Cargo.toml => Cargo.toml (51%) create mode 100644 aiocraft/__init__.py create mode 100644 aiocraft/aiocraft.pyi rename {src/aiocraft => aiocraft}/client.py (100%) rename {src/aiocraft => aiocraft}/dispatcher.py (100%) rename {src/aiocraft => aiocraft}/mc/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/auth/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/auth/interface.py (100%) rename {src/aiocraft => aiocraft}/mc/auth/microsoft.py (100%) rename {src/aiocraft => aiocraft}/mc/auth/mojang.py (100%) rename {src/aiocraft => aiocraft}/mc/chunk.py (100%) rename {src/aiocraft => aiocraft}/mc/definitions.py (100%) rename {src/aiocraft => aiocraft}/mc/packet.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/handshaking/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/handshaking/clientbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/handshaking/serverbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/handshaking/serverbound/packet_set_protocol.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/packet_compress.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/packet_disconnect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/packet_encryption_begin.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/packet_login_plugin_request.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/clientbound/packet_success.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/serverbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/serverbound/packet_encryption_begin.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/serverbound/packet_login_plugin_response.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/login/serverbound/packet_login_start.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_abilities.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_acknowledge_player_digging.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_action_bar.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_advancement_progress.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_advancements.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_animation.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_attach_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_bed.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_block_action.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_block_break_animation.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_block_change.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_boss_bar.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_camera.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_chat.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_clear_titles.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_close_window.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_collect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_combat_event.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_craft_progress_bar.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_craft_recipe_response.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_custom_payload.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_death_combat_event.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_declare_commands.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_declare_recipes.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_destroy_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_difficulty.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_end_combat_event.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_enter_combat_event.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_destroy.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_equipment.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_head_rotation.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_look.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_metadata.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_move_look.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_sound_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_status.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_teleport.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_update_attributes.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_entity_velocity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_experience.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_explosion.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_face_player.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_game_state_change.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_held_item_slot.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_initialize_world_border.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_keep_alive.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_kick_disconnect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_login.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_map.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_map_chunk.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_map_chunk_bulk.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_multi_block_change.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_named_entity_spawn.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_named_sound_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_nbt_query_response.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_open_book.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_open_horse_window.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_open_sign_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_open_window.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_ping.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_player_info.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_playerlist_header.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_position.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_rel_entity_move.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_remove_entity_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_resource_pack_send.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_respawn.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_scoreboard_display_objective.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_scoreboard_objective.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_scoreboard_score.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_scoreboard_team.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_sculk_vibration_signal.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_select_advancement_tab.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_compression.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_cooldown.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_passengers.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_slot.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_title_subtitle.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_title_text.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_set_title_time.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_simulation_distance.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_sound_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_entity_living.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_entity_painting.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_entity_weather.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_spawn_position.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_statistics.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_stop_sound.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_tab_complete.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_tags.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_teams.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_tile_entity_data.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_title.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_trade_list.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_transaction.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_unload_chunk.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_unlock_recipes.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_attributes.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_entity_nbt.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_health.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_light.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_sign.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_time.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_view_distance.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_update_view_position.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_vehicle_move.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_window_items.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border_center.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border_lerp_size.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border_size.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border_warning_delay.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_border_warning_reach.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_event.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/clientbound/packet_world_particles.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_abilities.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_advancement_tab.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_arm_animation.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_block_dig.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_block_place.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_chat.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_client_command.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_close_window.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_craft_recipe_request.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_crafting_book_data.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_custom_payload.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_displayed_recipe.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_edit_book.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_enchant_item.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_entity_action.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_flying.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_generate_structure.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_held_item_slot.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_keep_alive.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_lock_difficulty.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_look.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_name_item.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_pick_item.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_pong.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_position.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_position_look.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_prepare_crafting_grid.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_query_block_nbt.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_query_entity_nbt.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_recipe_book.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_resource_pack_receive.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_select_trade.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_set_beacon_effect.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_set_creative_slot.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_set_difficulty.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_settings.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_spectate.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_steer_boat.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_steer_vehicle.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_tab_complete.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_teleport_confirm.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_transaction.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_update_command_block.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_update_command_block_minecart.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_update_jigsaw_block.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_update_sign.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_update_structure_block.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_use_entity.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_use_item.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_vehicle_move.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/play/serverbound/packet_window_click.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/clientbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/clientbound/packet_ping.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/clientbound/packet_server_info.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/serverbound/__init__.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/serverbound/packet_ping.py (100%) rename {src/aiocraft => aiocraft}/mc/proto/status/serverbound/packet_ping_start.py (100%) rename {src/aiocraft => aiocraft}/mc/types.py (100%) rename {src/aiocraft => aiocraft}/py.typed (100%) rename {src/aiocraft => aiocraft}/server.py (100%) rename {src/aiocraft => aiocraft}/util/__init__.py (100%) rename {src/aiocraft => aiocraft}/util/encryption.py (100%) rename {src/aiocraft => aiocraft}/util/helpers.py (100%) delete mode 100644 setup.cfg delete mode 100644 src/aiocraft/__init__.py delete mode 100644 src/aiocraft/mc/chunk/src/lib.rs create mode 100644 src/chunk.rs create mode 100644 src/lib.rs diff --git a/src/aiocraft/mc/chunk/Cargo.toml b/Cargo.toml similarity index 51% rename from src/aiocraft/mc/chunk/Cargo.toml rename to Cargo.toml index b89af21..5d91443 100644 --- a/src/aiocraft/mc/chunk/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,17 @@ [package] -name = "chunk_unpacker" +name = "aiocraft" version = "1.0.0" edition = "2021" - [lib] -name = "chunk_unpacker" +name = "aiocraft" +path = "src/lib.rs" # The source file of the target. crate-type = ["cdylib"] [dependencies] +log = "0.4.17" +pyo3-log = "0.6.0" pyo3 = { version = "0.16.4", features = ["extension-module"] } + +[style] +use_tabs = true diff --git a/aiocraft/__init__.py b/aiocraft/__init__.py new file mode 100644 index 0000000..431b49a --- /dev/null +++ b/aiocraft/__init__.py @@ -0,0 +1,12 @@ +"""aiocraft is an asyncio-driven headless minecraft client""" +# from .client import Client +from .mc import * # TODO move mc out of mc + +from .client import MinecraftClient +from .server import MinecraftServer +from .mc.auth import MicrosoftAuthenticator, MojangAuthenticator + +from .aiocraft import * # This is needed for PyO3 functions! No clue why or how... + +__author__ = "alemidev" +__credits__ = "Thanks to pyCraft, really inspired this" diff --git a/aiocraft/aiocraft.pyi b/aiocraft/aiocraft.pyi new file mode 100644 index 0000000..a52e94d --- /dev/null +++ b/aiocraft/aiocraft.pyi @@ -0,0 +1,13 @@ +from typing import List, Optional, Iterable +def bit_pack(data:Iterable[int], bits:int, size:int): ... + +class Chunk: + def __init__(self, x: int, z: int, bitmask: int, ground_up_continuous: bool): ... + def read(self, chunk_data:List[int]): ... + def merge(self, other:'Chunk'): ... + +class World: + def __init__(self): ... + def get_block(self, x:int, y:int, z:int) -> Optional[int]: ... + def get(self, x:int, z:int) -> Optional[Chunk]: ... + def put(self, chunk:Chunk, x:int, z:int, merge:bool): ... diff --git a/src/aiocraft/client.py b/aiocraft/client.py similarity index 100% rename from src/aiocraft/client.py rename to aiocraft/client.py diff --git a/src/aiocraft/dispatcher.py b/aiocraft/dispatcher.py similarity index 100% rename from src/aiocraft/dispatcher.py rename to aiocraft/dispatcher.py diff --git a/src/aiocraft/mc/__init__.py b/aiocraft/mc/__init__.py similarity index 100% rename from src/aiocraft/mc/__init__.py rename to aiocraft/mc/__init__.py diff --git a/src/aiocraft/mc/auth/__init__.py b/aiocraft/mc/auth/__init__.py similarity index 100% rename from src/aiocraft/mc/auth/__init__.py rename to aiocraft/mc/auth/__init__.py diff --git a/src/aiocraft/mc/auth/interface.py b/aiocraft/mc/auth/interface.py similarity index 100% rename from src/aiocraft/mc/auth/interface.py rename to aiocraft/mc/auth/interface.py diff --git a/src/aiocraft/mc/auth/microsoft.py b/aiocraft/mc/auth/microsoft.py similarity index 100% rename from src/aiocraft/mc/auth/microsoft.py rename to aiocraft/mc/auth/microsoft.py diff --git a/src/aiocraft/mc/auth/mojang.py b/aiocraft/mc/auth/mojang.py similarity index 100% rename from src/aiocraft/mc/auth/mojang.py rename to aiocraft/mc/auth/mojang.py diff --git a/src/aiocraft/mc/chunk.py b/aiocraft/mc/chunk.py similarity index 100% rename from src/aiocraft/mc/chunk.py rename to aiocraft/mc/chunk.py diff --git a/src/aiocraft/mc/definitions.py b/aiocraft/mc/definitions.py similarity index 100% rename from src/aiocraft/mc/definitions.py rename to aiocraft/mc/definitions.py diff --git a/src/aiocraft/mc/packet.py b/aiocraft/mc/packet.py similarity index 100% rename from src/aiocraft/mc/packet.py rename to aiocraft/mc/packet.py diff --git a/src/aiocraft/mc/proto/__init__.py b/aiocraft/mc/proto/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/__init__.py rename to aiocraft/mc/proto/__init__.py diff --git a/src/aiocraft/mc/proto/handshaking/__init__.py b/aiocraft/mc/proto/handshaking/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/handshaking/__init__.py rename to aiocraft/mc/proto/handshaking/__init__.py diff --git a/src/aiocraft/mc/proto/handshaking/clientbound/__init__.py b/aiocraft/mc/proto/handshaking/clientbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/handshaking/clientbound/__init__.py rename to aiocraft/mc/proto/handshaking/clientbound/__init__.py diff --git a/src/aiocraft/mc/proto/handshaking/serverbound/__init__.py b/aiocraft/mc/proto/handshaking/serverbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/handshaking/serverbound/__init__.py rename to aiocraft/mc/proto/handshaking/serverbound/__init__.py diff --git a/src/aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py b/aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py similarity index 100% rename from src/aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py rename to aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py diff --git a/src/aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py b/aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py similarity index 100% rename from src/aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py rename to aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py diff --git a/src/aiocraft/mc/proto/login/__init__.py b/aiocraft/mc/proto/login/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/login/__init__.py rename to aiocraft/mc/proto/login/__init__.py diff --git a/src/aiocraft/mc/proto/login/clientbound/__init__.py b/aiocraft/mc/proto/login/clientbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/__init__.py rename to aiocraft/mc/proto/login/clientbound/__init__.py diff --git a/src/aiocraft/mc/proto/login/clientbound/packet_compress.py b/aiocraft/mc/proto/login/clientbound/packet_compress.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/packet_compress.py rename to aiocraft/mc/proto/login/clientbound/packet_compress.py diff --git a/src/aiocraft/mc/proto/login/clientbound/packet_disconnect.py b/aiocraft/mc/proto/login/clientbound/packet_disconnect.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/packet_disconnect.py rename to aiocraft/mc/proto/login/clientbound/packet_disconnect.py diff --git a/src/aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py b/aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py rename to aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py diff --git a/src/aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py b/aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py rename to aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py diff --git a/src/aiocraft/mc/proto/login/clientbound/packet_success.py b/aiocraft/mc/proto/login/clientbound/packet_success.py similarity index 100% rename from src/aiocraft/mc/proto/login/clientbound/packet_success.py rename to aiocraft/mc/proto/login/clientbound/packet_success.py diff --git a/src/aiocraft/mc/proto/login/serverbound/__init__.py b/aiocraft/mc/proto/login/serverbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/login/serverbound/__init__.py rename to aiocraft/mc/proto/login/serverbound/__init__.py diff --git a/src/aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py b/aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py similarity index 100% rename from src/aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py rename to aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py diff --git a/src/aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py b/aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py similarity index 100% rename from src/aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py rename to aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py diff --git a/src/aiocraft/mc/proto/login/serverbound/packet_login_start.py b/aiocraft/mc/proto/login/serverbound/packet_login_start.py similarity index 100% rename from src/aiocraft/mc/proto/login/serverbound/packet_login_start.py rename to aiocraft/mc/proto/login/serverbound/packet_login_start.py diff --git a/src/aiocraft/mc/proto/play/__init__.py b/aiocraft/mc/proto/play/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/play/__init__.py rename to aiocraft/mc/proto/play/__init__.py diff --git a/src/aiocraft/mc/proto/play/clientbound/__init__.py b/aiocraft/mc/proto/play/clientbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/__init__.py rename to aiocraft/mc/proto/play/clientbound/__init__.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_abilities.py b/aiocraft/mc/proto/play/clientbound/packet_abilities.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_abilities.py rename to aiocraft/mc/proto/play/clientbound/packet_abilities.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py b/aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py rename to aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_action_bar.py b/aiocraft/mc/proto/play/clientbound/packet_action_bar.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_action_bar.py rename to aiocraft/mc/proto/play/clientbound/packet_action_bar.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py b/aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py rename to aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_advancements.py b/aiocraft/mc/proto/play/clientbound/packet_advancements.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_advancements.py rename to aiocraft/mc/proto/play/clientbound/packet_advancements.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_animation.py b/aiocraft/mc/proto/play/clientbound/packet_animation.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_animation.py rename to aiocraft/mc/proto/play/clientbound/packet_animation.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_attach_entity.py b/aiocraft/mc/proto/play/clientbound/packet_attach_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_attach_entity.py rename to aiocraft/mc/proto/play/clientbound/packet_attach_entity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_bed.py b/aiocraft/mc/proto/play/clientbound/packet_bed.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_bed.py rename to aiocraft/mc/proto/play/clientbound/packet_bed.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_block_action.py b/aiocraft/mc/proto/play/clientbound/packet_block_action.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_block_action.py rename to aiocraft/mc/proto/play/clientbound/packet_block_action.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py b/aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py rename to aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_block_change.py b/aiocraft/mc/proto/play/clientbound/packet_block_change.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_block_change.py rename to aiocraft/mc/proto/play/clientbound/packet_block_change.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_boss_bar.py b/aiocraft/mc/proto/play/clientbound/packet_boss_bar.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_boss_bar.py rename to aiocraft/mc/proto/play/clientbound/packet_boss_bar.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_camera.py b/aiocraft/mc/proto/play/clientbound/packet_camera.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_camera.py rename to aiocraft/mc/proto/play/clientbound/packet_camera.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_chat.py b/aiocraft/mc/proto/play/clientbound/packet_chat.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_chat.py rename to aiocraft/mc/proto/play/clientbound/packet_chat.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_clear_titles.py b/aiocraft/mc/proto/play/clientbound/packet_clear_titles.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_clear_titles.py rename to aiocraft/mc/proto/play/clientbound/packet_clear_titles.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_close_window.py b/aiocraft/mc/proto/play/clientbound/packet_close_window.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_close_window.py rename to aiocraft/mc/proto/play/clientbound/packet_close_window.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_collect.py b/aiocraft/mc/proto/play/clientbound/packet_collect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_collect.py rename to aiocraft/mc/proto/play/clientbound/packet_collect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_combat_event.py b/aiocraft/mc/proto/play/clientbound/packet_combat_event.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_combat_event.py rename to aiocraft/mc/proto/play/clientbound/packet_combat_event.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py b/aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py rename to aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py b/aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py rename to aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_custom_payload.py b/aiocraft/mc/proto/play/clientbound/packet_custom_payload.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_custom_payload.py rename to aiocraft/mc/proto/play/clientbound/packet_custom_payload.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py b/aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py rename to aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_declare_commands.py b/aiocraft/mc/proto/play/clientbound/packet_declare_commands.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_declare_commands.py rename to aiocraft/mc/proto/play/clientbound/packet_declare_commands.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py b/aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py rename to aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py b/aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py rename to aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_difficulty.py b/aiocraft/mc/proto/play/clientbound/packet_difficulty.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_difficulty.py rename to aiocraft/mc/proto/play/clientbound/packet_difficulty.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py b/aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py rename to aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py b/aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py rename to aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity.py b/aiocraft/mc/proto/play/clientbound/packet_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity.py rename to aiocraft/mc/proto/play/clientbound/packet_entity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py b/aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_effect.py b/aiocraft/mc/proto/play/clientbound/packet_entity_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_effect.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_effect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py b/aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py b/aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_look.py b/aiocraft/mc/proto/play/clientbound/packet_entity_look.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_look.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_look.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py b/aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py b/aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py b/aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_status.py b/aiocraft/mc/proto/play/clientbound/packet_entity_status.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_status.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_status.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py b/aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py b/aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py b/aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py rename to aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_experience.py b/aiocraft/mc/proto/play/clientbound/packet_experience.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_experience.py rename to aiocraft/mc/proto/play/clientbound/packet_experience.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_explosion.py b/aiocraft/mc/proto/play/clientbound/packet_explosion.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_explosion.py rename to aiocraft/mc/proto/play/clientbound/packet_explosion.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_face_player.py b/aiocraft/mc/proto/play/clientbound/packet_face_player.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_face_player.py rename to aiocraft/mc/proto/play/clientbound/packet_face_player.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_game_state_change.py b/aiocraft/mc/proto/play/clientbound/packet_game_state_change.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_game_state_change.py rename to aiocraft/mc/proto/play/clientbound/packet_game_state_change.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py b/aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py rename to aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py b/aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py rename to aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_keep_alive.py b/aiocraft/mc/proto/play/clientbound/packet_keep_alive.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_keep_alive.py rename to aiocraft/mc/proto/play/clientbound/packet_keep_alive.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py b/aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py rename to aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_login.py b/aiocraft/mc/proto/play/clientbound/packet_login.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_login.py rename to aiocraft/mc/proto/play/clientbound/packet_login.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_map.py b/aiocraft/mc/proto/play/clientbound/packet_map.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_map.py rename to aiocraft/mc/proto/play/clientbound/packet_map.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_map_chunk.py b/aiocraft/mc/proto/play/clientbound/packet_map_chunk.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_map_chunk.py rename to aiocraft/mc/proto/play/clientbound/packet_map_chunk.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py b/aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py rename to aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py b/aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py rename to aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py b/aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py rename to aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py b/aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py rename to aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py b/aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py rename to aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_open_book.py b/aiocraft/mc/proto/play/clientbound/packet_open_book.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_open_book.py rename to aiocraft/mc/proto/play/clientbound/packet_open_book.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py b/aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py rename to aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py b/aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py rename to aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_open_window.py b/aiocraft/mc/proto/play/clientbound/packet_open_window.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_open_window.py rename to aiocraft/mc/proto/play/clientbound/packet_open_window.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_ping.py b/aiocraft/mc/proto/play/clientbound/packet_ping.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_ping.py rename to aiocraft/mc/proto/play/clientbound/packet_ping.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_player_info.py b/aiocraft/mc/proto/play/clientbound/packet_player_info.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_player_info.py rename to aiocraft/mc/proto/play/clientbound/packet_player_info.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py b/aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py rename to aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_position.py b/aiocraft/mc/proto/play/clientbound/packet_position.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_position.py rename to aiocraft/mc/proto/play/clientbound/packet_position.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py b/aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py rename to aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py b/aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py rename to aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py b/aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py rename to aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_respawn.py b/aiocraft/mc/proto/play/clientbound/packet_respawn.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_respawn.py rename to aiocraft/mc/proto/play/clientbound/packet_respawn.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py b/aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py rename to aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py b/aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py rename to aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py b/aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py rename to aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py b/aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py rename to aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py b/aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py rename to aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py b/aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py rename to aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_compression.py b/aiocraft/mc/proto/play/clientbound/packet_set_compression.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_compression.py rename to aiocraft/mc/proto/play/clientbound/packet_set_compression.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py b/aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py rename to aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_passengers.py b/aiocraft/mc/proto/play/clientbound/packet_set_passengers.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_passengers.py rename to aiocraft/mc/proto/play/clientbound/packet_set_passengers.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_slot.py b/aiocraft/mc/proto/play/clientbound/packet_set_slot.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_slot.py rename to aiocraft/mc/proto/play/clientbound/packet_set_slot.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py b/aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py rename to aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_title_text.py b/aiocraft/mc/proto/play/clientbound/packet_set_title_text.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_title_text.py rename to aiocraft/mc/proto/play/clientbound/packet_set_title_text.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_set_title_time.py b/aiocraft/mc/proto/play/clientbound/packet_set_title_time.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_set_title_time.py rename to aiocraft/mc/proto/play/clientbound/packet_set_title_time.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py b/aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py rename to aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_sound_effect.py b/aiocraft/mc/proto/play/clientbound/packet_sound_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_sound_effect.py rename to aiocraft/mc/proto/play/clientbound/packet_sound_effect.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_spawn_position.py b/aiocraft/mc/proto/play/clientbound/packet_spawn_position.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_spawn_position.py rename to aiocraft/mc/proto/play/clientbound/packet_spawn_position.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_statistics.py b/aiocraft/mc/proto/play/clientbound/packet_statistics.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_statistics.py rename to aiocraft/mc/proto/play/clientbound/packet_statistics.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_stop_sound.py b/aiocraft/mc/proto/play/clientbound/packet_stop_sound.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_stop_sound.py rename to aiocraft/mc/proto/play/clientbound/packet_stop_sound.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_tab_complete.py b/aiocraft/mc/proto/play/clientbound/packet_tab_complete.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_tab_complete.py rename to aiocraft/mc/proto/play/clientbound/packet_tab_complete.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_tags.py b/aiocraft/mc/proto/play/clientbound/packet_tags.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_tags.py rename to aiocraft/mc/proto/play/clientbound/packet_tags.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_teams.py b/aiocraft/mc/proto/play/clientbound/packet_teams.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_teams.py rename to aiocraft/mc/proto/play/clientbound/packet_teams.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py b/aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py rename to aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_title.py b/aiocraft/mc/proto/play/clientbound/packet_title.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_title.py rename to aiocraft/mc/proto/play/clientbound/packet_title.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_trade_list.py b/aiocraft/mc/proto/play/clientbound/packet_trade_list.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_trade_list.py rename to aiocraft/mc/proto/play/clientbound/packet_trade_list.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_transaction.py b/aiocraft/mc/proto/play/clientbound/packet_transaction.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_transaction.py rename to aiocraft/mc/proto/play/clientbound/packet_transaction.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py b/aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py rename to aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py b/aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py rename to aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_attributes.py b/aiocraft/mc/proto/play/clientbound/packet_update_attributes.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_attributes.py rename to aiocraft/mc/proto/play/clientbound/packet_update_attributes.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py b/aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py rename to aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_health.py b/aiocraft/mc/proto/play/clientbound/packet_update_health.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_health.py rename to aiocraft/mc/proto/play/clientbound/packet_update_health.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_light.py b/aiocraft/mc/proto/play/clientbound/packet_update_light.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_light.py rename to aiocraft/mc/proto/play/clientbound/packet_update_light.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_sign.py b/aiocraft/mc/proto/play/clientbound/packet_update_sign.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_sign.py rename to aiocraft/mc/proto/play/clientbound/packet_update_sign.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_time.py b/aiocraft/mc/proto/play/clientbound/packet_update_time.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_time.py rename to aiocraft/mc/proto/play/clientbound/packet_update_time.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py b/aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py rename to aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_update_view_position.py b/aiocraft/mc/proto/play/clientbound/packet_update_view_position.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_update_view_position.py rename to aiocraft/mc/proto/play/clientbound/packet_update_view_position.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py b/aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py rename to aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_window_items.py b/aiocraft/mc/proto/play/clientbound/packet_window_items.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_window_items.py rename to aiocraft/mc/proto/play/clientbound/packet_window_items.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border.py b/aiocraft/mc/proto/play/clientbound/packet_world_border.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border_center.py b/aiocraft/mc/proto/play/clientbound/packet_world_border_center.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border_center.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border_center.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py b/aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border_size.py b/aiocraft/mc/proto/play/clientbound/packet_world_border_size.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border_size.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border_size.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py b/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py b/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py rename to aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_event.py b/aiocraft/mc/proto/play/clientbound/packet_world_event.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_event.py rename to aiocraft/mc/proto/play/clientbound/packet_world_event.py diff --git a/src/aiocraft/mc/proto/play/clientbound/packet_world_particles.py b/aiocraft/mc/proto/play/clientbound/packet_world_particles.py similarity index 100% rename from src/aiocraft/mc/proto/play/clientbound/packet_world_particles.py rename to aiocraft/mc/proto/play/clientbound/packet_world_particles.py diff --git a/src/aiocraft/mc/proto/play/serverbound/__init__.py b/aiocraft/mc/proto/play/serverbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/__init__.py rename to aiocraft/mc/proto/play/serverbound/__init__.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_abilities.py b/aiocraft/mc/proto/play/serverbound/packet_abilities.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_abilities.py rename to aiocraft/mc/proto/play/serverbound/packet_abilities.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py b/aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py rename to aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_arm_animation.py b/aiocraft/mc/proto/play/serverbound/packet_arm_animation.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_arm_animation.py rename to aiocraft/mc/proto/play/serverbound/packet_arm_animation.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_block_dig.py b/aiocraft/mc/proto/play/serverbound/packet_block_dig.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_block_dig.py rename to aiocraft/mc/proto/play/serverbound/packet_block_dig.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_block_place.py b/aiocraft/mc/proto/play/serverbound/packet_block_place.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_block_place.py rename to aiocraft/mc/proto/play/serverbound/packet_block_place.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_chat.py b/aiocraft/mc/proto/play/serverbound/packet_chat.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_chat.py rename to aiocraft/mc/proto/play/serverbound/packet_chat.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_client_command.py b/aiocraft/mc/proto/play/serverbound/packet_client_command.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_client_command.py rename to aiocraft/mc/proto/play/serverbound/packet_client_command.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_close_window.py b/aiocraft/mc/proto/play/serverbound/packet_close_window.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_close_window.py rename to aiocraft/mc/proto/play/serverbound/packet_close_window.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py b/aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py rename to aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py b/aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py rename to aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_custom_payload.py b/aiocraft/mc/proto/play/serverbound/packet_custom_payload.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_custom_payload.py rename to aiocraft/mc/proto/play/serverbound/packet_custom_payload.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py b/aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py rename to aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_edit_book.py b/aiocraft/mc/proto/play/serverbound/packet_edit_book.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_edit_book.py rename to aiocraft/mc/proto/play/serverbound/packet_edit_book.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_enchant_item.py b/aiocraft/mc/proto/play/serverbound/packet_enchant_item.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_enchant_item.py rename to aiocraft/mc/proto/play/serverbound/packet_enchant_item.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_entity_action.py b/aiocraft/mc/proto/play/serverbound/packet_entity_action.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_entity_action.py rename to aiocraft/mc/proto/play/serverbound/packet_entity_action.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_flying.py b/aiocraft/mc/proto/play/serverbound/packet_flying.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_flying.py rename to aiocraft/mc/proto/play/serverbound/packet_flying.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_generate_structure.py b/aiocraft/mc/proto/play/serverbound/packet_generate_structure.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_generate_structure.py rename to aiocraft/mc/proto/play/serverbound/packet_generate_structure.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py b/aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py rename to aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_keep_alive.py b/aiocraft/mc/proto/play/serverbound/packet_keep_alive.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_keep_alive.py rename to aiocraft/mc/proto/play/serverbound/packet_keep_alive.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py b/aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py rename to aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_look.py b/aiocraft/mc/proto/play/serverbound/packet_look.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_look.py rename to aiocraft/mc/proto/play/serverbound/packet_look.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_name_item.py b/aiocraft/mc/proto/play/serverbound/packet_name_item.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_name_item.py rename to aiocraft/mc/proto/play/serverbound/packet_name_item.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_pick_item.py b/aiocraft/mc/proto/play/serverbound/packet_pick_item.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_pick_item.py rename to aiocraft/mc/proto/play/serverbound/packet_pick_item.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_pong.py b/aiocraft/mc/proto/play/serverbound/packet_pong.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_pong.py rename to aiocraft/mc/proto/play/serverbound/packet_pong.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_position.py b/aiocraft/mc/proto/play/serverbound/packet_position.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_position.py rename to aiocraft/mc/proto/play/serverbound/packet_position.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_position_look.py b/aiocraft/mc/proto/play/serverbound/packet_position_look.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_position_look.py rename to aiocraft/mc/proto/play/serverbound/packet_position_look.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py b/aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py rename to aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py b/aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py rename to aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py b/aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py rename to aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_recipe_book.py b/aiocraft/mc/proto/play/serverbound/packet_recipe_book.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_recipe_book.py rename to aiocraft/mc/proto/play/serverbound/packet_recipe_book.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py b/aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py rename to aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_select_trade.py b/aiocraft/mc/proto/play/serverbound/packet_select_trade.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_select_trade.py rename to aiocraft/mc/proto/play/serverbound/packet_select_trade.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py b/aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py rename to aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py b/aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py rename to aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py b/aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py rename to aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_settings.py b/aiocraft/mc/proto/play/serverbound/packet_settings.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_settings.py rename to aiocraft/mc/proto/play/serverbound/packet_settings.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_spectate.py b/aiocraft/mc/proto/play/serverbound/packet_spectate.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_spectate.py rename to aiocraft/mc/proto/play/serverbound/packet_spectate.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_steer_boat.py b/aiocraft/mc/proto/play/serverbound/packet_steer_boat.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_steer_boat.py rename to aiocraft/mc/proto/play/serverbound/packet_steer_boat.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py b/aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py rename to aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_tab_complete.py b/aiocraft/mc/proto/play/serverbound/packet_tab_complete.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_tab_complete.py rename to aiocraft/mc/proto/play/serverbound/packet_tab_complete.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py b/aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py rename to aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_transaction.py b/aiocraft/mc/proto/play/serverbound/packet_transaction.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_transaction.py rename to aiocraft/mc/proto/play/serverbound/packet_transaction.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_update_command_block.py b/aiocraft/mc/proto/play/serverbound/packet_update_command_block.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_update_command_block.py rename to aiocraft/mc/proto/play/serverbound/packet_update_command_block.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py b/aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py rename to aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py b/aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py rename to aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_update_sign.py b/aiocraft/mc/proto/play/serverbound/packet_update_sign.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_update_sign.py rename to aiocraft/mc/proto/play/serverbound/packet_update_sign.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py b/aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py rename to aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_use_entity.py b/aiocraft/mc/proto/play/serverbound/packet_use_entity.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_use_entity.py rename to aiocraft/mc/proto/play/serverbound/packet_use_entity.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_use_item.py b/aiocraft/mc/proto/play/serverbound/packet_use_item.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_use_item.py rename to aiocraft/mc/proto/play/serverbound/packet_use_item.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py b/aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py rename to aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py diff --git a/src/aiocraft/mc/proto/play/serverbound/packet_window_click.py b/aiocraft/mc/proto/play/serverbound/packet_window_click.py similarity index 100% rename from src/aiocraft/mc/proto/play/serverbound/packet_window_click.py rename to aiocraft/mc/proto/play/serverbound/packet_window_click.py diff --git a/src/aiocraft/mc/proto/status/__init__.py b/aiocraft/mc/proto/status/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/status/__init__.py rename to aiocraft/mc/proto/status/__init__.py diff --git a/src/aiocraft/mc/proto/status/clientbound/__init__.py b/aiocraft/mc/proto/status/clientbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/status/clientbound/__init__.py rename to aiocraft/mc/proto/status/clientbound/__init__.py diff --git a/src/aiocraft/mc/proto/status/clientbound/packet_ping.py b/aiocraft/mc/proto/status/clientbound/packet_ping.py similarity index 100% rename from src/aiocraft/mc/proto/status/clientbound/packet_ping.py rename to aiocraft/mc/proto/status/clientbound/packet_ping.py diff --git a/src/aiocraft/mc/proto/status/clientbound/packet_server_info.py b/aiocraft/mc/proto/status/clientbound/packet_server_info.py similarity index 100% rename from src/aiocraft/mc/proto/status/clientbound/packet_server_info.py rename to aiocraft/mc/proto/status/clientbound/packet_server_info.py diff --git a/src/aiocraft/mc/proto/status/serverbound/__init__.py b/aiocraft/mc/proto/status/serverbound/__init__.py similarity index 100% rename from src/aiocraft/mc/proto/status/serverbound/__init__.py rename to aiocraft/mc/proto/status/serverbound/__init__.py diff --git a/src/aiocraft/mc/proto/status/serverbound/packet_ping.py b/aiocraft/mc/proto/status/serverbound/packet_ping.py similarity index 100% rename from src/aiocraft/mc/proto/status/serverbound/packet_ping.py rename to aiocraft/mc/proto/status/serverbound/packet_ping.py diff --git a/src/aiocraft/mc/proto/status/serverbound/packet_ping_start.py b/aiocraft/mc/proto/status/serverbound/packet_ping_start.py similarity index 100% rename from src/aiocraft/mc/proto/status/serverbound/packet_ping_start.py rename to aiocraft/mc/proto/status/serverbound/packet_ping_start.py diff --git a/src/aiocraft/mc/types.py b/aiocraft/mc/types.py similarity index 100% rename from src/aiocraft/mc/types.py rename to aiocraft/mc/types.py diff --git a/src/aiocraft/py.typed b/aiocraft/py.typed similarity index 100% rename from src/aiocraft/py.typed rename to aiocraft/py.typed diff --git a/src/aiocraft/server.py b/aiocraft/server.py similarity index 100% rename from src/aiocraft/server.py rename to aiocraft/server.py diff --git a/src/aiocraft/util/__init__.py b/aiocraft/util/__init__.py similarity index 100% rename from src/aiocraft/util/__init__.py rename to aiocraft/util/__init__.py diff --git a/src/aiocraft/util/encryption.py b/aiocraft/util/encryption.py similarity index 100% rename from src/aiocraft/util/encryption.py rename to aiocraft/util/encryption.py diff --git a/src/aiocraft/util/helpers.py b/aiocraft/util/helpers.py similarity index 100% rename from src/aiocraft/util/helpers.py rename to aiocraft/util/helpers.py diff --git a/pyproject.toml b/pyproject.toml index 569df42..e7e28bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,55 @@ [build-system] -requires = [ - "setuptools>=42", - "wheel" +requires = ["maturin>=0.12,<0.13"] +build-backend = "maturin" + +[project] +name = "aiocraft" +version = "0.1.0" +authors = [ + { email = "me@alemi.dev", name = "alemi"}, + { email = "francescotolomei@mail.com", name = "f-tml" }, ] -build-backend = "setuptools.build_meta" +maintainers = [ + { email = "me@alemi.dev", name = "alemi"}, + { email = "francescotolomei@mail.com", name = "f-tml" }, +] +description = "asyncio-powered headless minecraft client library" +long_description = "file: README.md" +long_description_content_type = "text/markdown" +# requires-python = ">=3.6" # Can this work with 3.6? +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Development Status :: 4 - Beta", +] +readme = "README.md" +license = {file = "LICENSE"} +keywords = ["python", "rust", "mc", "minecraft", "protocol", "async", "asyncio", "definitions"] + +dependencies = [ + "pynbt", + "cryptography", + "aiohttp", + "termcolor" +] + +# [project.optional-dependencies] +# test = [ +# "pytest < 5.0.0", +# "pytest-cov[all]" +# ] + +[project.urls] +homepage = "https://github.com/alemidev/aiocraft" +# documentation = "readthedocs.org" +repository = "https://github.com/alemidev/aiocraft" +# changelog = "github.com/me/spam/blob/master/CHANGELOG.md" +bug_tracker = "https://github.com/alemidev/aiocraft/issues" [style] use_tabs=true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a03253b..0000000 --- a/setup.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[metadata] -name = aiocraft -version = 0.0.9 -author = alemi -author_email = me@alemi.dev -description = asyncio-powered headless minecraft client library -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/alemidev/aiocraft -project_urls = - Bug Tracker = https://github.com/alemidev/aiocraft/issues -classifiers = - Programming Language :: Python :: 3 - License :: OSI Approved :: MIT License - Operating System :: OS Independent - -[options] -install_requires = - pynbt - cryptography - aiohttp - termcolor -package_dir = - = src -packages = find: -python_requires = >=3.6 - -[options.packages.find] -where = src diff --git a/src/aiocraft/__init__.py b/src/aiocraft/__init__.py deleted file mode 100644 index 641b5fa..0000000 --- a/src/aiocraft/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -"""aiocraft is an asyncio-driven headless minecraft client""" -# from .client import Client -from .mc import * - -__version__ = "0.0.1" -__author__ = "alemidev" -__credits__ = "Thanks to pyCraft, really inspired this" diff --git a/src/aiocraft/mc/chunk/src/lib.rs b/src/aiocraft/mc/chunk/src/lib.rs deleted file mode 100644 index fa052cb..0000000 --- a/src/aiocraft/mc/chunk/src/lib.rs +++ /dev/null @@ -1,179 +0,0 @@ -use pyo3::{prelude::*, exceptions::PyValueError}; - -pub trait ChunkSection { - fn new(chunk_data: &mut Vec) -> Self; - fn get_states(&self) -> [[[u16; 16]; 16]; 16]; - fn get_light(&self) -> [[[u16; 16]; 16]; 16]; - fn get_sky_light(&self) -> Option<[[[u16; 16]; 16]; 16]>; - - fn read_varint(buffer: &mut Vec) -> PyResult { - let mut num_read = 0; - let mut result : i32 = 0; - loop { - if buffer.len() < 1 { - return Err(PyValueError::new_err("VarInt too short")); - } - let data = buffer.remove(0); - result |= ((data & 0b01111111) << (7 * num_read)) as i32; - num_read +=1; - if num_read > 4 { - return Err(PyValueError::new_err("VarInt too big")); - } - if data & 0b10000000 == 0 { - break - } - } - return Ok(result); - } - - fn read_paletted_container(buffer: &mut Vec) -> [[[u16; 16]; 16]; 16] { - let mut bits : u8 = buffer[0]; // TODO is this is big endian ? - // bits = UnsignedByte.read(buffer, ctx=ctx) # FIXME if bits > 4 it reads trash - // #logging.debug("[%d|%d@%d] Bits per block : %d", ctx.x, ctx.z, ctx.sec, bits) - if bits < 4 { bits = 4 }; - if bits >= 9 { bits = 13 }; // this should not be hardcoded but we have no way to calculate all possible block states - let palette_len = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error - let mut palette = vec![0;palette_len as usize]; - for p in 0..palette_len as usize{ - palette[p] = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error - } - // # logging.debug("[%d|%d@%d] Palette section : [%d] %s", ctx.x, ctx.z, ctx.sec, palette_len, str(palette)) - let container_size = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error - let block_data = buffer.drain(0..(container_size as usize*8)); - let mut section = [[[0u16;16]; 16]; 16]; - let max_val : u16 = (1<> start_offset) as usize) & max_val as usize - ] as u16; - } else { - let end_offset = 64 - start_offset; - section[x][y][z] = palette[( - (block_data.as_slice()[start_byte as usize] as usize) >> start_offset - | (block_data.as_slice()[end_byte as usize] as usize) << end_offset - ) & max_val as usize] as u16; - } - } - } - } - return section; - } -} - -struct ChunkFormat340 { - block_states: [[[u16; 16]; 16]; 16], - block_light: [[[u16; 16]; 16]; 16], - sky_light: Option<[[[u16; 16]; 16]; 16]>, -} //https://docs.rs/crate/cpu-endian/latest/source/src/lib.rs - -impl ChunkFormat340 { - fn read_half_byte_array(buffer: &mut Vec) -> [[[u16; 16]; 16]; 16] { - let buf = buffer.drain(0..((16 * 16 * 16) / 2)); - let mut out = [[[0u16; 16]; 16]; 16]; - for y in 0..16 { - for z in 0..16 { - for x in 0..16 { - let index:usize = (((y * 16) + z) * 16) + x; - let tmp = buf.as_slice()[index / 2]; - out[x][y][z] = if index / 2 != 0 { tmp >> 4 } else { tmp & 0xF } as u16 - } - } - } - return out; - } -} - -impl ChunkSection for ChunkFormat340 { - fn new(chunk_data: &mut Vec) -> Self { - Self { - block_states: ChunkFormat340::read_paletted_container(chunk_data), // TODO! It's a paletted container - block_light: ChunkFormat340::read_half_byte_array(chunk_data), - sky_light: Some(ChunkFormat340::read_half_byte_array(chunk_data)), // TODO are we in overworld? - } - } - - fn get_states(&self) -> [[[u16; 16]; 16]; 16] { self.block_states } - fn get_light(&self) -> [[[u16; 16]; 16]; 16] { self.block_light } - fn get_sky_light(&self) -> Option<[[[u16; 16]; 16]; 16]> { self.sky_light } -} - -#[pyclass] -struct Chunk { - x: i32, - z: i32, - bitmask: u16, - ground_up_continuous: bool, - block_states: [[[u16; 16]; 256]; 16], - block_light: [[[u16; 16]; 256]; 16], - sky_light: [[[u16; 16]; 256]; 16], - biomes: [u8; 256], -} - -impl Chunk { - fn new(x: i32, z: i32, bitmask: u16, ground_up_continuous: bool) -> Self { - Self { - x: x, - z: z, - bitmask: bitmask, - ground_up_continuous: ground_up_continuous, - block_states: [[[0u16; 16]; 256]; 16], - block_light: [[[0u16; 16]; 256]; 16], - sky_light: [[[0u16; 16]; 256]; 16], - biomes: [0u8; 256], - } - } - - fn read(&self, mut chunk_data: Vec) -> PyResult<()> { - for i in 0..16 { - if ((self.bitmask >> i) & 1) != 0 { - let section: ChunkFormat340 = ChunkFormat340::new(&mut chunk_data); - // self.blocks[:, i*16 : (i+1)*16, :] = block_states - // self.block_light[:, i*16 : (i+1)*16, :] = block_light - // self.sky_light[:, i*16 : (i+1)*16, :] = sky_light - } - } - // TODO - // if self.ground_up_continuous { - // self.biomes = buffer.read(256) //16x16 - // } - // if buffer.read() { - // logging.warning("Leftover data in chunk buffer") - // } - return Ok(()); - } -} - -// Biomes -// -// The biomes array is only present when ground-up continuous is set to true. Biomes cannot be changed unless a chunk is re-sent. -// -// The structure is an array of 256 bytes, each representing a Biome ID (it is recommended that 127 for "Void" is used if there is no set biome). The array is indexed by z * 16 | x. - -/* -class World: - chunks : Dict[Tuple[int, int], Chunk] - - def __init__(self): - self.chunks = {} - - def __getitem__(self, item:Tuple[int, int, int]): - return self.get(*item) - - def get(self, x:int, y:int, z:int) -> int: - coord = (x//16, z//16) - if coord not in self.chunks: - raise KeyError(f"Chunk {coord} not loaded") - return self.chunks[coord][int(x%16), int(y), int(z%16)] - - def put(self, chunk:Chunk, x:int, z:int, merge:bool=False): - if merge and (x,z) in self.chunks: - chunk.merge(self.chunks[(x,z)]) - self.chunks[(x,z)] = chunk -*/ diff --git a/src/chunk.rs b/src/chunk.rs new file mode 100644 index 0000000..07b89e1 --- /dev/null +++ b/src/chunk.rs @@ -0,0 +1,305 @@ +use std::collections::HashMap; +use std::io::{Cursor, Read}; +use log::{info, warn}; + +use pyo3::{exceptions::PyValueError, prelude::*}; + +#[pyfunction] +pub fn bit_pack(data: Vec, bits: i32, size: i32) -> PyResult> { + if size <= bits { + return Err(PyValueError::new_err( + "Cannot pack into chunks smaller than bits per block", + )); + } + let mut out = vec![0; 0]; + let mut cursor = 0; + let mut buffer = 0; + for el in data { + if cursor + bits > size { + let delta = (cursor + bits) - size; + buffer |= (el & (2 << (bits - delta) - 1)) << cursor; + out.push(buffer); + buffer = 0 | ((el >> (bits - delta)) & (2 << delta - 1)); + cursor = delta; + } else { + buffer |= (el & (2 << bits - 1)) << cursor; + cursor += bits; + } + } + return Ok(out); +} + +pub trait ChunkSection { + fn new(chunk_data: &mut R) -> Self; + fn get_states(&self) -> [[[u16; 16]; 16]; 16]; + fn get_light(&self) -> [[[u16; 16]; 16]; 16]; + fn get_sky_light(&self) -> Option<[[[u16; 16]; 16]; 16]>; + + fn read_varint(buffer: &mut R) -> PyResult { + let mut num_read = 0; + let mut result: i32 = 0; + loop { + let mut data: [u8; 1] = [0u8; 1]; + buffer.read_exact(&mut data)?; + result |= ((data[0] & 0b01111111) as i32) << (7 * num_read); + num_read += 1; + if num_read > 4 { + return Err(PyValueError::new_err("VarInt too big")); + } + if data[0] & 0b10000000 == 0 { + break; + } + } + return Ok(result); + } + + fn read_paletted_container(buffer: &mut R) -> [[[u16; 16]; 16]; 16] { + let mut data: [u8; 1] = [0u8; 1]; + buffer.read_exact(&mut data); + // bits = UnsignedByte.read(buffer, ctx=ctx) # FIXME if bits > 4 it reads trash + // #logging.debug("[%d|%d@%d] Bits per block : %d", ctx.x, ctx.z, ctx.sec, bits) + let bits; + if data[0] < 4 { + bits = 4 + } else if data[0] >= 9 { + bits = 13 + } + // this should not be hardcoded but we have no way to calculate all possible block states + else { + bits = data[0] + } + let palette_len = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error + let mut palette = vec![0; palette_len as usize]; + for p in 0..palette_len as usize { + palette[p] = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error + } + // # logging.debug("[%d|%d@%d] Palette section : [%d] %s", ctx.x, ctx.z, ctx.sec, palette_len, str(palette)) + let container_size = ChunkFormat340::read_varint(buffer).unwrap(); // TODO handle possible error + let mut block_data = vec![0u64; container_size as usize]; + let mut long_arr: [u8; 8] = [0u8; 8]; + for i in 0..container_size as usize { + buffer.read_exact(&mut long_arr); + let mut tmp: u64 = 0; + for j in 0..8 { + tmp |= (long_arr[j] as u64) << (j * 8); + } + block_data[i] = tmp; + } + let mut section = [[[0u16; 16]; 16]; 16]; + let max_val: u16 = (1 << bits) - 1; + for y in 0..16 { + // TODO should probably read them as longs first! + for z in 0..16 { + for x in 0..16 { + let i = x + ((y * 16) + z) * 16; + let start_byte = (i * bits as usize) / 64; + let start_offset = (i * bits as usize) % 64; + let end_byte = ((i + 1) * bits as usize - 1) / 64; + let value: u16; + if start_byte == end_byte { + value = ((block_data[start_byte as usize] //FIXME out of bounds? + >> start_offset) & max_val as u64) as u16; + } else { + let end_offset = 64 - start_offset; + value = (((block_data[start_byte as usize] as usize) + >> start_offset + | (block_data[end_byte as usize] as usize) << end_offset) + & max_val as usize) as u16; + } + if bits == 13 { + section[x][y][z] = value; + } else { + if value as i32 >= palette_len { + warn!("index out of palette bounds : {}/{} (bits {})", value, palette_len, bits); + section[x][y][z] = value; + } else { + section[x][y][z] = palette[value as usize] as u16; + } + } + } + } + } + return section; + } +} + +struct ChunkFormat340 { + block_states: [[[u16; 16]; 16]; 16], + block_light: [[[u16; 16]; 16]; 16], + sky_light: Option<[[[u16; 16]; 16]; 16]>, +} + +impl ChunkFormat340 { + fn read_half_byte_array(buffer: &mut R) -> [[[u16; 16]; 16]; 16] { + let mut buf: [u8; (16 * 16 * 16) / 2] = [0u8; (16 * 16 * 16) / 2]; + buffer.read_exact(&mut buf); + let mut out = [[[0u16; 16]; 16]; 16]; + for y in 0..16 { + for z in 0..16 { + for x in 0..16 { + let index: usize = (((y * 16) + z) * 16) + x; + let tmp = buf[index / 2]; + out[x][y][z] = if index / 2 != 0 { tmp >> 4 } else { tmp & 0xF } as u16 + } + } + } + return out; + } +} + +impl ChunkSection for ChunkFormat340 { + fn new(chunk_data: &mut R) -> Self { + Self { + block_states: ChunkFormat340::read_paletted_container(chunk_data), // TODO! It's a paletted container + block_light: ChunkFormat340::read_half_byte_array(chunk_data), + sky_light: Some(ChunkFormat340::read_half_byte_array(chunk_data)), // TODO are we in overworld? + } + } + + fn get_states(&self) -> [[[u16; 16]; 16]; 16] { + self.block_states + } + fn get_light(&self) -> [[[u16; 16]; 16]; 16] { + self.block_light + } + fn get_sky_light(&self) -> Option<[[[u16; 16]; 16]; 16]> { + self.sky_light + } +} + +// https://stackoverflow.com/questions/41069865/how-to-create-an-in-memory-object-that-can-be-used-as-a-reader-writer-or-seek/50732452#50732452 + +#[pyclass] +pub struct Chunk { + pub x: i32, + pub z: i32, + pub bitmask: u16, + pub ground_up_continuous: bool, + block_states: [[[u16; 16]; 256]; 16], + block_light: [[[u16; 16]; 256]; 16], + sky_light: [[[u16; 16]; 256]; 16], + biomes: [u8; 256], +} +// Biomes +// The biomes array is only present when ground-up continuous is set to true. Biomes cannot be changed unless a chunk is re-sent. +// The structure is an array of 256 bytes, each representing a Biome ID (it is recommended that 127 for "Void" is used if there is no set biome). The array is indexed by z * 16 | x. + +#[pymethods] +impl Chunk { + #[new] + pub fn new(x: i32, z: i32, bitmask: u16, ground_up_continuous: bool) -> Self { + Self { + x: x, + z: z, + bitmask: bitmask, + ground_up_continuous: ground_up_continuous, + block_states: [[[0u16; 16]; 256]; 16], + block_light: [[[0u16; 16]; 256]; 16], + sky_light: [[[0u16; 16]; 256]; 16], + biomes: [0u8; 256], + } + } + + pub fn read(&mut self, chunk_data: Vec) -> PyResult<()> { + let mut c = Cursor::new(chunk_data); + for i in 0..16 { + if ((self.bitmask >> i) & 1) != 0 { + let section: ChunkFormat340 = ChunkFormat340::new(&mut c); + for x in 0..16 { + for y in 0..16 { + for z in 0..16 { + self.block_states[x][(i * 16) + y][z] = section.block_states[x][y][z]; + self.block_light[x][(i * 16) + y][z] = section.block_states[x][y][z]; + self.sky_light[x][(i * 16) + y][z] = section.block_states[x][y][z]; + } + } + } + } + } + + if self.ground_up_continuous { + c.read_exact(&mut self.biomes); + } + + // if buffer.read() { + // logging.warning("Leftover data in chunk buffer") + // } + return Ok(()); + } + + pub fn merge(&mut self, other: Chunk) -> Option { + let old_chunk = self.clone(); + for i in 0..16 { + if ((self.bitmask >> i) & 1) != 0 { + for x in 0..16 { + for y in 0..16 { + for z in 0..16 { + self.block_states[x][(i * 16) + y][z] = + other.block_states[x][(i * 16) + y][z]; + self.block_light[x][(i * 16) + y][z] = + other.block_light[x][(i * 16) + y][z]; + self.sky_light[x][(i * 16) + y][z] = + other.sky_light[x][(i * 16) + y][z]; + } + } + } + } + } + return Some(old_chunk); //TODO: is this really we want to return? + } +} + +impl Clone for Chunk { + fn clone(&self) -> Self { + Chunk { + x: self.x, + z: self.z, + bitmask: self.bitmask, + ground_up_continuous: self.ground_up_continuous, + block_states: self.block_states.clone(), + block_light: self.block_light.clone(), + sky_light: self.sky_light.clone(), + biomes: self.biomes.clone(), + } + } +} + +#[pyclass] +pub struct World { + chunks: HashMap<(i32, i32), Chunk>, +} + +#[pymethods] +impl World { + #[new] + pub fn new() -> Self { + info!("Initializing world from Rust"); + World { + chunks: HashMap::new(), + } + } + + pub fn __getitem__(&self, item: (i32, i32)) -> Option { + return self.get(item.0, item.1); + } + + pub fn get_block(&self, x: i32, y: i32, z: i32) -> Option { + if let Some(chunk) = self.chunks.get(&(x / 16, z / 16)) { + return Some(chunk.block_states[(x % 16) as usize][y as usize][(z % 16) as usize]); + } + None + } + + pub fn get(&self, x: i32, z: i32) -> Option { + return Some((self.chunks.get(&(x, z))?).clone()); + } + + pub fn put(&mut self, chunk: Chunk, x: i32, z: i32, merge: bool) -> Option { + info!("Adding chunk x{} z{}", x, z); + if merge && self.chunks.contains_key(&(x, z)) { + return self.chunks.get_mut(&(x, z)).unwrap().merge(chunk); + } else { + return self.chunks.insert((x, z), chunk); + } + } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..9fbdc71 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,19 @@ +mod chunk; + +use chunk::{Chunk,World,bit_pack}; + +use pyo3::prelude::*; + +/// A Python module implemented in Rust. The name of this function must match +/// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to +/// import the module. +#[pymodule] +fn aiocraft(_py: Python<'_>, m: &PyModule) -> PyResult<()> { + pyo3_log::init(); + // let native = PyModule::new(_py, "native")?; + m.add_function(wrap_pyfunction!(bit_pack, _py)?)?; + m.add_class::()?; + m.add_class::()?; + // m.add_submodule(native)?; + Ok(()) +}