From 7b00432c7bcf2535f7700feb760d7877ad5d47bc Mon Sep 17 00:00:00 2001 From: extremeheat Date: Tue, 16 Feb 2021 03:24:25 -0500 Subject: [PATCH] protocol updates --- data/new/proto.yml | 513 ++++++++++++++++++++++++-------- data/new/types.yaml | 192 ++++++++++-- data/newproto.json | 703 ++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 1218 insertions(+), 190 deletions(-) diff --git a/data/new/proto.yml b/data/new/proto.yml index a3fe763..9727a76 100644 --- a/data/new/proto.yml +++ b/data/new/proto.yml @@ -40,7 +40,7 @@ nbt: native packet_login: !id: 0x01 - !bound: client + !bound: server protocol_version: i32 # The combined size of the `chain` and `client_data` payload_size: varint @@ -52,7 +52,7 @@ packet_login: packet_play_status: !id: 0x02 - !bound: server + !bound: client status: i32 => # Sent after Login has been successfully decoded and the player has logged in 0: login_success @@ -74,7 +74,7 @@ packet_play_status: packet_server_to_client_handshake: !id: 0x03 - !bound: server + !bound: client # Contains the salt to complete the Diffie-Hellman key exchange token: string @@ -85,12 +85,12 @@ packet_server_to_client_handshake: # It has no fields. packet_client_to_server_handshake: !id: 0x04 - !bound: client + !bound: server # Sent by the server to disconnect a client. packet_disconnect: !id: 0x05 - !bound: server + !bound: client # Specifies if the disconnection screen should be hidden when the client is disconnected, # meaning it will be sent directly to the main menu. hide_disconnect_reason: bool @@ -100,7 +100,7 @@ packet_disconnect: packet_resource_packs_info: !id: 0x06 - !bound: server + !bound: client # If the resource pack requires the client accept it. must_accept: bool # If scripting is enabled. @@ -114,7 +114,7 @@ packet_resource_packs_info: packet_resource_pack_stack: !id: 0x07 - !bound: server + !bound: client # If the resource pack must be accepted for the player to join the server. must_accept: bool # [inline] @@ -127,7 +127,7 @@ packet_resource_pack_stack: packet_resource_pack_client_response: !id: 0x08 - !bound: client + !bound: server response_status: u8 => 0: none 1: refused @@ -144,6 +144,8 @@ packet_resource_pack_client_response: packet_text: !id: 0x09 !bound: both + # TextType is the type of the text sent. When a client sends this to the server, it should always be + # TextTypeChat. If the server sends it, it may be one of the other text types above. type: u8 => 0: raw 1: chat @@ -162,7 +164,7 @@ packet_text: needs_translation: bool _: type? if chat or whisper or announcement: - sourceName: string + source_name: string if raw or tip or system or json_whisper or json: message: string if translation or popup or jukebox_popup: @@ -182,7 +184,7 @@ packet_text: # of synchronizing time between server and client. packet_set_time: !id: 0x0a - !bound: server + !bound: client # Time is the current time. The time is not limited to 24000 (time of day), but continues # progressing after that. time: zigzag32 @@ -190,7 +192,7 @@ packet_set_time: # Sent by the server to send information about the world the player will be spawned in. packet_start_game: !id: 0x0b - !bound: server + !bound: client # The unique ID of the player. The unique ID is a value that remains consistent across # different sessions of the same world, but most unofficial servers simply fill the # runtime ID of the entity out for this field. @@ -344,9 +346,10 @@ packet_start_game: multiplayer_correlation_id: string server_authoritative_inventory: bool + packet_add_player: !id: 0x0c - !bound: server + !bound: client # UUID is the UUID of the player. It is the same UUID that the client sent in the # Login packet at the start of the session. A player with this UUID must exist # in the player list (built up using the Player List packet) for it to show up in-game. @@ -388,7 +391,7 @@ packet_add_player: packet_add_entity: !id: 0x0d - !bound: server + !bound: client entity_id_self: zigzag64 runtime_entity_id: varint entity_type: string @@ -407,12 +410,12 @@ packet_add_entity: packet_remove_entity: !id: 0x0e - !bound: server + !bound: client entity_id_self: zigzag64 packet_add_item_entity: !id: 0x0f - !bound: server + !bound: client entity_id_self: zigzag64 runtime_entity_id: varint item: Item @@ -427,7 +430,7 @@ packet_add_item_entity: packet_take_item_entity: !id: 0x11 - !bound: server + !bound: client runtime_entity_id: varint target: varint @@ -460,7 +463,7 @@ packet_rider_jump: packet_update_block: !id: 0x15 - !bound: server + !bound: client coordinates: BlockCoordinates block_runtime_id: varint block_priority: varint @@ -468,7 +471,7 @@ packet_update_block: packet_add_painting: !id: 0x16 - !bound: server + !bound: client entity_id_self: zigzag64 runtime_entity_id: varint coordinates: BlockCoordinates @@ -493,28 +496,153 @@ packet_level_sound_event_old: packet_level_event: !id: 0x19 - !bound: server - event_id: zigzag32 + !bound: client + event: zigzag32 => + 1000: sound_click + 1001: sound_click_fail + 1002: sound_shoot + 1003: sound_door + 1004: sound_fizz + 1005: sound_ignite + 1007: sound_ghast + 1008: sound_ghast_shoot + 1009: sound_blaze_shoot + 1010: sound_door_bump + 1012: sound_door_crash + 1018: sound_enderman_teleport + 1020: sound_anvil_break + 1021: sound_anvil_use + 1022: sound_anvil_fall + 1030: sound_pop + 1032: sound_portal + 1040: sound_itemframe_add_item + 1041: sound_itemframe_remove + 1042: sound_itemframe_place + 1043: sound_itemframe_remove_item + 1044: sound_itemframe_rotate_item + 1050: sound_camera + 1051: sound_orb + 1052: sound_totem + 1060: sound_armor_stand_break + 1061: sound_armor_stand_hit + 1062: sound_armor_stand_fall + 1063: sound_armor_stand_place + 2000: particle_shoot #TODO: check 2000-2017 + 2001: particle_destroy + 2002: particle_splash + 2003: particle_eye_despawn + 2004: particle_spawn + 2006: guardian_curse + 2008: particle_block_force_field + 2009: particle_projectile_hit + 2013: particle_enderman_teleport + 2014: particle_punch_block + 3001: start_rain + 3002: start_thunder + 3003: stop_rain + 3004: stop_thunder + 3005: pause_game #data: 1 to pause, 0 to resume + 3006: pause_game_no_screen #data: 1 to pause, 0 to resume - same effect as normal pause but without screen + 3007: set_game_speed #x coordinate of pos = scale factor (default 1.0) + 3500: redstone_trigger + 3501: cauldron_explode + 3502: cauldron_dye_armor + 3503: cauldron_clean_armor + 3504: cauldron_fill_potion + 3505: cauldron_take_potion + 3506: cauldron_fill_water + 3507: cauldron_take_water + 3508: cauldron_add_dye + 3509: cauldron_clean_banner + 3600: block_start_break + 3601: block_stop_break + 4000: set_data + 9800: players_sleeping + 0x4000: add_particle_mask position: vec3f data: zigzag32 packet_block_event: !id: 0x1a - !bound: server - coordinates: BlockCoordinates - case_1: zigzag32 - case_2: zigzag32 + !bound: client + # Position is the position of the block that an event occurred at. + position: BlockCoordinates + # EventType is the type of the block event. + # The event type decides the way the event data that follows is used + type: zigzag32 => + 0: sound + 1: change_state + # EventData holds event type specific data. For chests for example, + # opening the chest means the data must be 1 + data: zigzag32 packet_entity_event: !id: 0x1b !bound: both runtime_entity_id: varint - event_id: u8 + event_id: u8 => + 1: jump + 2: hurt_animation + 3: death_animation + 4: arm_swing + 5: stop_attack + 6: tame_fail + 7: tame_success + 8: shake_wet + 9: use_item + 10: eat_grass_animation + 11: fish_hook_bubble + 12: fish_hook_position + 13: fish_hook_hook + 14: fish_hook_tease + 15: squid_ink_cloud + 16: zombie_villager_cure + 18: respawn + 19: iron_golem_offer_flower + 20: iron_golem_withdraw_flower + 21: love_particles #breeding + 22: villager_angry + 23: villager_happy + 24: witch_spell_particles + 25: firework_particles + 26: in_love_particles + 27: silverfish_spawn_animation + 28: guardian_attack + 29: witch_drink_potion + 30: witch_throw_potion + 31: minecart_tnt_prime_fuse + 32: creeper_prime_fuse + 33: air_supply_expired + 34: player_add_xp_levels + 35: elder_guardian_curse + 36: agent_arm_swing + 37: ender_dragon_death + 38: dust_particles #not sure what this is + 39: arrow_shake + + 57: eating_item + + 60: baby_animal_feed #green particles, like bonemeal on crops + 61: death_smoke_cloud + 62: complete_trade + 63: remove_leash #data 1 = cut leash + + 65: consume_totem + 66: player_check_treasure_hunter_achievement #mojang... + 67: entity_spawn #used for MinecraftEventing stuff, not needed + 68: dragon_puke #they call this puke particles + 69: item_entity_merge + 70: start_swim + 71: balloon_pop + 72: treasure_hunt + 73: agent_summon + 74: charged_crossbow + 75: fall data: zigzag32 packet_mob_effect: !id: 0x1c - !bound: server + !bound: client runtime_entity_id: varint event_id: u8 effect_id: zigzag32 @@ -524,7 +652,7 @@ packet_mob_effect: packet_update_attributes: !id: 0x1d - !bound: server + !bound: client runtime_entity_id: varint64 attributes: PlayerAttributes tick: varint64 @@ -560,7 +688,7 @@ packet_interact: packet_block_pick_request: !id: 0x22 - !bound: client + !bound: server x: zigzag32 y: zigzag32 z: zigzag32 @@ -569,21 +697,59 @@ packet_block_pick_request: packet_entity_pick_request: !id: 0x23 - !bound: client + !bound: server runtime_entity_id: lu64 selected_slot: u8 +# PlayerAction is sent by the client when it executes any action, for example starting to sprint, swim, +# starting the breaking of a block, dropping an item, etc. packet_player_action: !id: 0x24 - !bound: client + !bound: server + # EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and + # entities are generally identified in packets using this runtime ID. runtime_entity_id: varint - action_id: zigzag32 - coordinates: BlockCoordinates + # ActionType is the ID of the action that was executed by the player. It is one of the constants that may + # be found above. + action: zigzag32 => + 0: start_break + 1: abort_break + 2: stop_break + 3: get_updated_block + 4: drop_item + 5: start_sleeping + 6: stop_sleeping + 7: respawn + 8: jump + 9: start_sprint + 10: stop_sprint + 11: start_sneak + 12: stop_sneak + 13: creative_player_destroy_block + # sent when spawning in a different dimension to tell the server we spawned + 14: dimension_change_ack + 15: start_glide + 16: stop_glide + 17: build_denied + 18: continue_break + 19: change_skin + # no longer used + 20: set_enchatnment_seed + 21: swimming + 22: stop_swimming + 23: start_spin_attack + 24: stop_spin_attack + 25: ineract_block + # BlockPosition is the position of the target block, if the action with the ActionType set concerned a + # block. If that is not the case, the block position will be zero. + position: BlockCoordinates + # BlockFace is the face of the target block that was touched. If the action with the ActionType set + # concerned a block. If not, the face is always 0. face: zigzag32 packet_hurt_armor: !id: 0x26 - !bound: server + !bound: client health: zigzag32 packet_set_entity_data: @@ -601,7 +767,7 @@ packet_set_entity_motion: packet_set_entity_link: !id: 0x29 - !bound: server + !bound: client ridden_id: zigzag64 rider_id: zigzag64 link_type: u8 @@ -609,12 +775,12 @@ packet_set_entity_link: packet_set_health: !id: 0x2a - !bound: server + !bound: client health: zigzag32 packet_set_spawn_position: !id: 0x2b - !bound: server + !bound: client spawn_type: zigzag32 coordinates: BlockCoordinates dimension: zigzag32 @@ -637,7 +803,7 @@ packet_respawn: packet_container_open: !id: 0x2e - !bound: server + !bound: client window_id: u8 type: u8 coordinates: BlockCoordinates @@ -672,14 +838,14 @@ packet_inventory_slot: packet_container_set_data: !id: 0x33 - !bound: server + !bound: client window_id: u8 property: zigzag32 value: zigzag32 packet_crafting_data: !id: 0x34 - !bound: server + !bound: client recipes: Recipes potion_type_recipes: PotionTypeRecipes potion_container_recipes: PotionContainerChangeRecipes @@ -696,7 +862,7 @@ packet_crafting_event: packet_gui_data_pick_item: !id: 0x36 - !bound: server + !bound: client packet_adventure_settings: !id: 0x37 @@ -711,12 +877,12 @@ packet_adventure_settings: packet_block_entity_data: !id: 0x38 !bound: both - coordinates: BlockCoordinates + position: BlockCoordinates nbt: nbt packet_player_input: !id: 0x39 - !bound: client + !bound: server motion_x: lf32 motion_z: lf32 jumping: bool @@ -724,25 +890,25 @@ packet_player_input: packet_level_chunk: !id: 0x3a - !bound: server - chunk_x: zigzag32 - chunk_z: zigzag32 + !bound: client + x: zigzag32 + z: zigzag32 sub_chunk_count: varint column: Chunks packet_set_commands_enabled: !id: 0x3b - !bound: server + !bound: client enabled: bool packet_set_difficulty: !id: 0x3c - !bound: server + !bound: client difficulty: varint packet_change_dimension: !id: 0x3d - !bound: server + !bound: client dimension: zigzag32 position: vec3f respawn: bool @@ -754,23 +920,23 @@ packet_set_player_game_type: packet_player_list: !id: 0x3f - !bound: server + !bound: client records: PlayerRecords packet_simple_event: !id: 0x40 - !bound: server + !bound: client event_type: lu16 packet_spawn_experience_orb: !id: 0x42 - !bound: server + !bound: client position: vec3f count: zigzag32 packet_clientbound_map_item_data: !id: 0x43 - !bound: server + !bound: client mapinfo: MapInfo packet_map_info_request: @@ -785,7 +951,7 @@ packet_request_chunk_radius: packet_chunk_radius_update: !id: 0x46 - !bound: server + !bound: client chunk_radius: zigzag32 packet_item_frame_drop_item: @@ -795,52 +961,137 @@ packet_item_frame_drop_item: packet_game_rules_changed: !id: 0x48 - !bound: server + !bound: client rules: GameRules packet_camera: !id: 0x49 - !bound: server + !bound: client unknown1: zigzag64 unknown2: zigzag64 packet_boss_event: !id: 0x4a - !bound: server + !bound: both boss_entity_id: zigzag64 - event_type: varint + type: varint => + # S2C: Shows the boss-bar to the player. + 0: show_bar + # C2S: Registers a player to a boss fight. + 1: register_player + # S2C: Removes the boss-bar from the client. + 2: hide_bar + # C2S: Unregisters a player from a boss fight. + 3: unregister_player + # S2C: Sets the bar percentage. + 4: set_bar_progress + # S2C: Sets title of the bar. + 5: set_bar_title + # S2C: darkens the sky + 6: update_properties + # S2C: Not implemented :( Intended to alter bar appearance, but these currently produce no effect on client-side whatsoever. + 7: texture + _: type? + if register_player or unregister_player: + player_id: zigzag64 + if show: + title: string + bar_progress: lf32 + if update_properties: + darkness_factor: li16 + if texture: + color: varint + overlay: varint + if set_bar_progress: + bar_progress: lf32 + if set_bar_title: + title: string packet_show_credits: !id: 0x4b - !bound: server + !bound: client runtime_entity_id: varint status: zigzag32 packet_available_commands: !id: 0x4c - !bound: server + !bound: client + # enum_values: string[]varint + # suffixes: string[]varint + # enums: []varint + # name: string + # # The length of the array below + # values_len: varint + # # Not read from stream: instead calculated from the `values_len` field + # # If the values_len < 0xff => byte + # # If the values_len < 0xffff => short + # # If the values_len < 0xffffff => int + # enum_typex: u8 => + # 0: byte + # 1: short + # 2: int + # valuex: []varint + # # S: bool + # ix: ../enum_typex? + # if byte: u8 + # if short: lu16 + # if int: lu32 +# CommandRequest is sent by the client to request the execution of a server-side command. Although some +# servers support sending commands using the Text packet, this packet is guaranteed to have the correct +# result. packet_command_request: !id: 0x4d - !bound: client + !bound: server + # CommandLine is the raw entered command line. The client does no parsing of the command line by itself + # (unlike it did in the early stages), but lets the server do that. command: string - command_type: varint - unknown_uuid: uuid - request_id: string - unknown: bool + # Origin holds information about the command sender that will be returnd back in the command response + origin: CommandOrigin + # Internal specifies if the command request internal. Setting it to false seems to work and the usage of + # this field is not known. + interval: bool + packet_command_block_update: !id: 0x4e - !bound: client + !bound: server is_block: bool packet_command_output: !id: 0x4f - !bound: server + !bound: client + # CommandOrigin is the data specifying the origin of the command. In other words, the source that the + # command request was from, such as the player itself or a websocket server. The client forwards the + # messages in this packet to the right origin, depending on what is sent here. + origin: CommandOrigin + # OutputType specifies the type of output that is sent. The OutputType sent by vanilla games appears to + # be 3, which seems to work. + output_type: i8 + # SuccessCount is the amount of times that a command was executed successfully as a result of the command + # that was requested. For servers, this is usually a rather meaningless fields, but for vanilla, this is + # applicable for commands created with Functions. + success_count: varint + # OutputMessages is a list of all output messages that should be sent to the player. Whether they are + # shown or not, depends on the type of the messages. + output: []varint + # Success indicates if the output message was one of a successful command execution. If set to true, the + # output message is by default coloured white, whereas if set to false, the message is by default + # coloured red. + success: bool + # Message is the message that is sent to the client in the chat window. It may either be simply a + # message or a translated built-in string like 'commands.tp.success.coordinates', combined with specific + # parameters below. + message_id: string + # Parameters is a list of parameters that serve to supply the message sent with additional information, + # such as the position that a player was teleported to or the effect that was applied to an entity. + # These parameters only apply for the Minecraft built-in command output. + paramaters: string[]varint + packet_update_trade: !id: 0x50 - !bound: server + !bound: client window_id: u8 window_type: u8 unknown0: varint @@ -854,7 +1105,7 @@ packet_update_trade: packet_update_equipment: !id: 0x51 - !bound: server + !bound: client window_id: u8 window_type: u8 unknown: u8 @@ -863,7 +1114,7 @@ packet_update_equipment: packet_resource_pack_data_info: !id: 0x52 - !bound: server + !bound: client package_id: string max_chunk_size: lu32 chunk_count: lu32 @@ -874,7 +1125,7 @@ packet_resource_pack_data_info: packet_resource_pack_chunk_data: !id: 0x53 - !bound: server + !bound: client package_id: string chunk_index: lu32 progress: lu64 @@ -882,19 +1133,19 @@ packet_resource_pack_chunk_data: packet_resource_pack_chunk_request: !id: 0x54 - !bound: client + !bound: server package_id: string chunk_index: lu32 packet_transfer: !id: 0x55 - !bound: server + !bound: client server_address: string port: lu16 packet_play_sound: !id: 0x56 - !bound: server + !bound: client name: string coordinates: BlockCoordinates volume: lf32 @@ -902,13 +1153,13 @@ packet_play_sound: packet_stop_sound: !id: 0x57 - !bound: server + !bound: client name: string stop_all: bool packet_set_title: !id: 0x58 - !bound: server + !bound: client type: zigzag32 text: string fade_in_time: zigzag32 @@ -917,22 +1168,22 @@ packet_set_title: packet_add_behavior_tree: !id: 0x59 - !bound: server + !bound: client behaviortree: string packet_structure_block_update: !id: 0x5a - !bound: server + !bound: client packet_show_store_offer: !id: 0x5b - !bound: server + !bound: client unknown0: string unknown1: bool packet_purchase_receipt: !id: 0x5c - !bound: client + !bound: server packet_player_skin: !id: 0x5d @@ -945,21 +1196,43 @@ packet_player_skin: packet_sub_client_login: !id: 0x5e - !bound: server + !bound: client packet_initiate_web_socket_connection: !id: 0x5f - !bound: server + !bound: client server: string packet_set_last_hurt_by: !id: 0x60 - !bound: server + !bound: client unknown: varint packet_book_edit: !id: 0x61 - !bound: server + !bound: client + type: u8 => + 0: replace_page + 1: add_page + 2: delete_page + 3: swap_pages + 4: sign + slot: u8 + _: type? + if replace_page or add_page: + page_number: u8 + text: string + photo_name: string + if delete_page: + page_number: u8 + if swap_pages: + page1: u8 + page2: u8 + if sign: + title: string + author: string + xuid: string + packet_npc_request: !id: 0x62 @@ -971,51 +1244,51 @@ packet_npc_request: packet_photo_transfer: !id: 0x63 - !bound: client + !bound: server file_name: string image_data: string unknown2: string packet_modal_form_request: !id: 0x64 - !bound: server + !bound: client form_id: varint data: string packet_modal_form_response: !id: 0x65 - !bound: client + !bound: server form_id: varint data: string packet_server_settings_request: !id: 0x66 - !bound: client + !bound: server packet_server_settings_response: !id: 0x67 - !bound: server + !bound: client form_id: varint data: string packet_show_profile: !id: 0x68 - !bound: server + !bound: client xuid: string packet_set_default_game_type: !id: 0x69 - !bound: server + !bound: client gamemode: varint packet_remove_objective: !id: 0x6a - !bound: server + !bound: client objective_name: string packet_set_display_objective: !id: 0x6b - !bound: server + !bound: client display_slot: string objective_name: string display_name: string @@ -1024,7 +1297,7 @@ packet_set_display_objective: packet_set_score: !id: 0x6c - !bound: server + !bound: client entries: ScoreEntries packet_lab_table: @@ -1038,7 +1311,7 @@ packet_lab_table: packet_update_block_synced: !id: 0x6e - !bound: server + !bound: client coordinates: BlockCoordinates block_runtime_id: varint block_priority: varint @@ -1048,23 +1321,23 @@ packet_update_block_synced: packet_move_entity_delta: !id: 0x6f - !bound: server + !bound: client runtime_entity_id: varint flags: lu16 packet_set_scoreboard_identity: !id: 0x70 - !bound: server + !bound: client entries: ScoreboardIdentityEntries packet_set_local_player_as_initialized: !id: 0x71 - !bound: client + !bound: server runtime_entity_id: varint packet_update_soft_enum: !id: 0x72 - !bound: server + !bound: client packet_network_stack_latency: !id: 0x73 @@ -1080,7 +1353,7 @@ packet_script_custom_event: packet_spawn_particle_effect: !id: 0x76 - !bound: server + !bound: client dimension_id: u8 entity_id: zigzag64 position: vec3f @@ -1088,7 +1361,7 @@ packet_spawn_particle_effect: packet_available_entity_identifiers: !id: 0x77 - !bound: server + !bound: client nbt: nbt packet_level_sound_event_v2: @@ -1103,13 +1376,13 @@ packet_level_sound_event_v2: packet_network_chunk_publisher_update: !id: 0x79 - !bound: server + !bound: client coordinates: BlockCoordinates radius: varint packet_biome_definition_list: !id: 0x7a - !bound: server + !bound: client nbt: nbt packet_level_sound_event: @@ -1124,15 +1397,15 @@ packet_level_sound_event: packet_level_event_generic: !id: 0x7c - !bound: server + !bound: client packet_lectern_update: !id: 0x7d - !bound: server + !bound: client packet_video_stream_connect: !id: 0x7e - !bound: server + !bound: client server_uri: string frame_send_frequency: lf32 action: u8 @@ -1146,32 +1419,32 @@ packet_client_cache_status: packet_on_screen_texture_animation: !id: 0x82 - !bound: server + !bound: client packet_map_create_locked_copy: !id: 0x83 - !bound: server + !bound: client packet_structure_template_data_export_request: !id: 0x84 - !bound: server + !bound: client packet_structure_template_data_export_response: !id: 0x85 - !bound: server + !bound: client packet_update_block_properties: !id: 0x86 - !bound: server + !bound: client nbt: nbt packet_client_cache_blob_status: !id: 0x87 - !bound: server + !bound: client packet_client_cache_miss_response: !id: 0x88 - !bound: server + !bound: client packet_network_settings: !id: 0x8f @@ -1181,31 +1454,31 @@ packet_network_settings: packet_creative_content: !id: 0x91 - !bound: server + !bound: client items: ItemStacks packet_player_enchant_options: !id: 0x92 - !bound: server + !bound: client enchant_options: EnchantOptions packet_item_stack_request: !id: 0x93 - !bound: client + !bound: server requests: ItemStackRequests packet_item_stack_response: !id: 0x94 - !bound: server + !bound: client responses: ItemStackResponses packet_update_player_game_type: !id: 0x97 - !bound: client + !bound: server packet_packet_violation_warning: !id: 0x9c - !bound: client + !bound: server violation_type: zigzag32 severity: zigzag32 packet_id: zigzag32 @@ -1213,11 +1486,11 @@ packet_packet_violation_warning: packet_item_component: !id: 0xa2 - !bound: server + !bound: client entries: ItemComponentList packet_filter_text_packet: !id: 0xa3 - !bound: server + !bound: client text: string from_server: bool diff --git a/data/new/types.yaml b/data/new/types.yaml index f53f36d..528a0ba 100644 --- a/data/new/types.yaml +++ b/data/new/types.yaml @@ -104,27 +104,146 @@ vec2f: z: lf32 MetadataDictionary: []varint - key: varint + # https://github.com/pmmp/PocketMine-MP/blob/stable/src/pocketmine/entity/Entity.php#L101 + key: varint => + 0: index + 1: health #int (minecart/boat) + 2: variant #int + 3: color #byte + 4: nametag #string + 5: owner_eid #long + 6: target_eid #long + 7: air #short + 8: potion_color #int (ARGB!) + 9: potion_ambient #byte + 10: jump_duration #long + 11: hurt_time #int (minecart/boat) + 12: hurt_direction #int (minecart/boat) + 13: paddle_time_left #float + 14: paddle_time_right #float + 15: experience_value #int (xp orb) + 16: minecart_display_block #int (id | (data << 16)) + 17: minecart_display_offset #int + 18: minecart_has_display #byte (must be 1 for minecart to show block inside) + 20: old_swell + 21: swell_dir + 22: charge_amount + 23: enderman_held_runtime_id #short + 24: entity_age #short + 26: player_flags + 27: player_index + 28: player_bed_position #block coords + 29: fireball_power_x #float + 30: fireball_power_y + 31: fireball_power_z + 32: aux_power + 33: fish_x + 34: fish_z + 35: fish_angle + 36: potion_aux_value #short + 37: lead_holder_eid #long + 38: scale + 39: interactive_tag #string + 40: npc_skin_id #string + 41: url_tag #string + 42: max_airdata_max_air + 43: mark_variant #int + 44: container_type #byte + 45: container_base_size #int + 46: container_extra_slots_per_strength #int + 47: block_target + 48: wither_invulnerable_ticks #int + 49: wither_target_1 #long + 50: wither_target_2 #long + 51: wither_target_3 #long + 52: aerial_attack + 53: boundingbox_width + 54: boundingbox_height + 55: fuse_length + 56: rider_seat_position #vector3f + 57: rider_rotation_locked #byte + 58: rider_max_rotation #float + 59: rider_min_rotation #float + 60: area_effect_cloud_radius #float + 61: area_effect_cloud_waiting #int + 62: area_effect_cloud_particle_id #int + 63: shulker_peek_id #int + 64: shulker_attach_face #byte + 65: shulker_attached #short + 66: shulker_attach_pos + 67: trading_player_eid #long + 68: trading_career + 69: has_command_block + 70: command_block_command #string + 71: command_block_last_output #string + 72: command_block_track_output #byte + 73: controlling_rider_seat_number #byte + 74: strength #int + 75: max_strength #int + 76: spell_casting_color #int + 77: limited_life + 78: armor_stand_pose_index # int + 79: ender_crystal_time_offset # int + 80: always_show_nametag # byte + 81: color_2 # byte + 82: name_author + 83: score_tag #String + 84: balloon_attached_entity # long + 85: pufferfish_size + 86: bubble_time + 87: agent + 88: sitting_amount + 89: sitting_amount_previous + 90: eating_counter + 91: flags_extended + 92: laying_amount + 93: laying_amount_previous + 94: duration + 95: spawn_time + 96: change_rate + 97: change_on_pickup + 98: pickup_count + 99: interact_text + 100: trade_tier + 101: max_trade_tier + 102: trade_experience + 103: skin_id + 104: spawning_frames + 105: command_block_tick_delay + 106: command_block_execute_on_first_tick + 107: ambient_sound_interval + 108: ambient_sound_interval_range + 109: ambient_sound_event_name + 110: fall_damage_multiplier + 111: name_raw_text + 112: can_ride_target + 113: low_tier_cured_discount + 114: high_tier_cured_discount + 115: nearby_cured_discount + 116: nearby_cured_discount_timestamp + 117: hitbox + 118: is_buoyant + 119: buoyancy_data type: varint => - 0: BYTE - 1: SHORT - 2: INT - 3: FLOAT - 4: STRING - 5: COMPOUND_TAG - 6: POS - 7: LONG - 8: VECTOR3F + 0: byte + 1: short + 2: int + 3: float + 4: string + 5: compound + 6: vec3i + 7: long + 8: vec3f value: type? - if BYTE: i8 - if SHORT: li16 - if INT: zigzag32 - if FLOAT: lf32 - if STRING: string - if COMPOUND_TAG: nbt - if POS: vec3i - if LONG: zigzag64 - if VECTOR3F: li32 + if byte: i8 + if short: li16 + if int: zigzag32 + if float: lf32 + if string: string + if compound: nbt + if vec3i: vec3i + if long: zigzag64 + if vec3f: vec3f Links: []varint ridden_entity_id: zigzag64 @@ -455,4 +574,37 @@ ItemStackResponses: []varint ItemComponentList: []varint name: string - nbt: nbt \ No newline at end of file + nbt: nbt + +CommandOrigin: + # Origin is one of the values above that specifies the origin of the command. The origin may change, + # depending on what part of the client actually called the command. The command may be issued by a + # websocket server, for example. + type: varint => + 0: player + 1: block + 2: minecart_block + 3: dev_console + 4: test + 5: automation_player + 6: client_automation + 7: dedicated_server + 8: entity + 9: virtual + 10: game_argument + 11: entity_server + # UUID is the UUID of the command called. This UUID is a bit odd as it is not specified by the server. It + # is not clear what exactly this UUID is meant to identify, but it is unique for each command called. + uuid: uuid + # RequestID is an ID that identifies the request of the client. The server should send a CommandOrigin + # with the same request ID to ensure it can be matched with the request by the caller of the command. + # This is especially important for websocket servers and it seems that this field is only non-empty for + # these websocket servers. + request_id: string + # PlayerUniqueID is an ID that identifies the player, the same as the one found in the AdventureSettings + # packet. Filling it out with 0 seems to work. + # PlayerUniqueID is only written if Origin is CommandOriginDevConsole or CommandOriginTest. + player_entity_id: type? + if dev_console or test: + player_entity_id: zigzag64 + diff --git a/data/newproto.json b/data/newproto.json index f2a320f..7a6f93e 100644 --- a/data/newproto.json +++ b/data/newproto.json @@ -433,7 +433,132 @@ [ { "name": "key", - "type": "varint" + "type": [ + "mapper", + { + "type": "varint", + "mappings": { + "0": "index", + "1": "health", + "2": "variant", + "3": "color", + "4": "nametag", + "5": "owner_eid", + "6": "target_eid", + "7": "air", + "8": "potion_color", + "9": "potion_ambient", + "10": "jump_duration", + "11": "hurt_time", + "12": "hurt_direction", + "13": "paddle_time_left", + "14": "paddle_time_right", + "15": "experience_value", + "16": "minecart_display_block", + "17": "minecart_display_offset", + "18": "minecart_has_display", + "20": "old_swell", + "21": "swell_dir", + "22": "charge_amount", + "23": "enderman_held_runtime_id", + "24": "entity_age", + "26": "player_flags", + "27": "player_index", + "28": "player_bed_position", + "29": "fireball_power_x", + "30": "fireball_power_y", + "31": "fireball_power_z", + "32": "aux_power", + "33": "fish_x", + "34": "fish_z", + "35": "fish_angle", + "36": "potion_aux_value", + "37": "lead_holder_eid", + "38": "scale", + "39": "interactive_tag", + "40": "npc_skin_id", + "41": "url_tag", + "42": "max_airdata_max_air", + "43": "mark_variant", + "44": "container_type", + "45": "container_base_size", + "46": "container_extra_slots_per_strength", + "47": "block_target", + "48": "wither_invulnerable_ticks", + "49": "wither_target_1", + "50": "wither_target_2", + "51": "wither_target_3", + "52": "aerial_attack", + "53": "boundingbox_width", + "54": "boundingbox_height", + "55": "fuse_length", + "56": "rider_seat_position", + "57": "rider_rotation_locked", + "58": "rider_max_rotation", + "59": "rider_min_rotation", + "60": "area_effect_cloud_radius", + "61": "area_effect_cloud_waiting", + "62": "area_effect_cloud_particle_id", + "63": "shulker_peek_id", + "64": "shulker_attach_face", + "65": "shulker_attached", + "66": "shulker_attach_pos", + "67": "trading_player_eid", + "68": "trading_career", + "69": "has_command_block", + "70": "command_block_command", + "71": "command_block_last_output", + "72": "command_block_track_output", + "73": "controlling_rider_seat_number", + "74": "strength", + "75": "max_strength", + "76": "spell_casting_color", + "77": "limited_life", + "78": "armor_stand_pose_index", + "79": "ender_crystal_time_offset", + "80": "always_show_nametag", + "81": "color_2", + "82": "name_author", + "83": "score_tag", + "84": "balloon_attached_entity", + "85": "pufferfish_size", + "86": "bubble_time", + "87": "agent", + "88": "sitting_amount", + "89": "sitting_amount_previous", + "90": "eating_counter", + "91": "flags_extended", + "92": "laying_amount", + "93": "laying_amount_previous", + "94": "duration", + "95": "spawn_time", + "96": "change_rate", + "97": "change_on_pickup", + "98": "pickup_count", + "99": "interact_text", + "100": "trade_tier", + "101": "max_trade_tier", + "102": "trade_experience", + "103": "skin_id", + "104": "spawning_frames", + "105": "command_block_tick_delay", + "106": "command_block_execute_on_first_tick", + "107": "ambient_sound_interval", + "108": "ambient_sound_interval_range", + "109": "ambient_sound_event_name", + "110": "fall_damage_multiplier", + "111": "name_raw_text", + "112": "can_ride_target", + "113": "low_tier_cured_discount", + "114": "high_tier_cured_discount", + "115": "nearby_cured_discount", + "116": "nearby_cured_discount_timestamp", + "117": "hitbox", + "118": "is_buoyant", + "119": "buoyancy_data" + } + } + ] }, { "name": "type", @@ -442,15 +567,15 @@ { "type": "varint", "mappings": { - "0": "BYTE", - "1": "SHORT", - "2": "INT", - "3": "FLOAT", - "4": "STRING", - "5": "COMPOUND_TAG", - "6": "POS", - "7": "LONG", - "8": "VECTOR3F" + "0": "byte", + "1": "short", + "2": "int", + "3": "float", + "4": "string", + "5": "compound", + "6": "vec3i", + "7": "long", + "8": "vec3f" } } ] @@ -462,15 +587,15 @@ { "compareTo": "type", "fields": { - "BYTE": "i8", - "SHORT": "li16", - "INT": "zigzag32", - "FLOAT": "lf32", - "STRING": "string", - "COMPOUND_TAG": "nbt", - "POS": "vec3i", - "LONG": "zigzag64", - "VECTOR3F": "li32" + "byte": "i8", + "short": "li16", + "int": "zigzag32", + "float": "lf32", + "string": "string", + "compound": "nbt", + "vec3i": "vec3i", + "long": "zigzag64", + "vec3f": "vec3f" }, "default": "void" } @@ -2008,6 +2133,72 @@ ] } ], + "CommandOrigin": [ + "container", + [ + { + "name": "type", + "type": [ + "mapper", + { + "type": "varint", + "mappings": { + "0": "player", + "1": "block", + "2": "minecart_block", + "3": "dev_console", + "4": "test", + "5": "automation_player", + "6": "client_automation", + "7": "dedicated_server", + "8": "entity", + "9": "virtual", + "10": "game_argument", + "11": "entity_server" + } + } + ] + }, + { + "name": "uuid", + "type": "uuid" + }, + { + "name": "request_id", + "type": "string" + }, + { + "name": "player_entity_id", + "type": [ + "switch", + { + "compareTo": "type", + "fields": { + "dev_console": [ + "container", + [ + { + "name": "player_entity_id", + "type": "zigzag64" + } + ] + ], + "test": [ + "container", + [ + { + "name": "player_entity_id", + "type": "zigzag64" + } + ] + ] + }, + "default": "void" + } + ] + } + ] + ], "mcpe_packet": [ "container", [ @@ -2500,7 +2691,7 @@ "container", [ { - "name": "sourceName", + "name": "source_name", "type": "string" } ] @@ -2509,7 +2700,7 @@ "container", [ { - "name": "sourceName", + "name": "source_name", "type": "string" } ] @@ -2518,7 +2709,7 @@ "container", [ { - "name": "sourceName", + "name": "source_name", "type": "string" } ] @@ -3300,8 +3491,76 @@ "container", [ { - "name": "event_id", - "type": "zigzag32" + "name": "event", + "type": [ + "mapper", + { + "type": "zigzag32", + "mappings": { + "1000": "sound_click", + "1001": "sound_click_fail", + "1002": "sound_shoot", + "1003": "sound_door", + "1004": "sound_fizz", + "1005": "sound_ignite", + "1007": "sound_ghast", + "1008": "sound_ghast_shoot", + "1009": "sound_blaze_shoot", + "1010": "sound_door_bump", + "1012": "sound_door_crash", + "1018": "sound_enderman_teleport", + "1020": "sound_anvil_break", + "1021": "sound_anvil_use", + "1022": "sound_anvil_fall", + "1030": "sound_pop", + "1032": "sound_portal", + "1040": "sound_itemframe_add_item", + "1041": "sound_itemframe_remove", + "1042": "sound_itemframe_place", + "1043": "sound_itemframe_remove_item", + "1044": "sound_itemframe_rotate_item", + "1050": "sound_camera", + "1051": "sound_orb", + "1052": "sound_totem", + "1060": "sound_armor_stand_break", + "1061": "sound_armor_stand_hit", + "1062": "sound_armor_stand_fall", + "1063": "sound_armor_stand_place", + "2000": "particle_shoot", + "2001": "particle_destroy", + "2002": "particle_splash", + "2003": "particle_eye_despawn", + "2004": "particle_spawn", + "2006": "guardian_curse", + "2008": "particle_block_force_field", + "2009": "particle_projectile_hit", + "2013": "particle_enderman_teleport", + "2014": "particle_punch_block", + "3001": "start_rain", + "3002": "start_thunder", + "3003": "stop_rain", + "3004": "stop_thunder", + "3005": "pause_game", + "3006": "pause_game_no_screen", + "3007": "set_game_speed", + "3500": "redstone_trigger", + "3501": "cauldron_explode", + "3502": "cauldron_dye_armor", + "3503": "cauldron_clean_armor", + "3504": "cauldron_fill_potion", + "3505": "cauldron_take_potion", + "3506": "cauldron_fill_water", + "3507": "cauldron_take_water", + "3508": "cauldron_add_dye", + "3509": "cauldron_clean_banner", + "3600": "block_start_break", + "3601": "block_stop_break", + "4000": "set_data", + "9800": "players_sleeping", + "16384": "add_particle_mask" + } + } + ] }, { "name": "position", @@ -3317,15 +3576,24 @@ "container", [ { - "name": "coordinates", + "name": "position", "type": "BlockCoordinates" }, { - "name": "case_1", - "type": "zigzag32" + "name": "type", + "type": [ + "mapper", + { + "type": "zigzag32", + "mappings": { + "0": "sound", + "1": "change_state" + } + } + ] }, { - "name": "case_2", + "name": "data", "type": "zigzag32" } ] @@ -3339,7 +3607,68 @@ }, { "name": "event_id", - "type": "u8" + "type": [ + "mapper", + { + "type": "u8", + "mappings": { + "1": "jump", + "2": "hurt_animation", + "3": "death_animation", + "4": "arm_swing", + "5": "stop_attack", + "6": "tame_fail", + "7": "tame_success", + "8": "shake_wet", + "9": "use_item", + "10": "eat_grass_animation", + "11": "fish_hook_bubble", + "12": "fish_hook_position", + "13": "fish_hook_hook", + "14": "fish_hook_tease", + "15": "squid_ink_cloud", + "16": "zombie_villager_cure", + "18": "respawn", + "19": "iron_golem_offer_flower", + "20": "iron_golem_withdraw_flower", + "21": "love_particles", + "22": "villager_angry", + "23": "villager_happy", + "24": "witch_spell_particles", + "25": "firework_particles", + "26": "in_love_particles", + "27": "silverfish_spawn_animation", + "28": "guardian_attack", + "29": "witch_drink_potion", + "30": "witch_throw_potion", + "31": "minecart_tnt_prime_fuse", + "32": "creeper_prime_fuse", + "33": "air_supply_expired", + "34": "player_add_xp_levels", + "35": "elder_guardian_curse", + "36": "agent_arm_swing", + "37": "ender_dragon_death", + "38": "dust_particles", + "39": "arrow_shake", + "57": "eating_item", + "60": "baby_animal_feed", + "61": "death_smoke_cloud", + "62": "complete_trade", + "63": "remove_leash", + "65": "consume_totem", + "66": "player_check_treasure_hunter_achievement", + "67": "entity_spawn", + "68": "dragon_puke", + "69": "item_entity_merge", + "70": "start_swim", + "71": "balloon_pop", + "72": "treasure_hunt", + "73": "agent_summon", + "74": "charged_crossbow", + "75": "fall" + } + } + ] }, { "name": "data", @@ -3511,11 +3840,44 @@ "type": "varint" }, { - "name": "action_id", - "type": "zigzag32" + "name": "action", + "type": [ + "mapper", + { + "type": "zigzag32", + "mappings": { + "0": "start_break", + "1": "abort_break", + "2": "stop_break", + "3": "get_updated_block", + "4": "drop_item", + "5": "start_sleeping", + "6": "stop_sleeping", + "7": "respawn", + "8": "jump", + "9": "start_sprint", + "10": "stop_sprint", + "11": "start_sneak", + "12": "stop_sneak", + "13": "creative_player_destroy_block", + "14": "dimension_change_ack", + "15": "start_glide", + "16": "stop_glide", + "17": "build_denied", + "18": "continue_break", + "19": "change_skin", + "20": "set_enchatnment_seed", + "21": "swimming", + "22": "stop_swimming", + "23": "start_spin_attack", + "24": "stop_spin_attack", + "25": "ineract_block" + } + } + ] }, { - "name": "coordinates", + "name": "position", "type": "BlockCoordinates" }, { @@ -3837,7 +4199,7 @@ "container", [ { - "name": "coordinates", + "name": "position", "type": "BlockCoordinates" }, { @@ -3871,11 +4233,11 @@ "container", [ { - "name": "chunk_x", + "name": "x", "type": "zigzag32" }, { - "name": "chunk_z", + "name": "z", "type": "zigzag32" }, { @@ -4038,8 +4400,106 @@ "type": "zigzag64" }, { - "name": "event_type", - "type": "varint" + "name": "type", + "type": [ + "mapper", + { + "type": "varint", + "mappings": { + "0": "show_bar", + "1": "register_player", + "2": "hide_bar", + "3": "unregister_player", + "4": "set_bar_progress", + "5": "set_bar_title", + "6": "update_properties", + "7": "texture" + } + } + ] + }, + { + "anon": true, + "type": [ + "switch", + { + "compareTo": "type", + "fields": { + "register_player": [ + "container", + [ + { + "name": "player_id", + "type": "zigzag64" + } + ] + ], + "unregister_player": [ + "container", + [ + { + "name": "player_id", + "type": "zigzag64" + } + ] + ], + "show": [ + "container", + [ + { + "name": "title", + "type": "string" + }, + { + "name": "bar_progress", + "type": "lf32" + } + ] + ], + "update_properties": [ + "container", + [ + { + "name": "darkness_factor", + "type": "li16" + } + ] + ], + "texture": [ + "container", + [ + { + "name": "color", + "type": "varint" + }, + { + "name": "overlay", + "type": "varint" + } + ] + ], + "set_bar_progress": [ + "container", + [ + { + "name": "bar_progress", + "type": "lf32" + } + ] + ], + "set_bar_title": [ + "container", + [ + { + "name": "title", + "type": "string" + } + ] + ] + }, + "default": "void" + } + ] } ] ], @@ -4068,19 +4528,11 @@ "type": "string" }, { - "name": "command_type", - "type": "varint" + "name": "origin", + "type": "CommandOrigin" }, { - "name": "unknown_uuid", - "type": "uuid" - }, - { - "name": "request_id", - "type": "string" - }, - { - "name": "unknown", + "name": "interval", "type": "bool" } ] @@ -4096,7 +4548,52 @@ ], "packet_command_output": [ "container", - [] + [ + { + "name": "origin", + "type": "CommandOrigin" + }, + { + "name": "output_type", + "type": "i8" + }, + { + "name": "success_count", + "type": "varint" + }, + { + "name": "output", + "type": [ + "array", + { + "countType": "varint", + "type": [ + "container", + [ + { + "name": "success", + "type": "bool" + }, + { + "name": "message_id", + "type": "string" + }, + { + "name": "paramaters", + "type": [ + "array", + { + "countType": "varint", + "type": "string" + } + ] + } + ] + ] + } + ] + } + ] ], "packet_update_trade": [ "container", @@ -4386,7 +4883,113 @@ ], "packet_book_edit": [ "container", - [] + [ + { + "name": "type", + "type": [ + "mapper", + { + "type": "u8", + "mappings": { + "0": "replace_page", + "1": "add_page", + "2": "delete_page", + "3": "swap_pages", + "4": "sign" + } + } + ] + }, + { + "name": "slot", + "type": "u8" + }, + { + "anon": true, + "type": [ + "switch", + { + "compareTo": "type", + "fields": { + "replace_page": [ + "container", + [ + { + "name": "page_number", + "type": "u8" + }, + { + "name": "text", + "type": "string" + }, + { + "name": "photo_name", + "type": "string" + } + ] + ], + "add_page": [ + "container", + [ + { + "name": "page_number", + "type": "u8" + }, + { + "name": "text", + "type": "string" + }, + { + "name": "photo_name", + "type": "string" + } + ] + ], + "delete_page": [ + "container", + [ + { + "name": "page_number", + "type": "u8" + } + ] + ], + "swap_pages": [ + "container", + [ + { + "name": "page1", + "type": "u8" + }, + { + "name": "page2", + "type": "u8" + } + ] + ], + "sign": [ + "container", + [ + { + "name": "title", + "type": "string" + }, + { + "name": "author", + "type": "string" + }, + { + "name": "xuid", + "type": "string" + } + ] + ] + }, + "default": "void" + } + ] + } + ] ], "packet_npc_request": [ "container",