diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2024-10-23 00:08:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 00:08:13 -0500 |
| commit | 40e4096d2435533eacb817ad5a5e12c7ced8fa5c (patch) | |
| tree | 937c4024bb7f69b19b6d053e02a9e5b3b02d98aa /azalea-protocol/src/packets/game/clientbound_recipe_packet.rs | |
| parent | abc7b43b8c641b6dc4b107bb9624b86235bd36db (diff) | |
| download | azalea-drasl-40e4096d2435533eacb817ad5a5e12c7ced8fa5c.tar.xz | |
1.21.2 (#171)
* partially implement 24w35a
* start updating to 24w39a + itemcomponent codegen
* fix codegen and broken packets to finish updating to 24w39a :D
* update to 1.21.2 except for blocks
* update ServerboundPlayerInputPacket impl
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_recipe_packet.rs')
| -rwxr-xr-x | azalea-protocol/src/packets/game/clientbound_recipe_packet.rs | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs deleted file mode 100755 index e948e53c..00000000 --- a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs +++ /dev/null @@ -1,77 +0,0 @@ -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; -use std::io::{Cursor, Write}; - -#[derive(Clone, Debug, ClientboundGamePacket)] -pub struct ClientboundRecipePacket { - pub action: State, - pub settings: RecipeBookSettings, - pub recipes: Vec<ResourceLocation>, -} - -impl McBufWritable for ClientboundRecipePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self.action { - State::Init { .. } => 0, - State::Add => 1, - State::Remove => 2, - } - .var_write_into(buf)?; - self.settings.write_into(buf)?; - self.recipes.write_into(buf)?; - if let State::Init { to_highlight } = &self.action { - to_highlight.write_into(buf)?; - } - Ok(()) - } -} -impl McBufReadable for ClientboundRecipePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { - let action_id = u32::var_read_from(buf)?; - let settings = RecipeBookSettings::read_from(buf)?; - let recipes = Vec::<ResourceLocation>::read_from(buf)?; - let action = match action_id { - 0 => State::Init { - to_highlight: Vec::<ResourceLocation>::read_from(buf)?, - }, - 1 => State::Add, - 2 => State::Remove, - _ => { - return Err(BufReadError::UnexpectedEnumVariant { - id: action_id as i32, - }) - } - }; - - Ok(ClientboundRecipePacket { - action, - settings, - recipes, - }) - } -} - -#[derive(Clone, Debug, McBuf)] -pub struct RecipeBookSettings { - pub gui_open: bool, - pub filtering_craftable: bool, - - pub furnace_gui_open: bool, - pub furnace_filtering_craftable: bool, - - pub blast_furnace_gui_open: bool, - pub blast_furnace_filtering_craftable: bool, - - pub smoker_gui_open: bool, - pub smoker_filtering_craftable: bool, -} - -#[derive(Clone, Debug)] -pub enum State { - Init { to_highlight: Vec<ResourceLocation> }, - Add, - Remove, -} |
