Skip to main content

basalt_mc_protocol/packets/play/
world.rs

1//! Play state — world packets.
2//!
3//! Auto-generated by `cargo xt codegen` from minecraft-data.
4//! Do not edit manually — changes will be overwritten.
5
6use basalt_derive::{Decode, Encode, EncodedSize, packet};
7use basalt_types::{NbtCompound, Position, Vec3f64};
8
9// -- Serverbound packets --
10
11#[derive(Debug, Clone, Default, PartialEq)]
12#[packet(id = 0x27)]
13pub struct ServerboundPlayBlockDig {
14    #[field(varint)]
15    pub status: i32,
16    pub location: Position,
17    pub face: i8,
18    #[field(varint)]
19    pub sequence: i32,
20}
21
22#[derive(Debug, Clone, Default, PartialEq)]
23#[packet(id = 0x3c)]
24pub struct ServerboundPlayBlockPlace {
25    #[field(varint)]
26    pub hand: i32,
27    pub location: Position,
28    #[field(varint)]
29    pub direction: i32,
30    pub cursor_x: f32,
31    pub cursor_y: f32,
32    pub cursor_z: f32,
33    pub inside_block: bool,
34    pub world_border_hit: bool,
35    #[field(varint)]
36    pub sequence: i32,
37}
38
39#[derive(Debug, Clone, Default, PartialEq)]
40#[packet(id = 0x09)]
41pub struct ServerboundPlayChunkBatchReceived {
42    pub chunks_per_tick: f32,
43}
44
45#[derive(Debug, Clone, Default, PartialEq)]
46#[packet(id = 0x19)]
47pub struct ServerboundPlayGenerateStructure {
48    pub location: Position,
49    #[field(varint)]
50    pub levels: i32,
51    pub keep_jigsaws: bool,
52}
53
54#[derive(Debug, Clone, Default, PartialEq)]
55#[packet(id = 0x01)]
56pub struct ServerboundPlayQueryBlockNbt {
57    #[field(varint)]
58    pub transaction_id: i32,
59    pub location: Position,
60}
61
62#[derive(Debug, Clone, Default, PartialEq)]
63#[packet(id = 0x39)]
64pub struct ServerboundPlayUpdateSign {
65    pub location: Position,
66    pub is_front_text: bool,
67    pub text1: String,
68    pub text2: String,
69    pub text3: String,
70    pub text4: String,
71}
72
73// -- Clientbound packets --
74
75#[derive(Debug, Clone, Default, PartialEq)]
76#[packet(id = 0x05)]
77pub struct ClientboundPlayAcknowledgePlayerDigging {
78    #[field(varint)]
79    pub sequence_id: i32,
80}
81
82#[derive(Debug, Clone, Default, PartialEq)]
83#[packet(id = 0x08)]
84pub struct ClientboundPlayBlockAction {
85    pub location: Position,
86    pub byte1: u8,
87    pub byte2: u8,
88    #[field(varint)]
89    pub block_id: i32,
90}
91
92#[derive(Debug, Clone, Default, PartialEq)]
93#[packet(id = 0x09)]
94pub struct ClientboundPlayBlockChange {
95    pub location: Position,
96    #[field(varint)]
97    pub r#type: i32,
98}
99
100#[derive(Debug, Clone, Default, PartialEq)]
101#[packet(id = 0x0c)]
102pub struct ClientboundPlayChunkBatchFinished {
103    #[field(varint)]
104    pub batch_size: i32,
105}
106
107#[derive(Debug, Clone, Default, PartialEq)]
108#[packet(id = 0x0d)]
109pub struct ClientboundPlayChunkBatchStart;
110
111/// Inline data structure used by [`ClientboundPlayChunkBiomes`].
112#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
113pub struct ClientboundPlayChunkBiomesBiomes {
114    pub position: i64,
115    #[field(length = "varint")]
116    pub data: Vec<u8>,
117}
118
119#[derive(Debug, Clone, Default, PartialEq)]
120#[packet(id = 0x0e)]
121pub struct ClientboundPlayChunkBiomes {
122    #[field(length = "varint")]
123    pub biomes: Vec<ClientboundPlayChunkBiomesBiomes>,
124}
125
126#[derive(Debug, Clone, Default, PartialEq)]
127#[packet(id = 0x21)]
128pub struct ClientboundPlayExplosion {
129    pub x: f64,
130    pub y: f64,
131    pub z: f64,
132    #[field(optional)]
133    pub player_knockback: Option<Vec3f64>,
134    pub explosion_particle: crate::packets::play::types::Particle,
135    #[field(rest)]
136    pub sound: Vec<u8>,
137}
138
139#[derive(Debug, Clone, Default, PartialEq)]
140#[packet(id = 0x26)]
141pub struct ClientboundPlayInitializeWorldBorder {
142    pub x: f64,
143    pub z: f64,
144    pub old_diameter: f64,
145    pub new_diameter: f64,
146    #[field(varint)]
147    pub speed: i32,
148    #[field(varint)]
149    pub portal_teleport_boundary: i32,
150    #[field(varint)]
151    pub warning_blocks: i32,
152    #[field(varint)]
153    pub warning_time: i32,
154}
155
156/// Inline data structure used by [`ClientboundPlayMap`].
157#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
158pub struct ClientboundPlayMapIcons {
159    #[field(varint)]
160    pub r#type: i32,
161    pub x: i8,
162    pub z: i8,
163    pub direction: u8,
164    #[field(optional)]
165    pub display_name: Option<NbtCompound>,
166}
167
168#[derive(Debug, Clone, Default, PartialEq)]
169#[packet(id = 0x2d)]
170pub struct ClientboundPlayMap {
171    #[field(varint)]
172    pub item_damage: i32,
173    pub scale: i8,
174    pub locked: bool,
175    #[field(optional)]
176    pub icons: Option<Vec<u8>>,
177    pub columns: u8,
178    pub rows: Vec<u8>,
179    pub x: Vec<u8>,
180    pub y: Vec<u8>,
181    pub data: Vec<u8>,
182}
183
184/// Inline data structure used by [`ClientboundPlayMapChunk`].
185#[derive(Debug, Clone, Default, PartialEq, Encode, Decode, EncodedSize)]
186pub struct ClientboundPlayMapChunkChunkblockentity {
187    pub anon_0: u8,
188    pub y: i16,
189    #[field(varint)]
190    pub r#type: i32,
191    pub nbt_data: NbtCompound,
192}
193
194#[derive(Debug, Clone, Default, PartialEq)]
195#[packet(id = 0x28)]
196pub struct ClientboundPlayMapChunk {
197    pub x: i32,
198    pub z: i32,
199    pub heightmaps: NbtCompound,
200    #[field(length = "varint")]
201    pub chunk_data: Vec<u8>,
202    #[field(length = "varint")]
203    pub block_entities: Vec<ClientboundPlayMapChunkChunkblockentity>,
204    #[field(length = "varint")]
205    pub sky_light_mask: Vec<i64>,
206    #[field(length = "varint")]
207    pub block_light_mask: Vec<i64>,
208    #[field(length = "varint")]
209    pub empty_sky_light_mask: Vec<i64>,
210    #[field(length = "varint")]
211    pub empty_block_light_mask: Vec<i64>,
212    #[field(length = "varint")]
213    pub sky_light: Vec<Vec<u8>>,
214    #[field(length = "varint")]
215    pub block_light: Vec<Vec<u8>>,
216}
217
218#[derive(Debug, Clone, Default, PartialEq)]
219#[packet(id = 0x4e)]
220pub struct ClientboundPlayMultiBlockChange {
221    pub chunk_coordinates: u64,
222    #[field(length = "varint", element = "varint")]
223    pub records: Vec<i32>,
224}
225
226#[derive(Debug, Clone, Default, PartialEq)]
227#[packet(id = 0x75)]
228pub struct ClientboundPlayNbtQueryResponse {
229    #[field(varint)]
230    pub transaction_id: i32,
231    pub nbt: NbtCompound,
232}
233
234#[derive(Debug, Clone, Default, PartialEq)]
235#[packet(id = 0x5b)]
236pub struct ClientboundPlaySpawnPosition {
237    pub location: Position,
238    pub angle: f32,
239}
240
241#[derive(Debug, Clone, Default, PartialEq)]
242#[packet(id = 0x07)]
243pub struct ClientboundPlayTileEntityData {
244    pub location: Position,
245    #[field(varint)]
246    pub action: i32,
247    pub nbt_data: NbtCompound,
248}
249
250#[derive(Debug, Clone, Default, PartialEq)]
251#[packet(id = 0x22)]
252pub struct ClientboundPlayUnloadChunk {
253    pub chunk_z: i32,
254    pub chunk_x: i32,
255}
256
257#[derive(Debug, Clone, Default, PartialEq)]
258#[packet(id = 0x2b)]
259pub struct ClientboundPlayUpdateLight {
260    #[field(varint)]
261    pub chunk_x: i32,
262    #[field(varint)]
263    pub chunk_z: i32,
264    #[field(length = "varint")]
265    pub sky_light_mask: Vec<i64>,
266    #[field(length = "varint")]
267    pub block_light_mask: Vec<i64>,
268    #[field(length = "varint")]
269    pub empty_sky_light_mask: Vec<i64>,
270    #[field(length = "varint")]
271    pub empty_block_light_mask: Vec<i64>,
272    #[field(length = "varint")]
273    pub sky_light: Vec<Vec<u8>>,
274    #[field(length = "varint")]
275    pub block_light: Vec<Vec<u8>>,
276}
277
278#[derive(Debug, Clone, Default, PartialEq)]
279#[packet(id = 0x6b)]
280pub struct ClientboundPlayUpdateTime {
281    pub age: i64,
282    pub time: i64,
283    pub tick_day_time: bool,
284}
285
286#[derive(Debug, Clone, Default, PartialEq)]
287#[packet(id = 0x59)]
288pub struct ClientboundPlayUpdateViewDistance {
289    #[field(varint)]
290    pub view_distance: i32,
291}
292
293#[derive(Debug, Clone, Default, PartialEq)]
294#[packet(id = 0x58)]
295pub struct ClientboundPlayUpdateViewPosition {
296    #[field(varint)]
297    pub chunk_x: i32,
298    #[field(varint)]
299    pub chunk_z: i32,
300}
301
302#[derive(Debug, Clone, Default, PartialEq)]
303#[packet(id = 0x52)]
304pub struct ClientboundPlayWorldBorderCenter {
305    pub x: f64,
306    pub z: f64,
307}
308
309#[derive(Debug, Clone, Default, PartialEq)]
310#[packet(id = 0x53)]
311pub struct ClientboundPlayWorldBorderLerpSize {
312    pub old_diameter: f64,
313    pub new_diameter: f64,
314    #[field(varint)]
315    pub speed: i32,
316}
317
318#[derive(Debug, Clone, Default, PartialEq)]
319#[packet(id = 0x54)]
320pub struct ClientboundPlayWorldBorderSize {
321    pub diameter: f64,
322}
323
324#[derive(Debug, Clone, Default, PartialEq)]
325#[packet(id = 0x55)]
326pub struct ClientboundPlayWorldBorderWarningDelay {
327    #[field(varint)]
328    pub warning_time: i32,
329}
330
331#[derive(Debug, Clone, Default, PartialEq)]
332#[packet(id = 0x56)]
333pub struct ClientboundPlayWorldBorderWarningReach {
334    #[field(varint)]
335    pub warning_blocks: i32,
336}
337
338#[derive(Debug, Clone, Default, PartialEq)]
339#[packet(id = 0x29)]
340pub struct ClientboundPlayWorldEvent {
341    pub effect_id: i32,
342    pub location: Position,
343    pub data: i32,
344    pub global: bool,
345}
346
347#[derive(Debug, Clone, Default, PartialEq)]
348#[packet(id = 0x2a)]
349pub struct ClientboundPlayWorldParticles {
350    pub long_distance: bool,
351    pub always_show: bool,
352    pub x: f64,
353    pub y: f64,
354    pub z: f64,
355    pub offset_x: f32,
356    pub offset_y: f32,
357    pub offset_z: f32,
358    pub velocity_offset: f32,
359    pub amount: i32,
360    pub particle: crate::packets::play::types::Particle,
361}