fa21ea7688
Primitive codecs (VarInt/VarLong, strings, positions, LpVec3, BitSets), VarInt21 framing, zlib threshold compression, AES/CFB8 encryption, MD5 offline UUIDs, network NBT via horizon-world, item stacks with data component patches, chunk and light payloads with paletted containers, synched entity data, and typed packets for every connection state in both directions with round-trip tests. Packet ids are generated from the data generator's packets report. The probe example logs into a vanilla 26.3 server and decoded ~8000 packets (329 chunks) without errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
591 lines
22 KiB
Rust
591 lines
22 KiB
Rust
//! Packet ids per connection state and direction for protocol 777 (26.3).
|
|
//! Generated by tools/generate_packet_ids.py from the data generator's
|
|
//! packets report; do not edit by hand.
|
|
#![allow(missing_docs)]
|
|
use crate::{Direction, State};
|
|
|
|
pub mod handshake {
|
|
pub mod serverbound {
|
|
pub const INTENTION: i32 = 0;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &["intention"];
|
|
}
|
|
}
|
|
pub mod status {
|
|
pub mod clientbound {
|
|
pub const STATUS_RESPONSE: i32 = 0;
|
|
pub const PONG_RESPONSE: i32 = 1;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &["status_response", "pong_response"];
|
|
}
|
|
pub mod serverbound {
|
|
pub const STATUS_REQUEST: i32 = 0;
|
|
pub const PING_REQUEST: i32 = 1;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &["status_request", "ping_request"];
|
|
}
|
|
}
|
|
pub mod login {
|
|
pub mod clientbound {
|
|
pub const LOGIN_DISCONNECT: i32 = 0;
|
|
pub const HELLO: i32 = 1;
|
|
pub const LOGIN_FINISHED: i32 = 2;
|
|
pub const LOGIN_COMPRESSION: i32 = 3;
|
|
pub const CUSTOM_QUERY: i32 = 4;
|
|
pub const COOKIE_REQUEST: i32 = 5;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"login_disconnect",
|
|
"hello",
|
|
"login_finished",
|
|
"login_compression",
|
|
"custom_query",
|
|
"cookie_request",
|
|
];
|
|
}
|
|
pub mod serverbound {
|
|
pub const HELLO: i32 = 0;
|
|
pub const KEY: i32 = 1;
|
|
pub const CUSTOM_QUERY_ANSWER: i32 = 2;
|
|
pub const LOGIN_ACKNOWLEDGED: i32 = 3;
|
|
pub const COOKIE_RESPONSE: i32 = 4;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"hello",
|
|
"key",
|
|
"custom_query_answer",
|
|
"login_acknowledged",
|
|
"cookie_response",
|
|
];
|
|
}
|
|
}
|
|
pub mod configuration {
|
|
pub mod clientbound {
|
|
pub const COOKIE_REQUEST: i32 = 0;
|
|
pub const CUSTOM_PAYLOAD: i32 = 1;
|
|
pub const DISCONNECT: i32 = 2;
|
|
pub const FINISH_CONFIGURATION: i32 = 3;
|
|
pub const KEEP_ALIVE: i32 = 4;
|
|
pub const PING: i32 = 5;
|
|
pub const RESET_CHAT: i32 = 6;
|
|
pub const REGISTRY_DATA: i32 = 7;
|
|
pub const RESOURCE_PACK_POP: i32 = 8;
|
|
pub const RESOURCE_PACK_PUSH: i32 = 9;
|
|
pub const POST_EFFECTS: i32 = 10;
|
|
pub const STORE_COOKIE: i32 = 11;
|
|
pub const TRANSFER: i32 = 12;
|
|
pub const UPDATE_ENABLED_FEATURES: i32 = 13;
|
|
pub const UPDATE_TAGS: i32 = 14;
|
|
pub const SELECT_KNOWN_PACKS: i32 = 15;
|
|
pub const CUSTOM_REPORT_DETAILS: i32 = 16;
|
|
pub const SERVER_LINKS: i32 = 17;
|
|
pub const CLEAR_DIALOG: i32 = 18;
|
|
pub const SHOW_DIALOG: i32 = 19;
|
|
pub const CODE_OF_CONDUCT: i32 = 20;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"cookie_request",
|
|
"custom_payload",
|
|
"disconnect",
|
|
"finish_configuration",
|
|
"keep_alive",
|
|
"ping",
|
|
"reset_chat",
|
|
"registry_data",
|
|
"resource_pack_pop",
|
|
"resource_pack_push",
|
|
"post_effects",
|
|
"store_cookie",
|
|
"transfer",
|
|
"update_enabled_features",
|
|
"update_tags",
|
|
"select_known_packs",
|
|
"custom_report_details",
|
|
"server_links",
|
|
"clear_dialog",
|
|
"show_dialog",
|
|
"code_of_conduct",
|
|
];
|
|
}
|
|
pub mod serverbound {
|
|
pub const CLIENT_INFORMATION: i32 = 0;
|
|
pub const COOKIE_RESPONSE: i32 = 1;
|
|
pub const CUSTOM_PAYLOAD: i32 = 2;
|
|
pub const FINISH_CONFIGURATION: i32 = 3;
|
|
pub const KEEP_ALIVE: i32 = 4;
|
|
pub const PONG: i32 = 5;
|
|
pub const RESOURCE_PACK: i32 = 6;
|
|
pub const SELECT_KNOWN_PACKS: i32 = 7;
|
|
pub const CUSTOM_CLICK_ACTION: i32 = 8;
|
|
pub const ACCEPT_CODE_OF_CONDUCT: i32 = 9;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"client_information",
|
|
"cookie_response",
|
|
"custom_payload",
|
|
"finish_configuration",
|
|
"keep_alive",
|
|
"pong",
|
|
"resource_pack",
|
|
"select_known_packs",
|
|
"custom_click_action",
|
|
"accept_code_of_conduct",
|
|
];
|
|
}
|
|
}
|
|
pub mod play {
|
|
pub mod clientbound {
|
|
pub const BUNDLE_DELIMITER: i32 = 0;
|
|
pub const ADD_ENTITY: i32 = 1;
|
|
pub const ANIMATE: i32 = 2;
|
|
pub const AWARD_STATS: i32 = 3;
|
|
pub const BLOCK_CHANGED_ACK: i32 = 4;
|
|
pub const BLOCK_DESTRUCTION: i32 = 5;
|
|
pub const BLOCK_ENTITY_DATA: i32 = 6;
|
|
pub const BLOCK_EVENT: i32 = 7;
|
|
pub const BLOCK_UPDATE: i32 = 8;
|
|
pub const BOSS_EVENT: i32 = 9;
|
|
pub const CHANGE_DIFFICULTY: i32 = 10;
|
|
pub const CHUNK_BATCH_FINISHED: i32 = 11;
|
|
pub const CHUNK_BATCH_START: i32 = 12;
|
|
pub const CHUNKS_BIOMES: i32 = 13;
|
|
pub const CLEAR_TITLES: i32 = 14;
|
|
pub const COMMAND_SUGGESTIONS: i32 = 15;
|
|
pub const COMMANDS: i32 = 16;
|
|
pub const CONTAINER_CLOSE: i32 = 17;
|
|
pub const CONTAINER_SET_CONTENT: i32 = 18;
|
|
pub const CONTAINER_SET_DATA: i32 = 19;
|
|
pub const CONTAINER_SET_SLOT: i32 = 20;
|
|
pub const COOKIE_REQUEST: i32 = 21;
|
|
pub const COOLDOWN: i32 = 22;
|
|
pub const CUSTOM_CHAT_COMPLETIONS: i32 = 23;
|
|
pub const CUSTOM_PAYLOAD: i32 = 24;
|
|
pub const DAMAGE_EVENT: i32 = 25;
|
|
pub const DEBUG_BLOCK_VALUE: i32 = 26;
|
|
pub const DEBUG_CHUNK_VALUE: i32 = 27;
|
|
pub const DEBUG_ENTITY_VALUE: i32 = 28;
|
|
pub const DEBUG_EVENT: i32 = 29;
|
|
pub const DEBUG_SAMPLE: i32 = 30;
|
|
pub const DELETE_CHAT: i32 = 31;
|
|
pub const DISCONNECT: i32 = 32;
|
|
pub const DISGUISED_CHAT: i32 = 33;
|
|
pub const ENTITY_EVENT: i32 = 34;
|
|
pub const ENTITY_POSITION_SYNC: i32 = 35;
|
|
pub const EXPLODE: i32 = 36;
|
|
pub const ADD_TRANSIENT_BLOCK: i32 = 37;
|
|
pub const FORGET_LEVEL_CHUNK: i32 = 38;
|
|
pub const GAME_EVENT: i32 = 39;
|
|
pub const GAME_RULE_VALUES: i32 = 40;
|
|
pub const GAME_TEST_HIGHLIGHT_POS: i32 = 41;
|
|
pub const MOUNT_SCREEN_OPEN: i32 = 42;
|
|
pub const HURT_ANIMATION: i32 = 43;
|
|
pub const INITIALIZE_BORDER: i32 = 44;
|
|
pub const KEEP_ALIVE: i32 = 45;
|
|
pub const LEVEL_CHUNK_WITH_LIGHT: i32 = 46;
|
|
pub const LEVEL_EVENT: i32 = 47;
|
|
pub const LEVEL_PARTICLES: i32 = 48;
|
|
pub const LIGHT_UPDATE: i32 = 49;
|
|
pub const LOGIN: i32 = 50;
|
|
pub const LOW_DISK_SPACE_WARNING: i32 = 51;
|
|
pub const MAP_ITEM_DATA: i32 = 52;
|
|
pub const MERCHANT_OFFERS: i32 = 53;
|
|
pub const MOVE_ENTITY_POS: i32 = 54;
|
|
pub const MOVE_ENTITY_POS_ROT: i32 = 55;
|
|
pub const MOVE_MINECART_ALONG_TRACK: i32 = 56;
|
|
pub const MOVE_ENTITY_ROT: i32 = 57;
|
|
pub const MOVE_VEHICLE: i32 = 58;
|
|
pub const OPEN_BOOK: i32 = 59;
|
|
pub const OPEN_SCREEN: i32 = 60;
|
|
pub const OPEN_SIGN_EDITOR: i32 = 61;
|
|
pub const PING: i32 = 62;
|
|
pub const PONG_RESPONSE: i32 = 63;
|
|
pub const PLACE_GHOST_RECIPE: i32 = 64;
|
|
pub const PLAYER_ABILITIES: i32 = 65;
|
|
pub const PLAYER_CHAT: i32 = 66;
|
|
pub const PLAYER_COMBAT_END: i32 = 67;
|
|
pub const PLAYER_COMBAT_ENTER: i32 = 68;
|
|
pub const PLAYER_COMBAT_KILL: i32 = 69;
|
|
pub const PLAYER_INFO_REMOVE: i32 = 70;
|
|
pub const PLAYER_INFO_UPDATE: i32 = 71;
|
|
pub const PLAYER_LOOK_AT: i32 = 72;
|
|
pub const PLAYER_POSITION: i32 = 73;
|
|
pub const PLAYER_ROTATION: i32 = 74;
|
|
pub const RECIPE_BOOK_ADD: i32 = 75;
|
|
pub const RECIPE_BOOK_REMOVE: i32 = 76;
|
|
pub const RECIPE_BOOK_SETTINGS: i32 = 77;
|
|
pub const REMOVE_ENTITIES: i32 = 78;
|
|
pub const REMOVE_MOB_EFFECT: i32 = 79;
|
|
pub const RESET_SCORE: i32 = 80;
|
|
pub const RESOURCE_PACK_POP: i32 = 81;
|
|
pub const RESOURCE_PACK_PUSH: i32 = 82;
|
|
pub const POST_EFFECTS: i32 = 83;
|
|
pub const RESPAWN: i32 = 84;
|
|
pub const ROTATE_HEAD: i32 = 85;
|
|
pub const SECTION_BLOCKS_UPDATE: i32 = 86;
|
|
pub const SELECT_ADVANCEMENTS_TAB: i32 = 87;
|
|
pub const SERVER_DATA: i32 = 88;
|
|
pub const SET_ACTION_BAR_TEXT: i32 = 89;
|
|
pub const SET_BORDER_CENTER: i32 = 90;
|
|
pub const SET_BORDER_LERP_SIZE: i32 = 91;
|
|
pub const SET_BORDER_SIZE: i32 = 92;
|
|
pub const SET_BORDER_WARNING_DELAY: i32 = 93;
|
|
pub const SET_BORDER_WARNING_DISTANCE: i32 = 94;
|
|
pub const SET_CAMERA: i32 = 95;
|
|
pub const SET_CHUNK_CACHE_CENTER: i32 = 96;
|
|
pub const SET_CHUNK_CACHE_RADIUS: i32 = 97;
|
|
pub const SET_CURSOR_ITEM: i32 = 98;
|
|
pub const SET_DEFAULT_SPAWN_POSITION: i32 = 99;
|
|
pub const SET_DISPLAY_OBJECTIVE: i32 = 100;
|
|
pub const SET_ENTITY_DATA: i32 = 101;
|
|
pub const SET_ENTITY_LINK: i32 = 102;
|
|
pub const SET_ENTITY_MOTION: i32 = 103;
|
|
pub const SET_EQUIPMENT: i32 = 104;
|
|
pub const SET_EXPERIENCE: i32 = 105;
|
|
pub const SET_HEALTH: i32 = 106;
|
|
pub const SET_HELD_SLOT: i32 = 107;
|
|
pub const SET_OBJECTIVE: i32 = 108;
|
|
pub const SET_PASSENGERS: i32 = 109;
|
|
pub const SET_PLAYER_INVENTORY: i32 = 110;
|
|
pub const SET_PLAYER_TEAM: i32 = 111;
|
|
pub const SET_SCORE: i32 = 112;
|
|
pub const SET_SIMULATION_DISTANCE: i32 = 113;
|
|
pub const SET_SUBTITLE_TEXT: i32 = 114;
|
|
pub const SET_TIME: i32 = 115;
|
|
pub const SET_TITLE_TEXT: i32 = 116;
|
|
pub const SET_TITLES_ANIMATION: i32 = 117;
|
|
pub const SOUND_ENTITY: i32 = 118;
|
|
pub const SOUND: i32 = 119;
|
|
pub const START_CONFIGURATION: i32 = 120;
|
|
pub const STOP_SOUND: i32 = 121;
|
|
pub const STORE_COOKIE: i32 = 122;
|
|
pub const SWING_ANIMATION: i32 = 123;
|
|
pub const SYSTEM_CHAT: i32 = 124;
|
|
pub const TAB_LIST: i32 = 125;
|
|
pub const TAG_QUERY: i32 = 126;
|
|
pub const TAKE_ITEM_ENTITY: i32 = 127;
|
|
pub const TELEPORT_ENTITY: i32 = 128;
|
|
pub const TEST_INSTANCE_BLOCK_STATUS: i32 = 129;
|
|
pub const TICKING_STATE: i32 = 130;
|
|
pub const TICKING_STEP: i32 = 131;
|
|
pub const TRANSFER: i32 = 132;
|
|
pub const UPDATE_ADVANCEMENTS: i32 = 133;
|
|
pub const UPDATE_ATTRIBUTES: i32 = 134;
|
|
pub const UPDATE_MOB_EFFECT: i32 = 135;
|
|
pub const UPDATE_RECIPES: i32 = 136;
|
|
pub const UPDATE_TAGS: i32 = 137;
|
|
pub const PROJECTILE_POWER: i32 = 138;
|
|
pub const CUSTOM_REPORT_DETAILS: i32 = 139;
|
|
pub const SERVER_LINKS: i32 = 140;
|
|
pub const WAYPOINT: i32 = 141;
|
|
pub const CLEAR_DIALOG: i32 = 142;
|
|
pub const SHOW_DIALOG: i32 = 143;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"bundle_delimiter",
|
|
"add_entity",
|
|
"animate",
|
|
"award_stats",
|
|
"block_changed_ack",
|
|
"block_destruction",
|
|
"block_entity_data",
|
|
"block_event",
|
|
"block_update",
|
|
"boss_event",
|
|
"change_difficulty",
|
|
"chunk_batch_finished",
|
|
"chunk_batch_start",
|
|
"chunks_biomes",
|
|
"clear_titles",
|
|
"command_suggestions",
|
|
"commands",
|
|
"container_close",
|
|
"container_set_content",
|
|
"container_set_data",
|
|
"container_set_slot",
|
|
"cookie_request",
|
|
"cooldown",
|
|
"custom_chat_completions",
|
|
"custom_payload",
|
|
"damage_event",
|
|
"debug/block_value",
|
|
"debug/chunk_value",
|
|
"debug/entity_value",
|
|
"debug/event",
|
|
"debug_sample",
|
|
"delete_chat",
|
|
"disconnect",
|
|
"disguised_chat",
|
|
"entity_event",
|
|
"entity_position_sync",
|
|
"explode",
|
|
"add_transient_block",
|
|
"forget_level_chunk",
|
|
"game_event",
|
|
"game_rule_values",
|
|
"game_test_highlight_pos",
|
|
"mount_screen_open",
|
|
"hurt_animation",
|
|
"initialize_border",
|
|
"keep_alive",
|
|
"level_chunk_with_light",
|
|
"level_event",
|
|
"level_particles",
|
|
"light_update",
|
|
"login",
|
|
"low_disk_space_warning",
|
|
"map_item_data",
|
|
"merchant_offers",
|
|
"move_entity_pos",
|
|
"move_entity_pos_rot",
|
|
"move_minecart_along_track",
|
|
"move_entity_rot",
|
|
"move_vehicle",
|
|
"open_book",
|
|
"open_screen",
|
|
"open_sign_editor",
|
|
"ping",
|
|
"pong_response",
|
|
"place_ghost_recipe",
|
|
"player_abilities",
|
|
"player_chat",
|
|
"player_combat_end",
|
|
"player_combat_enter",
|
|
"player_combat_kill",
|
|
"player_info_remove",
|
|
"player_info_update",
|
|
"player_look_at",
|
|
"player_position",
|
|
"player_rotation",
|
|
"recipe_book_add",
|
|
"recipe_book_remove",
|
|
"recipe_book_settings",
|
|
"remove_entities",
|
|
"remove_mob_effect",
|
|
"reset_score",
|
|
"resource_pack_pop",
|
|
"resource_pack_push",
|
|
"post_effects",
|
|
"respawn",
|
|
"rotate_head",
|
|
"section_blocks_update",
|
|
"select_advancements_tab",
|
|
"server_data",
|
|
"set_action_bar_text",
|
|
"set_border_center",
|
|
"set_border_lerp_size",
|
|
"set_border_size",
|
|
"set_border_warning_delay",
|
|
"set_border_warning_distance",
|
|
"set_camera",
|
|
"set_chunk_cache_center",
|
|
"set_chunk_cache_radius",
|
|
"set_cursor_item",
|
|
"set_default_spawn_position",
|
|
"set_display_objective",
|
|
"set_entity_data",
|
|
"set_entity_link",
|
|
"set_entity_motion",
|
|
"set_equipment",
|
|
"set_experience",
|
|
"set_health",
|
|
"set_held_slot",
|
|
"set_objective",
|
|
"set_passengers",
|
|
"set_player_inventory",
|
|
"set_player_team",
|
|
"set_score",
|
|
"set_simulation_distance",
|
|
"set_subtitle_text",
|
|
"set_time",
|
|
"set_title_text",
|
|
"set_titles_animation",
|
|
"sound_entity",
|
|
"sound",
|
|
"start_configuration",
|
|
"stop_sound",
|
|
"store_cookie",
|
|
"swing_animation",
|
|
"system_chat",
|
|
"tab_list",
|
|
"tag_query",
|
|
"take_item_entity",
|
|
"teleport_entity",
|
|
"test_instance_block_status",
|
|
"ticking_state",
|
|
"ticking_step",
|
|
"transfer",
|
|
"update_advancements",
|
|
"update_attributes",
|
|
"update_mob_effect",
|
|
"update_recipes",
|
|
"update_tags",
|
|
"projectile_power",
|
|
"custom_report_details",
|
|
"server_links",
|
|
"waypoint",
|
|
"clear_dialog",
|
|
"show_dialog",
|
|
];
|
|
}
|
|
pub mod serverbound {
|
|
pub const ACCEPT_TELEPORTATION: i32 = 0;
|
|
pub const ATTACK: i32 = 1;
|
|
pub const BLOCK_ENTITY_TAG_QUERY: i32 = 2;
|
|
pub const BUNDLE_ITEM_SELECTED: i32 = 3;
|
|
pub const CHANGE_DIFFICULTY: i32 = 4;
|
|
pub const CHANGE_GAME_MODE: i32 = 5;
|
|
pub const CHAT_ACK: i32 = 6;
|
|
pub const CHAT_COMMAND: i32 = 7;
|
|
pub const CHAT_COMMAND_SIGNED: i32 = 8;
|
|
pub const CHAT: i32 = 9;
|
|
pub const CHAT_SESSION_UPDATE: i32 = 10;
|
|
pub const CHUNK_BATCH_RECEIVED: i32 = 11;
|
|
pub const CLIENT_COMMAND: i32 = 12;
|
|
pub const CLIENT_TICK_END: i32 = 13;
|
|
pub const CLIENT_INFORMATION: i32 = 14;
|
|
pub const COMMAND_SUGGESTION: i32 = 15;
|
|
pub const CONFIGURATION_ACKNOWLEDGED: i32 = 16;
|
|
pub const CONTAINER_BUTTON_CLICK: i32 = 17;
|
|
pub const CONTAINER_CLICK: i32 = 18;
|
|
pub const CONTAINER_CLOSE: i32 = 19;
|
|
pub const CONTAINER_SLOT_STATE_CHANGED: i32 = 20;
|
|
pub const COOKIE_RESPONSE: i32 = 21;
|
|
pub const CUSTOM_PAYLOAD: i32 = 22;
|
|
pub const DEBUG_SUBSCRIPTION_REQUEST: i32 = 23;
|
|
pub const EDIT_BOOK: i32 = 24;
|
|
pub const ENTITY_TAG_QUERY: i32 = 25;
|
|
pub const INTERACT: i32 = 26;
|
|
pub const JIGSAW_GENERATE: i32 = 27;
|
|
pub const KEEP_ALIVE: i32 = 28;
|
|
pub const LOCK_DIFFICULTY: i32 = 29;
|
|
pub const MOVE_PLAYER_POS: i32 = 30;
|
|
pub const MOVE_PLAYER_POS_ROT: i32 = 31;
|
|
pub const MOVE_PLAYER_ROT: i32 = 32;
|
|
pub const MOVE_PLAYER_STATUS_ONLY: i32 = 33;
|
|
pub const MOVE_VEHICLE: i32 = 34;
|
|
pub const PADDLE_BOAT: i32 = 35;
|
|
pub const PICK_ITEM_FROM_BLOCK: i32 = 36;
|
|
pub const PICK_ITEM_FROM_ENTITY: i32 = 37;
|
|
pub const PING_REQUEST: i32 = 38;
|
|
pub const PLACE_RECIPE: i32 = 39;
|
|
pub const PLAYER_ABILITIES: i32 = 40;
|
|
pub const PLAYER_ACTION: i32 = 41;
|
|
pub const PLAYER_COMMAND: i32 = 42;
|
|
pub const PLAYER_INPUT: i32 = 43;
|
|
pub const PLAYER_LOADED: i32 = 44;
|
|
pub const PONG: i32 = 45;
|
|
pub const PUNCH: i32 = 46;
|
|
pub const RECIPE_BOOK_CHANGE_SETTINGS: i32 = 47;
|
|
pub const RECIPE_BOOK_SEEN_RECIPE: i32 = 48;
|
|
pub const RENAME_ITEM: i32 = 49;
|
|
pub const RESOURCE_PACK: i32 = 50;
|
|
pub const SEEN_ADVANCEMENTS: i32 = 51;
|
|
pub const SELECT_TRADE: i32 = 52;
|
|
pub const SET_BEACON: i32 = 53;
|
|
pub const SET_CARRIED_ITEM: i32 = 54;
|
|
pub const SET_COMMAND_BLOCK: i32 = 55;
|
|
pub const SET_COMMAND_MINECART: i32 = 56;
|
|
pub const SET_CREATIVE_MODE_SLOT: i32 = 57;
|
|
pub const SET_GAME_RULE: i32 = 58;
|
|
pub const SET_JIGSAW_BLOCK: i32 = 59;
|
|
pub const SET_STRUCTURE_BLOCK: i32 = 60;
|
|
pub const SET_TEST_BLOCK: i32 = 61;
|
|
pub const SIGN_UPDATE: i32 = 62;
|
|
pub const SPECTATOR_ACTION: i32 = 63;
|
|
pub const TELEPORT_TO_ENTITY: i32 = 64;
|
|
pub const TEST_INSTANCE_BLOCK_ACTION: i32 = 65;
|
|
pub const USE_ITEM_ON: i32 = 66;
|
|
pub const USE_ITEM: i32 = 67;
|
|
pub const CUSTOM_CLICK_ACTION: i32 = 68;
|
|
/// Packet names indexed by id.
|
|
pub const NAMES: &[&str] = &[
|
|
"accept_teleportation",
|
|
"attack",
|
|
"block_entity_tag_query",
|
|
"bundle_item_selected",
|
|
"change_difficulty",
|
|
"change_game_mode",
|
|
"chat_ack",
|
|
"chat_command",
|
|
"chat_command_signed",
|
|
"chat",
|
|
"chat_session_update",
|
|
"chunk_batch_received",
|
|
"client_command",
|
|
"client_tick_end",
|
|
"client_information",
|
|
"command_suggestion",
|
|
"configuration_acknowledged",
|
|
"container_button_click",
|
|
"container_click",
|
|
"container_close",
|
|
"container_slot_state_changed",
|
|
"cookie_response",
|
|
"custom_payload",
|
|
"debug_subscription_request",
|
|
"edit_book",
|
|
"entity_tag_query",
|
|
"interact",
|
|
"jigsaw_generate",
|
|
"keep_alive",
|
|
"lock_difficulty",
|
|
"move_player_pos",
|
|
"move_player_pos_rot",
|
|
"move_player_rot",
|
|
"move_player_status_only",
|
|
"move_vehicle",
|
|
"paddle_boat",
|
|
"pick_item_from_block",
|
|
"pick_item_from_entity",
|
|
"ping_request",
|
|
"place_recipe",
|
|
"player_abilities",
|
|
"player_action",
|
|
"player_command",
|
|
"player_input",
|
|
"player_loaded",
|
|
"pong",
|
|
"punch",
|
|
"recipe_book_change_settings",
|
|
"recipe_book_seen_recipe",
|
|
"rename_item",
|
|
"resource_pack",
|
|
"seen_advancements",
|
|
"select_trade",
|
|
"set_beacon",
|
|
"set_carried_item",
|
|
"set_command_block",
|
|
"set_command_minecart",
|
|
"set_creative_mode_slot",
|
|
"set_game_rule",
|
|
"set_jigsaw_block",
|
|
"set_structure_block",
|
|
"set_test_block",
|
|
"sign_update",
|
|
"spectator_action",
|
|
"teleport_to_entity",
|
|
"test_instance_block_action",
|
|
"use_item_on",
|
|
"use_item",
|
|
"custom_click_action",
|
|
];
|
|
}
|
|
}
|
|
|
|
/// The packet name for an id, if the state and direction define it.
|
|
pub fn name(state: State, direction: Direction, id: i32) -> Option<&'static str> {
|
|
let names: &[&str] = match (state, direction) {
|
|
(State::Handshake, Direction::Serverbound) => handshake::serverbound::NAMES,
|
|
(State::Status, Direction::Clientbound) => status::clientbound::NAMES,
|
|
(State::Status, Direction::Serverbound) => status::serverbound::NAMES,
|
|
(State::Login, Direction::Clientbound) => login::clientbound::NAMES,
|
|
(State::Login, Direction::Serverbound) => login::serverbound::NAMES,
|
|
(State::Configuration, Direction::Clientbound) => configuration::clientbound::NAMES,
|
|
(State::Configuration, Direction::Serverbound) => configuration::serverbound::NAMES,
|
|
(State::Play, Direction::Clientbound) => play::clientbound::NAMES,
|
|
(State::Play, Direction::Serverbound) => play::serverbound::NAMES,
|
|
_ => &[],
|
|
};
|
|
usize::try_from(id).ok().and_then(|i| names.get(i)).copied()
|
|
}
|