nurtex-protocol 1.2.0

Library that allows a Minecraft client to communicate with a server.
Documentation
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
use nurtex_codec::Buffer;
use nurtex_derive::Packet;
use uuid::Uuid;

use crate::types::{
  AdditionalMessageInfo, BlockPos, ChunkData, ClientCommand, Experience, Face, 
  GameEvent, InteractType, Item, LightData, LpVector3, PhysicsFlags, PlayerAction, 
  PlayerCommand, RelativeHand, ResourcePackState, Rotation, TeleportFlags, TextComponent, Vector3,
};

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct MultisideKeepAlive {
  pub id: i64,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePing {
  pub id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePingResponse {
  pub timestamp: i64,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideDamageEvent {
  #[varint]
  pub entity_id: i32,
  #[varint]
  pub source_type_id: i32,
  #[varint]
  pub source_cause_id: i32,
  #[varint]
  pub source_direct_id: i32,
  pub source_position: Vector3,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideUpdateEntityPos {
  #[varint]
  pub entity_id: i32,
  pub delta_x: i16,
  pub delta_y: i16,
  pub delta_z: i16,
  pub on_ground: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideUpdateEntityRot {
  #[varint]
  pub entity_id: i32,
  pub yaw_angle: i8,
  pub pitch_angle: i8,
  pub on_ground: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideUpdateEntityPosRot {
  #[varint]
  pub entity_id: i32,
  pub delta_x: i16,
  pub delta_y: i16,
  pub delta_z: i16,
  pub yaw_angle: i8,
  pub pitch_angle: i8,
  pub on_ground: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePlayerPosition {
  #[varlong]
  pub teleport_id: i64,
  pub position: Vector3,
  pub velocity: Vector3,
  pub rotation: Rotation,
  pub teleport_flags: TeleportFlags,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePlayerRotation {
  pub yaw: f32,
  pub relative_yaw: bool,
  pub pitch: f32,
  pub relative_pitch: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePlayerLookAt {
  #[varint]
  pub gaze: i32,
  pub target_pos: Vector3,
  pub is_entity: bool,
  pub entity_id: Option<i32>,
  pub entity_gaze: Option<i32>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePlayerCombatKill {
  #[varint]
  pub player_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetHealth {
  pub health: f32,
  #[varint]
  pub food: i32,
  pub food_saturation: f32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetExperience {
  pub experience: Experience,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetPassengers {
  #[varint]
  pub entity_id: i32,
  #[vec_varint]
  pub passengers: Vec<i32>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetEntityVelocity {
  #[varint]
  pub entity_id: i32,
  pub velocity: LpVector3,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSpawnEntity {
  #[varint]
  pub entity_id: i32,
  pub entity_uuid: Uuid,
  #[varint]
  pub entity_type: i32,
  pub position: Vector3,
  pub velocity: LpVector3,
  pub pitch_angle: i8,
  pub yaw_angle: i8,
  pub head_yaw_angle: i8,
  #[varint]
  pub data: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideRemoveEntities {
  #[vec_varint]
  pub entities: Vec<i32>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideDisconnect;

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsidePlayerChat {
  #[varint]
  pub global_index: i32,
  pub sender_uuid: Uuid,
  #[varint]
  pub index: i32,
  pub message_signature: Option<Vec<u8>>,
  pub message: String,
  pub timestamp: i64,
  pub salt: i64,
  #[varint]
  pub message_id: i32,
  pub signature: Option<Vec<u8>>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSystemChat {
  pub message: TextComponent,
  pub overlay: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideTransfer {
  pub server_host: String,
  #[varint]
  pub server_port: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetHeldItem {
  #[varint]
  pub slot: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetEntityLink {
  #[varint]
  pub attached_entity_id: i32,
  #[varint]
  pub holding_entity_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideChunkCacheRadius {
  #[varint]
  pub view_distance: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideChunkCacheCenter {
  #[varint]
  pub chunk_x: i32,
  #[varint]
  pub chunk_z: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSetCamera {
  #[varint]
  pub camera_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideRotateHead {
  #[varint]
  pub entity_id: i32,
  pub head_yaw: i8,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideSectionBlocksUpdate {
  pub chunk_section_position: i64,
  #[vec_varlong]
  pub head_yaw: Vec<i64>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideAddResourcePack {
  pub uuid: uuid::Uuid,
  pub url: String,
  pub hash: String,
  pub forced: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideRemoveResourcePack {
  pub uuid: uuid::Uuid,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideRemoveEntityEffect {
  #[varint]
  pub entity_id: i32,
  #[varint]
  pub effect_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideOpenContainer {
  #[varint]
  pub window_id: i32,
  #[varint]
  pub window_type: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideMoveVehicle {
  pub position: Vector3,
  pub rotation: Rotation,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideLogin {
  pub entity_id: i32,
  pub is_hardcore: bool,
  pub dimension_names: Vec<String>,
  #[varint]
  pub max_players: i32,
  #[varint]
  pub view_distance: i32,
  #[varint]
  pub simulation_distance: i32,
  pub reduced_debug_info: bool,
  pub enable_respawn_screen: bool,
  #[varint]
  pub dimension_type: i32,
  pub dimension_name: String,
  pub hashed_seed: i64,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideEntityPositionSync {
  #[varint]
  pub entity_id: i32,
  pub position: Vector3,
  pub velocity: Vector3,
  pub rotation: Rotation,
  pub on_ground: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideExplosion {
  pub position: Vector3,
  pub radius: f32,
  pub block_count: i32,
  pub player_delta_velocity: Option<Vector3>,
  #[varint]
  pub explosion_particle_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideUnloadChunk {
  pub chunk_x: i32,
  pub chunk_z: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideGameEvent {
  pub event: GameEvent,
  pub value: f32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideClearChat {
  #[varint]
  pub message_id: i32,
  pub signature: Option<Vec<u8>>,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideLoadChunkWithLight {
  pub chunk_x: i32,
  pub chunk_z: i32,
  pub chunk_data: ChunkData,
  pub light_data: LightData,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideBlockUpdate {
  pub block_pos: BlockPos,
  #[varint]
  pub new_block: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideContainerSetContent {
  #[varint]
  pub container_id: i32,
  #[varint]
  pub state_id: i32,
  pub items: Vec<Item>,
  pub carried_item: Item,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideContainerSetSlot {
  #[varint]
  pub container_id: i32,
  #[varint]
  pub state_id: i32,
  pub slot: i16,
  pub item: Item,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideChunkBatchStart;

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideChunkBatchFinished {
  #[varint]
  pub batch_size: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideLightUpdate {
  #[varint]
  pub chunk_x: i32,
  #[varint]
  pub chunk_z: i32,
  pub light_data: LightData,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideCloseContainer {
  #[varint]
  pub container_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ClientsideContainerSetData {
  #[varint]
  pub container_id: i32,
  #[varint]
  pub property: i32,
  #[varint]
  pub value: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersidePong {
  pub id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersidePingRequest {
  pub timestamp: i64,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideAcceptTeleportation {
  #[varlong]
  pub teleport_id: i64,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideSwingArm {
  pub hand: RelativeHand,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideUseItem {
  pub hand: RelativeHand,
  #[varint]
  pub sequence: i32,
  pub rotation: Rotation,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideMovePlayerPos {
  pub position: Vector3,
  pub flags: PhysicsFlags,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideMovePlayerRot {
  pub rotation: Rotation,
  pub flags: PhysicsFlags,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideMovePlayerPosRot {
  pub position: Vector3,
  pub rotation: Rotation,
  pub flags: PhysicsFlags,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideMovePlayerStatusOnly {
  pub flags: PhysicsFlags,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideClientCommand {
  pub command: ClientCommand,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideChatCommand {
  pub command: String,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideChatMessage {
  pub message: String,
  pub timestamp: i64,
  pub salt: i64,
  pub signature: Option<Vec<u8>>,
  pub additional_info: AdditionalMessageInfo,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideSetHeldItem {
  pub slot: i16,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideInteract {
  #[varint]
  pub entity: i32,
  pub interact_type: InteractType,
  pub target_x: Option<f32>,
  pub target_y: Option<f32>,
  pub target_z: Option<f32>,
  pub hand: Option<RelativeHand>,
  pub sneak_key_pressed: bool,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersidePlayerAction {
  pub action: PlayerAction,
  pub block_pos: BlockPos,
  pub face: Face,
  #[varint]
  pub sequence: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersidePlayerCommand {
  #[varint]
  pub entity_id: i32,
  pub command: PlayerCommand,
  #[varint]
  pub jump_boost: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideResourcePackResponse {
  pub uuid: Uuid,
  pub state: ResourcePackState,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideContainerClick {
  #[varint]
  pub container_id: i32,
  #[varint]
  pub state_id: i32,
  pub slot: i16,
  pub button: i8,
  #[varint]
  pub mode: i32,
  pub clicked_item: Item,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideContainerClose {
  #[varint]
  pub container_id: i32,
}

#[derive(Clone, Debug, PartialEq, Packet)]
pub struct ServersideEditBook {
  pub slot: i32,
  pub pages: Vec<String>,
  pub title: Option<String>,
}