diff options
| author | mat <github@matdoes.dev> | 2023-03-14 01:22:15 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2023-03-14 01:22:15 -0500 |
| commit | aa846bc0270d3f0974cfb27ac5057dbf9c08748b (patch) | |
| tree | 639d46f6036337033d8b50c883ef6259b9aefb87 /azalea-protocol/src | |
| parent | 1ff24959627d03d7b2491ad3111d270ef128a4be (diff) | |
| download | azalea-drasl-aa846bc0270d3f0974cfb27ac5057dbf9c08748b.tar.xz | |
make ResourceLocation::new -> Self and impl Serialize/Deserialize for ResourceLocation
Diffstat (limited to 'azalea-protocol/src')
4 files changed, 10 insertions, 12 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs index 73dcbce7..36a82c7e 100755 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs @@ -364,7 +364,7 @@ mod tests { node_type: NodeType::Argument { name: "position".to_string(), parser: BrigadierParser::Vec3, - suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion").unwrap()), + suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion")), }, }; let mut buf = Vec::new(); diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index 03edbea5..a79e0f5e 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -348,7 +348,7 @@ pub mod registry { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))] pub struct SoundId { - pub sound_id: ResourceLocation, + pub sound_id: azalea_registry::SoundEvent, } /// Biome particles. @@ -445,7 +445,7 @@ mod tests { root: RegistryRoot { chat_type: Tag::End, dimension_type: RegistryType::<DimensionTypeElement> { - kind: ResourceLocation::new("minecraft:dimension_type").unwrap(), + kind: ResourceLocation::new("minecraft:dimension_type"), value: Vec::new(), }, world_type: Tag::End, diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs index 038cdcf2..dcc6332a 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs @@ -124,7 +124,7 @@ mod tests { let packet = ClientboundUpdateAdvancementsPacket { reset: true, added: [( - ResourceLocation::new("minecraft:test").unwrap(), + ResourceLocation::new("minecraft:test"), Advancement { parent_id: None, display: Some(DisplayInfo { @@ -144,11 +144,11 @@ mod tests { )] .into_iter() .collect(), - removed: vec![ResourceLocation::new("minecraft:test2").unwrap()], + removed: vec![ResourceLocation::new("minecraft:test2")], progress: [( - ResourceLocation::new("minecraft:test3").unwrap(), + ResourceLocation::new("minecraft:test3"), [( - ResourceLocation::new("minecraft:test4").unwrap(), + ResourceLocation::new("minecraft:test4"), CriterionProgress { date: Some(123456789), }, @@ -170,12 +170,12 @@ mod tests { let advancement = packet .added - .get(&ResourceLocation::new("minecraft:test").unwrap()) + .get(&ResourceLocation::new("minecraft:test")) .unwrap() .clone(); let read_advancement = read_packet .added - .get(&ResourceLocation::new("minecraft:test").unwrap()) + .get(&ResourceLocation::new("minecraft:test")) .unwrap() .clone(); assert_eq!(advancement.parent_id, read_advancement.parent_id); 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 e95e9316..d9acb20d 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -182,9 +182,7 @@ impl McBufWritable for Recipe { RecipeData::Stonecutting(_) => "minecraft:stonecutting", RecipeData::Smithing(_) => "minecraft:smithing", }; - ResourceLocation::new(resource_location) - .unwrap() - .write_into(buf)?; + ResourceLocation::new(resource_location).write_into(buf)?; self.identifier.write_into(buf)?; self.data.write_without_id(buf)?; Ok(()) |
