diff options
| author | mat <github@matdoes.dev> | 2022-06-25 02:33:28 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-25 02:33:28 -0500 |
| commit | cd9a05e5a62190b3d4a2a733bf637d6324aec5fd (patch) | |
| tree | 15fb360678dfb5e8d81330144b810735b73f6ef4 /azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs | |
| parent | c9faf25fab4f89319731fec87ad4d2cf45864632 (diff) | |
| download | azalea-drasl-cd9a05e5a62190b3d4a2a733bf637d6324aec5fd.tar.xz | |
read_into -> read_from
yeah
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs')
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs index 05d57695..dc434eb7 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -49,15 +49,15 @@ impl McBufWritable for ShapedRecipe { } } impl McBufReadable for ShapedRecipe { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let width = buf.read_varint()?.try_into().unwrap(); let height = buf.read_varint()?.try_into().unwrap(); let group = buf.read_utf()?; let mut ingredients = Vec::with_capacity(width * height); for _ in 0..width * height { - ingredients.push(Ingredient::read_into(buf)?); + ingredients.push(Ingredient::read_from(buf)?); } - let result = Slot::read_into(buf)?; + let result = Slot::read_from(buf)?; Ok(ShapedRecipe { width, @@ -129,17 +129,17 @@ impl McBufWritable for Recipe { } impl McBufReadable for Recipe { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let recipe_type = ResourceLocation::read_into(buf)?; - let identifier = ResourceLocation::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let recipe_type = ResourceLocation::read_from(buf)?; + let identifier = ResourceLocation::read_from(buf)?; // rust doesn't let us match ResourceLocation so we have to do a big // if-else chain :( let data = if recipe_type == ResourceLocation::new("minecraft:crafting_shapeless").unwrap() { - RecipeData::CraftingShapeless(ShapelessRecipe::read_into(buf)?) + RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:crafting_shaped").unwrap() { - RecipeData::CraftingShaped(ShapedRecipe::read_into(buf)?) + RecipeData::CraftingShaped(ShapedRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:crafting_special_armordye").unwrap() { @@ -197,17 +197,17 @@ impl McBufReadable for Recipe { { RecipeData::CraftingSpecialSuspiciousStew } else if recipe_type == ResourceLocation::new("minecraft:smelting").unwrap() { - RecipeData::Smelting(CookingRecipe::read_into(buf)?) + RecipeData::Smelting(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:blasting").unwrap() { - RecipeData::Blasting(CookingRecipe::read_into(buf)?) + RecipeData::Blasting(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:smoking").unwrap() { - RecipeData::Smoking(CookingRecipe::read_into(buf)?) + RecipeData::Smoking(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:campfire_cooking").unwrap() { - RecipeData::CampfireCooking(CookingRecipe::read_into(buf)?) + RecipeData::CampfireCooking(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:stonecutting").unwrap() { - RecipeData::Stonecutting(StoneCuttingRecipe::read_into(buf)?) + RecipeData::Stonecutting(StoneCuttingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:smithing").unwrap() { - RecipeData::Smithing(SmithingRecipe::read_into(buf)?) + RecipeData::Smithing(SmithingRecipe::read_from(buf)?) } else { panic!("Unknown recipe type sent by server: {}", recipe_type); }; |
