1use basalt_derive::{Decode, Encode, EncodedSize, packet};
7use basalt_types::{NbtCompound, Position, Uuid, Vec2f};
8
9#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
13pub enum ServerboundPlayAdvancementTabAction {
14 #[variant(id = 0)]
15 Variant0 { tab_id: String },
16 #[variant(id = 1)]
17 #[default]
18 Variant1,
19}
20
21#[derive(Debug, Clone, Default, PartialEq)]
22#[packet(id = 0x30)]
23pub struct ServerboundPlayAdvancementTab {
24 pub action: ServerboundPlayAdvancementTabAction,
25}
26
27#[derive(Debug, Clone, Default, PartialEq)]
28#[packet(id = 0x0e)]
29pub struct ServerboundPlayConfigurationAcknowledged;
30
31#[derive(Debug, Clone, Default, PartialEq)]
32#[packet(id = 0x14)]
33pub struct ServerboundPlayCustomPayload {
34 pub channel: String,
35 #[field(rest)]
36 pub data: Vec<u8>,
37}
38
39#[derive(Debug, Clone, Default, PartialEq)]
40#[packet(id = 0x15)]
41pub struct ServerboundPlayDebugSampleSubscription {
42 #[field(varint)]
43 pub r#type: i32,
44}
45
46#[derive(Debug, Clone, Default, PartialEq)]
47#[packet(id = 0x2d)]
48pub struct ServerboundPlayDisplayedRecipe {
49 #[field(varint)]
50 pub recipe_id: i32,
51}
52
53#[derive(Debug, Clone, Default, PartialEq)]
54#[packet(id = 0x16)]
55pub struct ServerboundPlayEditBook {
56 #[field(varint)]
57 pub hand: i32,
58 #[field(length = "varint")]
59 pub pages: Vec<String>,
60 #[field(optional)]
61 pub title: Option<String>,
62}
63
64#[derive(Debug, Clone, Default, PartialEq)]
65#[packet(id = 0x1a)]
66pub struct ServerboundPlayKeepAlive {
67 pub keep_alive_id: i64,
68}
69
70#[derive(Debug, Clone, Default, PartialEq)]
71#[packet(id = 0x24)]
72pub struct ServerboundPlayPingRequest {
73 pub id: i64,
74}
75
76#[derive(Debug, Clone, Default, PartialEq)]
77#[packet(id = 0x2b)]
78pub struct ServerboundPlayPong {
79 pub id: i32,
80}
81
82#[derive(Debug, Clone, Default, PartialEq)]
83#[packet(id = 0x2c)]
84pub struct ServerboundPlayRecipeBook {
85 #[field(varint)]
86 pub book_id: i32,
87 pub book_open: bool,
88 pub filter_active: bool,
89}
90
91#[derive(Debug, Clone, Default, PartialEq)]
92#[packet(id = 0x2f)]
93pub struct ServerboundPlayResourcePackReceive {
94 pub uuid: Uuid,
95 #[field(varint)]
96 pub result: i32,
97}
98
99#[derive(Debug, Clone, Default, PartialEq)]
100#[packet(id = 0x0b)]
101pub struct ServerboundPlayTickEnd;
102
103#[derive(Debug, Clone, Default, PartialEq)]
104#[packet(id = 0x34)]
105pub struct ServerboundPlayUpdateCommandBlock {
106 pub location: Position,
107 pub command: String,
108 #[field(varint)]
109 pub mode: i32,
110 pub flags: u8,
111}
112
113#[derive(Debug, Clone, Default, PartialEq)]
114#[packet(id = 0x35)]
115pub struct ServerboundPlayUpdateCommandBlockMinecart {
116 #[field(varint)]
117 pub entity_id: i32,
118 pub command: String,
119 pub track_output: bool,
120}
121
122#[derive(Debug, Clone, Default, PartialEq)]
123#[packet(id = 0x37)]
124pub struct ServerboundPlayUpdateJigsawBlock {
125 pub location: Position,
126 pub name: String,
127 pub target: String,
128 pub pool: String,
129 pub final_state: String,
130 pub joint_type: String,
131 #[field(varint)]
132 pub selection_priority: i32,
133 #[field(varint)]
134 pub placement_priority: i32,
135}
136
137#[derive(Debug, Clone, Default, PartialEq)]
138#[packet(id = 0x38)]
139pub struct ServerboundPlayUpdateStructureBlock {
140 pub location: Position,
141 #[field(varint)]
142 pub action: i32,
143 #[field(varint)]
144 pub mode: i32,
145 pub name: String,
146 pub offset_x: i8,
147 pub offset_y: i8,
148 pub offset_z: i8,
149 pub size_x: i8,
150 pub size_y: i8,
151 pub size_z: i8,
152 #[field(varint)]
153 pub mirror: i32,
154 #[field(varint)]
155 pub rotation: i32,
156 pub metadata: String,
157 pub integrity: f32,
158 #[field(varint)]
159 pub seed: i32,
160 pub flags: u8,
161}
162
163#[derive(Debug, Clone, Default, PartialEq)]
164#[packet(id = 0x3d)]
165pub struct ServerboundPlayUseItem {
166 #[field(varint)]
167 pub hand: i32,
168 #[field(varint)]
169 pub sequence: i32,
170 pub rotation: Vec2f,
171}
172
173#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
177pub struct ClientboundPlayAdvancementsAdvancementmappingValue {
178 #[field(optional)]
179 pub parent_id: Option<String>,
180 #[field(optional)]
181 pub display_data: Option<Vec<u8>>,
182 #[field(length = "varint")]
183 pub requirements: Vec<Vec<u8>>,
184 pub sends_telemtry_data: bool,
185}
186
187#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
189pub struct ClientboundPlayAdvancementsAdvancementmapping {
190 pub key: String,
191 pub value: ClientboundPlayAdvancementsAdvancementmappingValue,
192}
193
194#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
196pub struct ClientboundPlayAdvancementsProgressmappingValue {
197 pub criterion_identifier: String,
198 #[field(optional)]
199 pub criterion_progress: Option<i64>,
200}
201
202#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
204pub struct ClientboundPlayAdvancementsProgressmapping {
205 pub key: String,
206 #[field(length = "varint")]
207 pub value: Vec<ClientboundPlayAdvancementsProgressmappingValue>,
208}
209
210#[derive(Debug, Clone, Default, PartialEq)]
211#[packet(id = 0x7b)]
212pub struct ClientboundPlayAdvancements {
213 pub reset: bool,
214 #[field(length = "varint")]
215 pub advancement_mapping: Vec<ClientboundPlayAdvancementsAdvancementmapping>,
216 #[field(length = "varint")]
217 pub identifiers: Vec<String>,
218 #[field(length = "varint")]
219 pub progress_mapping: Vec<ClientboundPlayAdvancementsProgressmapping>,
220}
221
222#[derive(Debug, Clone, Default, PartialEq)]
223#[packet(id = 0x19)]
224pub struct ClientboundPlayCustomPayload {
225 pub channel: String,
226 #[field(rest)]
227 pub data: Vec<u8>,
228}
229
230#[derive(Debug, Clone, Default, PartialEq)]
231#[packet(id = 0x1b)]
232pub struct ClientboundPlayDebugSample {
233 #[field(length = "varint")]
234 pub sample: Vec<i64>,
235 #[field(varint)]
236 pub r#type: i32,
237}
238
239#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
241pub struct ClientboundPlayDeclareRecipesRecipes {
242 pub name: String,
243 #[field(length = "varint", element = "varint")]
244 pub items: Vec<i32>,
245}
246
247#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
249pub struct ClientboundPlayDeclareRecipesStonecutterrecipes {
250 pub input: Vec<u8>,
251 pub slot_display: crate::packets::play::types::SlotDisplay,
252}
253
254#[derive(Debug, Clone, Default, PartialEq)]
255#[packet(id = 0x7e)]
256pub struct ClientboundPlayDeclareRecipes {
257 #[field(length = "varint")]
258 pub recipes: Vec<ClientboundPlayDeclareRecipesRecipes>,
259 #[field(length = "varint")]
260 pub stone_cutter_recipes: Vec<ClientboundPlayDeclareRecipesStonecutterrecipes>,
261}
262
263#[derive(Debug, Clone, Default, PartialEq)]
264#[packet(id = 0x27)]
265pub struct ClientboundPlayKeepAlive {
266 pub keep_alive_id: i64,
267}
268
269#[derive(Debug, Clone, Default, PartialEq)]
270#[packet(id = 0x1d)]
271pub struct ClientboundPlayKickDisconnect {
272 pub reason: NbtCompound,
273}
274
275#[derive(Debug, Clone, Default, PartialEq)]
276#[packet(id = 0x37)]
277pub struct ClientboundPlayPing {
278 pub id: i32,
279}
280
281#[derive(Debug, Clone, Default, PartialEq)]
282#[packet(id = 0x38)]
283pub struct ClientboundPlayPingResponse {
284 pub id: i64,
285}
286
287#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
289pub struct ClientboundPlayRecipeBookAddEntriesRecipe {
290 #[field(varint)]
291 pub display_id: i32,
292 pub display: crate::packets::play::types::RecipeDisplay,
293 #[field(varint)]
294 pub group: i32,
295 #[field(varint)]
296 pub category: i32,
297 #[field(optional)]
298 pub crafting_requirements: Option<Vec<u8>>,
299}
300
301#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
303pub struct ClientboundPlayRecipeBookAddEntries {
304 pub recipe: ClientboundPlayRecipeBookAddEntriesRecipe,
305 pub flags: u8,
306}
307
308#[derive(Debug, Clone, Default, PartialEq)]
309#[packet(id = 0x44)]
310pub struct ClientboundPlayRecipeBookAdd {
311 #[field(length = "varint")]
312 pub entries: Vec<ClientboundPlayRecipeBookAddEntries>,
313 pub replace: bool,
314}
315
316#[derive(Debug, Clone, Default, PartialEq)]
317#[packet(id = 0x45)]
318pub struct ClientboundPlayRecipeBookRemove {
319 #[field(length = "varint", element = "varint")]
320 pub recipe_ids: Vec<i32>,
321}
322
323#[derive(Debug, Clone, Default, PartialEq)]
324#[packet(id = 0x46)]
325pub struct ClientboundPlayRecipeBookSettings {
326 pub crafting_gui_open: bool,
327 pub crafting_filtering_craftable: bool,
328 pub smelting_gui_open: bool,
329 pub smelting_filtering_craftable: bool,
330 pub blast_gui_open: bool,
331 pub blast_filtering_craftable: bool,
332 pub smoker_gui_open: bool,
333 pub smoker_filtering_craftable: bool,
334}
335
336#[derive(Debug, Clone, Default, PartialEq)]
337#[packet(id = 0x4f)]
338pub struct ClientboundPlaySelectAdvancementTab {
339 #[field(optional)]
340 pub id: Option<String>,
341}
342
343#[derive(Debug, Clone, Default, PartialEq)]
344#[packet(id = 0x50)]
345pub struct ClientboundPlayServerData {
346 pub motd: NbtCompound,
347 #[field(optional)]
348 pub icon_bytes: Option<Vec<u8>>,
349}
350
351#[derive(Debug, Clone, Default, PartialEq)]
352#[packet(id = 0x78)]
353pub struct ClientboundPlaySetTickingState {
354 pub tick_rate: f32,
355 pub is_frozen: bool,
356}
357
358#[derive(Debug, Clone, Default, PartialEq)]
359#[packet(id = 0x6f)]
360pub struct ClientboundPlaySoundEffect {
361 pub sound: Vec<u8>,
362 #[field(varint)]
363 pub sound_category: i32,
364 pub x: i32,
365 pub y: i32,
366 pub z: i32,
367 pub volume: f32,
368 pub pitch: f32,
369 pub seed: i64,
370}
371
372#[derive(Debug, Clone, Default, PartialEq)]
373#[packet(id = 0x70)]
374pub struct ClientboundPlayStartConfiguration;
375
376#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
378pub struct ClientboundPlayStatisticsEntries {
379 #[field(varint)]
380 pub category_id: i32,
381 #[field(varint)]
382 pub statistic_id: i32,
383 #[field(varint)]
384 pub value: i32,
385}
386
387#[derive(Debug, Clone, Default, PartialEq)]
388#[packet(id = 0x04)]
389pub struct ClientboundPlayStatistics {
390 #[field(length = "varint")]
391 pub entries: Vec<ClientboundPlayStatisticsEntries>,
392}
393
394#[derive(Debug, Clone, Default, PartialEq)]
395#[packet(id = 0x79)]
396pub struct ClientboundPlayStepTick {
397 #[field(varint)]
398 pub tick_steps: i32,
399}
400
401#[derive(Debug, Clone, PartialEq, Encode, Decode, EncodedSize)]
403pub enum ClientboundPlayStopSoundFlags {
404 #[variant(id = 1)]
405 Variant1 {
406 #[field(varint)]
407 source: i32,
408 },
409 #[variant(id = 2)]
410 Variant2 { sound: String },
411 #[variant(id = 3)]
412 Variant3 {
413 #[field(varint)]
414 source: i32,
415 sound: String,
416 },
417}
418
419impl Default for ClientboundPlayStopSoundFlags {
420 fn default() -> Self {
421 Self::Variant1 {
422 source: Default::default(),
423 }
424 }
425}
426#[derive(Debug, Clone, Default, PartialEq)]
427#[packet(id = 0x71)]
428pub struct ClientboundPlayStopSound {
429 pub flags: ClientboundPlayStopSoundFlags,
430}
431
432#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
434pub struct ClientboundPlayTagsTagsTags {
435 pub tag_name: String,
436 #[field(length = "varint", element = "varint")]
437 pub entries: Vec<i32>,
438}
439
440#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
442pub struct ClientboundPlayTagsTags {
443 pub tag_type: String,
444 #[field(length = "varint")]
445 pub tags: Vec<ClientboundPlayTagsTagsTags>,
446}
447
448#[derive(Debug, Clone, Default, PartialEq)]
449#[packet(id = 0x7f)]
450pub struct ClientboundPlayTags {
451 #[field(length = "varint")]
452 pub tags: Vec<ClientboundPlayTagsTags>,
453}