-
Notifications
You must be signed in to change notification settings - Fork 4
/
packets.py
134 lines (132 loc) · 4.17 KB
/
packets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from format import *
#network packets
PACKET_KEEPALIVE = 0x00
PACKET_LOGIN = 0x01
PACKET_HANDSHAKE = 0x02
PACKET_CHAT = 0x03
PACKET_UPDATETIME = 0x04
PACKET_ENTITYEQUIPMENT = 0x05
PACKET_SPAWNPOSITION = 0x06
PACKET_USEENTITY = 0x07
PACKET_PLAYERHEALTH = 0x08
PACKET_RESPAWN = 0x09
PACKET_PLAYERONGROUND = 0x0A
PACKET_PLAYERPOSITION = 0x0B
PACKET_PLAYERLOOK = 0x0C
PACKET_PLAYERPOSITIONLOOK = 0x0D
PACKET_PLAYERBLOCKDIG = 0x0E
PACKET_PLAYERBLOCKPLACE = 0x0F
PACKET_ITEMSWITCH = 0x10
PACKET_USEBED = 0x11
PACKET_ANIMATION = 0x12
PACKET_ENTITYACTION = 0x13
PACKET_NAMEDENTITYSPAWN = 0x14
PACKET_PICKUPSPAWN = 0x15
PACKET_COLLECTITEM = 0x16
PACKET_ADDOBJECT = 0x17
PACKET_MOBSPAWN = 0x18
PACKET_PAINTING = 0x19
PACKET_EXPERIENCEORB = 0x1A
PACKET_UNK1 = 0x1B
PACKET_ENTITYVELOCITY = 0x1C
PACKET_DESTROYENTITY = 0x1D
PACKET_ENTITY = 0x1E
PACKET_ENTITYMOVE = 0x1F
PACKET_ENTITYLOOK = 0x20
PACKET_ENTITYMOVELOOK = 0x21
PACKET_ENTITYTELEPORT = 0x22
PACKET_ENTITYSTATUS = 0x26
PACKET_ATTACHENTITY = 0x27
PACKET_ENTITYMETADATA = 0x28
PACKET_ENTITYEFFECT = 0x29
PACKET_ENTITYUNEFFECT = 0x2A
PACKET_EXPERIENCE = 0x2B
PACKET_PRECHUNK = 0x32
PACKET_CHUNK = 0x33
PACKET_MULTIBLOCKCHANGE = 0x34
PACKET_BLOCKCHANGE = 0x35
PACKET_BLOCKACTION = 0x36
PACKET_EXPLOSION = 0x3C
PACKET_SOUNDEFFECT = 0x3D
PACKET_NEWSTATE = 0x46
PACKET_THUNDERBOLT = 0x47
PACKET_WINDOWOPEN = 0x64
PACKET_WINDOWCLOSE = 0x65
PACKET_WINDOWCLICK = 0x66
PACKET_SETSLOT = 0x67
PACKET_WINDOWITEMS = 0x68
PACKET_WINDOWPROGRESS = 0x69
PACKET_TRANSACTION = 0x6A
PACKET_CREATIVEACTION = 0x6B
PACKET_UPDATESIGN = 0x82
PACKET_ITEMDATA = 0x83
PACKET_STATISTIC = 0xC8
PACKET_PLAYERLIST = 0xC9
PACKET_SERVERPING = 0xFE
PACKET_DISCONNECT = 0xFF
PACKET_FORMATS = {
PACKET_KEEPALIVE: Format("i"),
PACKET_LOGIN: Format("iSqibbBB"),
PACKET_HANDSHAKE: Format("S"),
PACKET_CHAT: Format("S"),
PACKET_UPDATETIME: Format("q"),
PACKET_ENTITYEQUIPMENT: Format("ihhh"),
PACKET_SPAWNPOSITION: Format("iii"),
PACKET_USEENTITY: Format("iib"),
PACKET_PLAYERHEALTH: Format("hhf"),
PACKET_RESPAWN: Format("bbbhq"),
PACKET_PLAYERONGROUND: Format("b"),
PACKET_PLAYERPOSITION: Format("ddddb"),
PACKET_PLAYERLOOK: Format("ffb"),
PACKET_PLAYERPOSITIONLOOK: Format("ddddffb"),
PACKET_PLAYERBLOCKDIG: Format("bibib"),
PACKET_PLAYERBLOCKPLACE: BlockPlaceFormat(),
PACKET_ITEMSWITCH: Format("h"),
PACKET_USEBED: Format("ibibi"),
PACKET_ANIMATION: Format("ib"),
PACKET_ENTITYACTION: Format("ib"),
PACKET_NAMEDENTITYSPAWN: Format("iSiiibbh"),
PACKET_PICKUPSPAWN: Format("ihbhiiibbb"),
PACKET_COLLECTITEM: Format("ii"),
PACKET_ADDOBJECT: AddObjectFormat(),
PACKET_MOBSPAWN: Format("ibiiibbM"),
PACKET_PAINTING: Format("iSiiii"),
PACKET_EXPERIENCEORB: Format("iiiih"),
PACKET_UNK1: Format("ffff??"),
PACKET_ENTITYVELOCITY: Format("ihhh"),
PACKET_DESTROYENTITY: Format("i"),
PACKET_ENTITY: Format("i"),
PACKET_ENTITYMOVE: Format("ibbb"),
PACKET_ENTITYLOOK: Format("ibb"),
PACKET_ENTITYMOVELOOK: Format("ibbbbb"),
PACKET_ENTITYTELEPORT: Format("iiiibb"),
PACKET_ENTITYSTATUS: Format("ib"),
PACKET_ATTACHENTITY: Format("ii"),
PACKET_ENTITYMETADATA: Format("iM"),
PACKET_ENTITYEFFECT: Format("ibbh"),
PACKET_ENTITYUNEFFECT: Format("ib"),
PACKET_EXPERIENCE: Format("bbh"),
PACKET_PRECHUNK: Format("iib"),
PACKET_CHUNK: ChunkFormat(),
PACKET_MULTIBLOCKCHANGE: MultiBlockChangeFormat(),
PACKET_BLOCKCHANGE: Format("ibibb"),
PACKET_BLOCKACTION: Format("ihibb"),
PACKET_EXPLOSION: ExplosionFormat(),
PACKET_SOUNDEFFECT: Format("iibii"),
PACKET_NEWSTATE: Format("bb"),
PACKET_THUNDERBOLT: Format("i?iii"),
PACKET_WINDOWOPEN: Format("bbSb"),
PACKET_WINDOWCLOSE: Format("b"),
PACKET_WINDOWCLICK: WindowClickFormat(),
PACKET_SETSLOT: SetSlotFormat(),
PACKET_WINDOWITEMS: WindowItemsFormat(),
PACKET_WINDOWPROGRESS: Format("bhh"),
PACKET_TRANSACTION: Format("bh?"),
PACKET_CREATIVEACTION: Format("hhhh"),
PACKET_UPDATESIGN: Format("ihiSSSS"),
PACKET_ITEMDATA: ItemDataFormat(),
PACKET_STATISTIC: Format("ib"),
PACKET_PLAYERLIST: Format("S?h"),
PACKET_SERVERPING: Format(""),
PACKET_DISCONNECT: Format("S")
}