Added schema for packet definitions and some pkts

This commit is contained in:
Casey 2023-09-12 20:19:45 +03:00
parent c7b6a67e20
commit 8e76e96373
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 1012 additions and 0 deletions

136
packets-schema.json Normal file
View File

@ -0,0 +1,136 @@
{
"type": "object",
"properties": {
"protocol_version": {
"type": "integer"
},
"game_version": {
"type": "string"
},
"packets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"server": { "type": "boolean" },
"client": { "type": "boolean" },
"fields": {
"type": "array",
"items": {
"$ref": "#/definitions/field"
}
}
},
"required": [
"id",
"name"
]
}
}
},
"definitions": {
"type": {
"type": "object",
"oneOf": [
{
"properties": {
"type": {
"type": "string",
"enum": [
"bool",
"byte", "ubyte",
"short", "ushort",
"int", "uint",
"long", "ulong",
"float", "double",
"itemstack", "optional_itemstack",
"itemstack_nbt", "optional_itemstack_nbt",
"compoundtag",
"synchedentitydata"
]
}
}
},
{
"properties": {
"type": { "type": "string", "const": "list" },
"item": { "$ref": "#/definitions/type" },
"size": { "type": "number" },
"sizetype": { "type": "string" },
"maxsize": { "type": "integer" }
},
"required": [ "item" ],
"oneOf": [
{ "required": [ "size" ] },
{ "required": [ "sizetype", "maxsize" ] }
]
},
{
"properties": {
"type": { "type": "string", "enum": [ "string", "utfstring" ] },
"maxsize": { "type": "number" }
}
},
{
"properties": {
"type": { "type": "string", "enum": [ "bytes" ] },
"size": { "type": "number" },
"sizetype": {
"type": "string",
"enum": [
"ubyte", "byte",
"ushort", "short",
"uint", "int"
]
},
"maxsize": { "type": "number" }
},
"oneOf": [
{ "required": [ "size" ] },
{ "required": [ "sizetype", "maxsize" ] }
]
},
{
"properties": {
"type": { "type": "string", "const": "struct" },
"name": { "type": "string" },
"fields": {
"type": "array",
"items": { "$ref": "#/definitions/type" }
}
}
}
],
"properties": {
"if": { "$ref": "#/definitions/condition" },
"post": { "type": "array" },
"proptype": { "type": "string" }
},
"required": [ "type" ]
},
"field": {
"allOf": [
{
"properties": {
"name": { "type": "string" }
},
"required": [ "name" ]
},
{
"$ref": "#/definitions/type"
}
]
},
"condition": {
"type": "array"
}
},
"required": [
"protocol_version",
"game_version",
"packets"
]
}

876
packets.json Normal file
View File

@ -0,0 +1,876 @@
{
"$schema": "./packets-schema.json",
"protocol_version": 26,
"game_version": "1.7.7.0_02",
"packets": [
{
"id": 0,
"name": "Packet0KeepAlive",
"server": true,
"client": true,
"fields": []
},
{
"id": 1,
"name": "Packet1Login",
"server": true,
"client": true,
"fields": [
{ "name": "version_or_entity_id", "type": "int" },
{ "name": "username", "type": "string", "sizetype": "short", "maxsize": 32 },
{ "name": "pubkey", "type": "string", "sizetype": "short", "maxsize": 400 },
{ "name": "seed", "type": "long" },
{ "name": "dimension", "type": "byte" },
{ "name": "world_type", "type": "byte" },
{ "name": "packet_delay", "type": "byte" }
]
},
{
"id": 2,
"name": "Packet2Handshake",
"server": true,
"client": true,
"fields": []
},
{
"id": 3,
"name": "Packet3Chat",
"server": true,
"client": true,
"fields": []
},
{
"id": 4,
"name": "Packet4UpdateTime",
"server": true,
"client": false,
"fields": []
},
{
"id": 5,
"name": "Packet5PlayerInventory",
"server": true,
"client": false,
"fields": []
},
{
"id": 6,
"name": "Packet6SpawnPosition",
"server": true,
"client": false,
"fields": []
},
{
"id": 7,
"name": "Packet7UseEntity",
"server": false,
"client": true,
"fields": []
},
{
"id": 8,
"name": "Packet8UpdateHealth",
"server": true,
"client": false,
"fields": []
},
{
"id": 9,
"name": "Packet9Respawn",
"server": true,
"client": true,
"fields": []
},
{
"id": 10,
"name": "Packet10Flying",
"server": true,
"client": true,
"fields": [
{
"name": "on_ground",
"type": "bool"
}
]
},
{
"id": 11,
"name": "Packet11PlayerPosition",
"server": true,
"client": true,
"fields": [
{
"name": "x",
"type": "double"
},
{
"name": "y",
"type": "double"
},
{
"name": "stance",
"type": "double"
},
{
"name": "z",
"type": "double"
},
{
"name": "on_ground",
"type": "bool"
}
]
},
{
"id": 12,
"name": "Packet12PlayerLook",
"server": true,
"client": true,
"fields": [
{
"name": "yaw",
"type": "float"
},
{
"name": "pitch",
"type": "float"
},
{
"name": "on_ground",
"type": "bool"
}
]
},
{
"id": 13,
"name": "Packet13PlayerLookMove",
"server": true,
"client": true,
"fields": [
{ "name": "x", "type": "double" },
{ "name": "y", "type": "double" },
{ "name": "stance", "type": "double" },
{ "name": "z", "type": "double" },
{ "name": "yaw", "type": "float" },
{ "name": "pitch", "type": "float" },
{ "name": "on_ground", "type": "bool" }
]
},
{
"id": 14,
"name": "Packet14BlockDig",
"server": false,
"client": true,
"fields": [
{ "name": "status", "type": "ubyte" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "ubyte" },
{ "name": "z", "type": "int" },
{ "name": "side", "type": "ubyte" }
]
},
{
"id": 15,
"name": "Packet15Place",
"server": false,
"client": true,
"fields": [
{ "name": "x", "type": "int" },
{ "name": "y", "type": "ubyte" },
{ "name": "z", "type": "int" },
{ "name": "direction", "type": "ubyte" },
{ "name": "y_placed", "type": "double" },
{ "name": "item", "type": "optional_itemstack" }
]
},
{
"id": 16,
"name": "Packet16BlockItemSwitch",
"server": true,
"client": true,
"fields": [
{ "name": "id", "type": "short" }
]
},
{
"id": 17,
"name": "Packet17Sleep",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "flag", "type": "byte" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" }
]
},
{
"id": 18,
"name": "Packet18Animation",
"server": true,
"client": true,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "animate", "type": "byte" }
]
},
{
"id": 19,
"name": "Packet19EntityAction",
"server": false,
"client": true,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "state", "type": "byte" }
]
},
{
"id": 20,
"name": "Packet20NamedEntitySpawn",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "name", "type": "string", "sizetype": "short", "maxsize": 32 },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" },
{ "name": "rotation", "type": "ubyte" },
{ "name": "pitch", "type": "ubyte" },
{ "name": "item_id", "type": "short" },
{ "name": "nickname", "type": "string", "sizetype": "short", "maxsize": 64 },
{ "name": "chat_color", "type": "byte" }
]
},
{
"id": 21,
"name": "Packet21PickupSpawn",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "item", "type": "itemstack_nbt" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" },
{ "name": "rotation", "type": "byte" },
{ "name": "pitch", "type": "byte" },
{ "name": "roll", "type": "byte" }
]
},
{
"id": 22,
"name": "Packet22Collect",
"server": true,
"client": false,
"fields": [
{ "name": "collected", "type": "int" },
{ "name": "collector", "type": "int" }
]
},
{
"id": 23,
"name": "Packet23VehicleSpawn",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "type", "type": "byte" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" },
{ "name": "pitch", "type": "float" },
{ "name": "yaw", "type": "float" },
{ "name": "flag", "type": "int" },
{ "name": "dx", "type": "short", "if": [ "flag", "gt", 0 ] },
{ "name": "dy", "type": "short", "if": [ "flag", "gt", 0 ] },
{ "name": "dz", "type": "short", "if": [ "flag", "gt", 0 ] },
{ "name": "arrow_type", "type": "int", "if": [ "type", "eq", 60 ] }
]
},
{
"id": 24,
"name": "Packet24MobSpawn",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "type", "type": "byte" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" },
{ "name": "yaw", "type": "byte" },
{ "name": "pitch", "type": "byte" },
{ "name": "data", "type": "synchedentitydata" },
{ "name": "nickname", "type": "string", "sizetype": "short", "maxsize": 64 },
{ "name": "chat_color", "type": "byte" }
]
},
{
"id": 25,
"name": "Packet25EntityPainting",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "title", "type": "string", "sizetype": "short", "maxsize": 128 },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "int" },
{ "name": "z", "type": "int" },
{ "name": "direction", "type": "int" }
]
},
{
"id": 27,
"name": "Packet27Position",
"server": false,
"client": true,
"fields": [
{ "name": "strafe", "type": "float" },
{ "name": "forward", "type": "float" },
{ "name": "pitch", "type": "float" },
{ "name": "yaw", "type": "float" },
{ "name": "flag", "type": "bool" },
{ "name": "in_jump", "type": "bool" }
]
},
{
"id": 28,
"name": "Packet28EntityVelocity",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" },
{ "name": "dx", "type": "short", "post": [ "@", "divide", 8000.0 ], "proptype": "float" },
{ "name": "dy", "type": "short", "post": [ "@", "divide", 8000.0 ], "proptype": "float" },
{ "name": "dz", "type": "short", "post": [ "@", "divide", 8000.0 ], "proptype": "float" }
]
},
{
"id": 29,
"name": "Packet29DestroyEntity",
"server": true,
"client": false,
"fields": [
{ "name": "entity_id", "type": "int" }
]
},
{
"id": 30,
"name": "Packet30Entity",
"server": true,
"client": false,
"fields": []
},
{
"id": 31,
"name": "Packet31RelEntityMove",
"server": true,
"client": false,
"fields": []
},
{
"id": 32,
"name": "Packet32EntityLook",
"server": true,
"client": false,
"fields": []
},
{
"id": 33,
"name": "Packet33RelEntityMoveLook",
"server": true,
"client": false,
"fields": []
},
{
"id": 34,
"name": "Packet34EntityTeleport",
"server": true,
"client": false,
"fields": []
},
{
"id": 35,
"name": "Packet35EntityNickname",
"server": true,
"client": true,
"fields": []
},
{
"id": 38,
"name": "Packet38EntityStatus",
"server": true,
"client": false,
"fields": []
},
{
"id": 39,
"name": "Packet39AttachEntity",
"server": true,
"client": false,
"fields": []
},
{
"id": 40,
"name": "Packet40EntityMetadata",
"server": true,
"client": false,
"fields": []
},
{
"id": 41,
"name": "Packet41EntityPlayerGamemode",
"server": true,
"client": false,
"fields": []
},
{
"id": 50,
"name": "Packet50PreChunk",
"server": true,
"client": false,
"fields": []
},
{
"id": 51,
"name": "Packet51MapChunk",
"server": true,
"client": false,
"fields": []
},
{
"id": 52,
"name": "Packet52MultiBlockChange",
"server": true,
"client": false,
"fields": []
},
{
"id": 53,
"name": "Packet53BlockChange",
"server": true,
"client": false,
"fields": []
},
{
"id": 54,
"name": "Packet54PlayNoteBlock",
"server": true,
"client": false,
"fields": []
},
{
"id": 56,
"name": "Packet56RequestChunk",
"server": false,
"client": true,
"fields": []
},
{
"id": 60,
"name": "Packet60Explosion",
"server": true,
"client": false,
"fields": []
},
{
"id": 61,
"name": "Packet61PlaySoundEffect",
"server": true,
"client": false,
"fields": []
},
{
"id": 70,
"name": "Packet70Bed",
"server": true,
"client": false,
"fields": []
},
{
"id": 71,
"name": "Packet71Weather",
"server": true,
"client": false,
"fields": []
},
{
"id": 72,
"name": "Packet72UpdatePlayerProfile",
"server": true,
"client": false,
"fields": []
},
{
"id": 73,
"name": "Packet73WeatherStatus",
"server": true,
"client": false,
"fields": []
},
{
"id": 100,
"name": "Packet100OpenWindow",
"server": true,
"client": false,
"fields": [
{
"name": "window_id",
"type": "byte"
},
{
"name": "inventory_type",
"type": "byte"
},
{
"name": "title",
"type": "utfstring",
"sizetype": "short"
},
{
"name": "slots_count",
"type": "byte"
}
]
},
{
"id": 101,
"name": "Packet101CloseWindow",
"server": true,
"client": true,
"fields": [
{
"name": "window_id",
"type": "byte"
}
]
},
{
"id": 102,
"name": "Packet102WindowClick",
"server": false,
"client": true,
"fields": [
{
"name": "window_id",
"type": "byte"
},
{
"name": "action",
"type": "byte"
},
{
"name": "args",
"type": "bytes",
"sizetype": "byte",
"maxsize": 255
},
{
"name": "action_id",
"type": "short"
},
{
"name": "itemstack",
"type": "optional_itemstack"
}
]
},
{
"id": 103,
"name": "Packet103SetSlot",
"server": true,
"client": false,
"fields": [
{
"name": "window_id",
"type": "byte"
},
{
"name": "slot",
"type": "short"
},
{
"name": "itemstack",
"type": "optional_itemstack_nbt"
}
]
},
{
"id": 104,
"name": "Packet104WindowItems",
"server": true,
"client": false,
"fields": [
{
"name": "window_id",
"type": "byte"
},
{
"name": "items",
"type": "list",
"item": {
"type": "optional_itemstack"
},
"sizetype": "short",
"maxsize": 32767
}
]
},
{
"id": 105,
"name": "Packet105UpdateProgressbar",
"server": true,
"client": false,
"fields": [
{ "name": "window_id", "type": "byte" },
{ "name": "bar", "type": "short" },
{ "name": "value", "type": "short" }
]
},
{
"id": 106,
"name": "Packet106Transaction",
"server": true,
"client": true,
"fields": [
{ "name": "window_id", "type": "byte" },
{ "name": "short_window_id", "type": "short" },
{ "name": "equal_itemstack", "type": "bool" }
]
},
{
"id": 107,
"name": "Packet107UpdateCreativeInventory",
"server": false,
"client": true,
"fields": [
{ "name": "window_id", "type": "byte" },
{ "name": "page", "type": "int" },
{
"name": "search_text",
"type": "utfstring",
"sizetype": "short"
}
]
},
{
"id": 108,
"name": "Packet108SetHotbarOffset",
"server": false,
"client": true,
"fields": [
{ "name": "offset", "type": "byte" }
]
},
{
"id": 130,
"name": "Packet130UpdateSign",
"server": false,
"client": true,
"fields": [
{ "name": "x", "type": "int" },
{ "name": "y", "type": "short" },
{ "name": "z", "type": "int" },
{
"name": "lines",
"type": "list",
"item": {
"type": "string"
},
"size": 4
},
{ "name": "picture", "type": "int" },
{ "name": "color", "type": "int" }
]
},
{
"id": 131,
"name": "Packet131MapData",
"server": true,
"client": false,
"fields": [
{ "name": "item_id", "type": "short" },
{ "name": "meta", "type": "short" },
{
"name": "map_data",
"type": "bytes",
"sizetype": "ubyte",
"maxsize": 255
}
]
},
{
"id": 132,
"name": "Packet132SetMobSpawner",
"server": true,
"client": false,
"fields": [
{ "name": "x", "type": "int" },
{ "name": "y", "type": "short" },
{ "name": "z", "type": "int" },
{
"name": "spawn_type",
"type": "string",
"sizetype": "short",
"maxsize": 32
}
]
},
{
"id": 133,
"name": "Packet133OpenGuidebook",
"server": false,
"client": true,
"fields": [
{ "name": "is_open", "type": "bool" }
]
},
{
"id": 134,
"name": "Packet134ItemData",
"server": false,
"client": true,
"fields": [
{ "name": "slot", "type": "int" },
{ "name": "nbt", "type": "compoundtag" }
]
},
{
"id": 135,
"name": "Packet135PlacementMode",
"server": false,
"client": true,
"fields": [
{ "name": "rotation", "type": "byte" },
{ "name": "rotation_horizontal", "type": "byte" },
{ "name": "rotation_vertical", "type": "byte" },
{ "name": "placement_mode", "type": "byte" }
]
},
{
"id": 136,
"name": "Packet136SendKey",
"server": true,
"client": false,
"fields": [
{
"name": "key",
"type": "string",
"sizetype": "short",
"maxsize": 384
}
]
},
{
"id": 137,
"name": "Packet137UpdateFlag",
"server": false,
"client": false,
"deprecated": true,
"fields": []
},
{
"id": 138,
"name": "Packet138PlayerList",
"server": true,
"client": false,
"fields": [
{
"name": "players",
"type": "list",
"item": {
"type": "struct",
"name": "PlayerStat",
"fields": [
{
"name": "name",
"type": "string",
"sizetype": "short",
"maxsize": 64
},
{
"name": "score",
"type": "int"
}
]
},
"sizetype": "int",
"maxsize": 256
}
]
},
{
"id": 139,
"name": "Packet139SetPaintingMotive",
"server": false,
"client": true,
"fields": [
{ "name": "motive", "type": "int" }
]
},
{
"id": 140,
"name": "Packet140TileEntityData",
"server": true,
"client": false,
"fields": [
{ "name": "data", "type": "compoundtag" }
]
},
{
"id": 141,
"name": "Packet141UpdateFlag",
"server": false,
"client": true,
"fields": [
{ "name": "x", "type": "int" },
{ "name": "y", "type": "short" },
{ "name": "z", "type": "int" },
{ "name": "colors", "type": "bytes", "size": 384 },
{ "name": "owner", "type": "string", "sizetype": "short", "maxsize": 32 }
]
},
{
"id": 142,
"name": "Packet142OpenFlagWindow",
"server": true,
"client": false,
"fields": [
{ "name": "window_id", "type": "byte" },
{ "name": "x", "type": "int" },
{ "name": "y", "type": "short" },
{ "name": "z", "type": "int" }
]
},
{
"id": 143,
"name": "Packet143PhotoMode",
"server": true,
"client": false,
"fields": [
{ "name": "disabled", "type": "bool" }
]
},
{
"id": 200,
"name": "Packet200Statistic",
"server": true,
"client": false,
"fields": [
{ "name": "id", "type": "int" },
{ "name": "value", "type": "byte" }
]
},
{
"id": 255,
"name": "Packet255KickDisconnect",
"server": true,
"client": true,
"fields": [
{ "name": "reason", "type": "string", "sizetype": "short", "maxsize": 256 }
]
}
]
}