diff options
| author | mat <git@matdoes.dev> | 2025-11-13 12:34:47 +0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-11-13 07:04:52 +0400 |
| commit | fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00 (patch) | |
| tree | 3126fb34a4e0ac979a1103a8227a2b9a136c1553 /azalea-protocol/src/packets/game | |
| parent | a4312599f7c04709a92b7be238dcf577bafbb14f (diff) | |
| download | azalea-drasl-fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00.tar.xz | |
rename ResourceLocation to Identifier ahead of mojmap changes
Diffstat (limited to 'azalea-protocol/src/packets/game')
18 files changed, 61 insertions, 63 deletions
diff --git a/azalea-protocol/src/packets/game/c_add_entity.rs b/azalea-protocol/src/packets/game/c_add_entity.rs index fe473289..fbd2cb8a 100644 --- a/azalea-protocol/src/packets/game/c_add_entity.rs +++ b/azalea-protocol/src/packets/game/c_add_entity.rs @@ -1,5 +1,5 @@ use azalea_buf::AzBuf; -use azalea_core::{delta::LpVec3, position::Vec3, resource_location::ResourceLocation}; +use azalea_core::{delta::LpVec3, identifier::Identifier, position::Vec3}; use azalea_entity::{EntityBundle, metadata::apply_default_metadata}; use azalea_protocol_macros::ClientboundGamePacket; use azalea_world::MinecraftEntityId; @@ -34,7 +34,7 @@ impl ClientboundAddEntity { /// /// You must apply the metadata after inserting the bundle with /// [`Self::apply_metadata`]. - pub fn as_entity_bundle(&self, world_name: ResourceLocation) -> EntityBundle { + pub fn as_entity_bundle(&self, world_name: Identifier) -> EntityBundle { EntityBundle::new(self.uuid, self.position, self.entity_type, world_name) } diff --git a/azalea-protocol/src/packets/game/c_commands.rs b/azalea-protocol/src/packets/game/c_commands.rs index 303f8481..46be5613 100644 --- a/azalea-protocol/src/packets/game/c_commands.rs +++ b/azalea-protocol/src/packets/game/c_commands.rs @@ -1,7 +1,7 @@ use std::io::{self, Cursor, Write}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; -use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; +use azalea_core::{bitset::FixedBitSet, identifier::Identifier}; use azalea_protocol_macros::ClientboundGamePacket; use tracing::warn; @@ -131,7 +131,7 @@ pub enum BrigadierParser { Team, ItemSlot, ItemSlots, - ResourceLocation, + Identifier, Function, EntityAnchor, IntRange, @@ -139,11 +139,11 @@ pub enum BrigadierParser { Dimension, GameMode, Time { min: i32 }, - ResourceOrTag { registry_key: ResourceLocation }, - ResourceOrTagKey { registry_key: ResourceLocation }, - Resource { registry_key: ResourceLocation }, - ResourceKey { registry_key: ResourceLocation }, - ResourceSelector { registry_key: ResourceLocation }, + ResourceOrTag { registry_key: Identifier }, + ResourceOrTagKey { registry_key: Identifier }, + Resource { registry_key: Identifier }, + ResourceKey { registry_key: Identifier }, + ResourceSelector { registry_key: Identifier }, TemplateMirror, TemplateRotation, Heightmap, @@ -210,7 +210,7 @@ impl AzaleaRead for BrigadierNodeStub { let name = String::azalea_read(buf)?; let parser = BrigadierParser::azalea_read(buf)?; let suggestions_type = if has_suggestions_type { - Some(ResourceLocation::azalea_read(buf)?) + Some(Identifier::azalea_read(buf)?) } else { None }; @@ -318,7 +318,7 @@ pub enum NodeType { Argument { name: String, parser: BrigadierParser, - suggestions_type: Option<ResourceLocation>, + suggestions_type: Option<Identifier>, }, } @@ -379,7 +379,7 @@ mod tests { node_type: NodeType::Argument { name: "position".to_string(), parser: BrigadierParser::Vec3, - suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion")), + suggestions_type: Some(Identifier::new("minecraft:test_suggestion")), }, is_restricted: false, }; diff --git a/azalea-protocol/src/packets/game/c_cookie_request.rs b/azalea-protocol/src/packets/game/c_cookie_request.rs index 06828aec..7b1e8e30 100644 --- a/azalea-protocol/src/packets/game/c_cookie_request.rs +++ b/azalea-protocol/src/packets/game/c_cookie_request.rs @@ -1,8 +1,8 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundCookieRequest { - pub key: ResourceLocation, + pub key: Identifier, } diff --git a/azalea-protocol/src/packets/game/c_custom_payload.rs b/azalea-protocol/src/packets/game/c_custom_payload.rs index 33c446c2..e76967a6 100644 --- a/azalea-protocol/src/packets/game/c_custom_payload.rs +++ b/azalea-protocol/src/packets/game/c_custom_payload.rs @@ -1,10 +1,9 @@ -use azalea_buf::AzBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; +use azalea_buf::{AzBuf, UnsizedByteArray}; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundCustomPayload { - pub identifier: ResourceLocation, + pub identifier: Identifier, pub data: UnsizedByteArray, } diff --git a/azalea-protocol/src/packets/game/c_login.rs b/azalea-protocol/src/packets/game/c_login.rs index 61f553e3..1c89dbac 100644 --- a/azalea-protocol/src/packets/game/c_login.rs +++ b/azalea-protocol/src/packets/game/c_login.rs @@ -1,5 +1,5 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; use azalea_world::MinecraftEntityId; @@ -13,7 +13,7 @@ use crate::packets::common::CommonPlayerSpawnInfo; pub struct ClientboundLogin { pub player_id: MinecraftEntityId, pub hardcore: bool, - pub levels: Vec<ResourceLocation>, + pub levels: Vec<Identifier>, #[var] pub max_players: i32, #[var] diff --git a/azalea-protocol/src/packets/game/c_select_advancements_tab.rs b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs index ec390ce5..0eee09de 100644 --- a/azalea-protocol/src/packets/game/c_select_advancements_tab.rs +++ b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs @@ -1,8 +1,8 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundSelectAdvancementsTab { - pub tab: Option<ResourceLocation>, + pub tab: Option<Identifier>, } diff --git a/azalea-protocol/src/packets/game/c_stop_sound.rs b/azalea-protocol/src/packets/game/c_stop_sound.rs index 70f3c424..f6b42325 100644 --- a/azalea-protocol/src/packets/game/c_stop_sound.rs +++ b/azalea-protocol/src/packets/game/c_stop_sound.rs @@ -1,7 +1,7 @@ use std::io::{self, Cursor, Write}; use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; -use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; +use azalea_core::{bitset::FixedBitSet, identifier::Identifier}; use azalea_protocol_macros::ClientboundGamePacket; use super::c_sound::SoundSource; @@ -9,7 +9,7 @@ use super::c_sound::SoundSource; #[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] pub struct ClientboundStopSound { pub source: Option<SoundSource>, - pub name: Option<ResourceLocation>, + pub name: Option<Identifier>, } impl AzaleaRead for ClientboundStopSound { @@ -21,7 +21,7 @@ impl AzaleaRead for ClientboundStopSound { None }; let name = if set.index(1) { - Some(ResourceLocation::azalea_read(buf)?) + Some(Identifier::azalea_read(buf)?) } else { None }; diff --git a/azalea-protocol/src/packets/game/c_store_cookie.rs b/azalea-protocol/src/packets/game/c_store_cookie.rs index 0b48ed0e..9646c3b9 100644 --- a/azalea-protocol/src/packets/game/c_store_cookie.rs +++ b/azalea-protocol/src/packets/game/c_store_cookie.rs @@ -1,9 +1,9 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundStoreCookie { - pub key: ResourceLocation, + pub key: Identifier, pub payload: Vec<u8>, } diff --git a/azalea-protocol/src/packets/game/c_update_advancements.rs b/azalea-protocol/src/packets/game/c_update_advancements.rs index d1b1fa80..7296d916 100644 --- a/azalea-protocol/src/packets/game/c_update_advancements.rs +++ b/azalea-protocol/src/packets/game/c_update_advancements.rs @@ -5,7 +5,7 @@ use std::{ use azalea_buf::AzBuf; use azalea_chat::FormattedText; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; use indexmap::IndexMap; @@ -14,14 +14,14 @@ use indexmap::IndexMap; pub struct ClientboundUpdateAdvancements { pub reset: bool, pub added: Vec<AdvancementHolder>, - pub removed: Vec<ResourceLocation>, - pub progress: IndexMap<ResourceLocation, AdvancementProgress>, + pub removed: Vec<Identifier>, + pub progress: IndexMap<Identifier, AdvancementProgress>, pub show_advancements: bool, } #[derive(Clone, Debug, AzBuf, PartialEq)] pub struct Advancement { - pub parent_id: Option<ResourceLocation>, + pub parent_id: Option<Identifier>, pub display: Option<DisplayInfo>, pub requirements: Vec<Vec<String>>, pub sends_telemetry_event: bool, @@ -35,7 +35,7 @@ pub struct DisplayInfo { pub frame: FrameType, pub show_toast: bool, pub hidden: bool, - pub background: Option<ResourceLocation>, + pub background: Option<Identifier>, pub x: f32, pub y: f32, } @@ -80,7 +80,7 @@ impl azalea_buf::AzaleaRead for DisplayInfo { let hidden = (data & 0b100) != 0; let background = if has_background { - Some(ResourceLocation::azalea_read(buf)?) + Some(Identifier::azalea_read(buf)?) } else { None }; @@ -116,7 +116,7 @@ pub struct CriterionProgress { #[derive(Clone, Debug, AzBuf, PartialEq)] pub struct AdvancementHolder { - pub id: ResourceLocation, + pub id: Identifier, pub value: Advancement, } @@ -131,7 +131,7 @@ mod tests { let packet = ClientboundUpdateAdvancements { reset: true, added: [AdvancementHolder { - id: ResourceLocation::new("minecraft:test"), + id: Identifier::new("minecraft:test"), value: Advancement { parent_id: None, display: Some(DisplayInfo { @@ -151,9 +151,9 @@ mod tests { }] .into_iter() .collect(), - removed: vec![ResourceLocation::new("minecraft:test2")], + removed: vec![Identifier::new("minecraft:test2")], progress: [( - ResourceLocation::new("minecraft:test3"), + Identifier::new("minecraft:test3"), [( "minecraft:test4".to_string(), CriterionProgress { @@ -180,7 +180,7 @@ mod tests { .added .into_iter() .find_map(|a| { - if a.id == ResourceLocation::new("minecraft:test") { + if a.id == Identifier::new("minecraft:test") { Some(a.value) } else { None @@ -192,7 +192,7 @@ mod tests { .added .into_iter() .find_map(|a| { - if a.id == ResourceLocation::new("minecraft:test") { + if a.id == Identifier::new("minecraft:test") { Some(a.value) } else { None diff --git a/azalea-protocol/src/packets/game/c_update_recipes.rs b/azalea-protocol/src/packets/game/c_update_recipes.rs index c425622e..e05708a3 100644 --- a/azalea-protocol/src/packets/game/c_update_recipes.rs +++ b/azalea-protocol/src/packets/game/c_update_recipes.rs @@ -1,14 +1,14 @@ use std::collections::HashMap; use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ClientboundGamePacket; use crate::common::recipe::{Ingredient, SlotDisplayData}; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundUpdateRecipes { - pub item_sets: HashMap<ResourceLocation, RecipePropertySet>, + pub item_sets: HashMap<Identifier, RecipePropertySet>, pub stonecutter_recipes: Vec<SingleInputEntry>, } diff --git a/azalea-protocol/src/packets/game/c_waypoint.rs b/azalea-protocol/src/packets/game/c_waypoint.rs index d7c6ad91..0debb0d0 100644 --- a/azalea-protocol/src/packets/game/c_waypoint.rs +++ b/azalea-protocol/src/packets/game/c_waypoint.rs @@ -1,7 +1,7 @@ use std::io::{self, Cursor, Write}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; -use azalea_core::{color::RgbColor, position::Vec3i, resource_location::ResourceLocation}; +use azalea_core::{color::RgbColor, identifier::Identifier, position::Vec3i}; use azalea_protocol_macros::ClientboundGamePacket; use uuid::Uuid; @@ -33,7 +33,7 @@ pub enum WaypointIdentifier { #[derive(Clone, Debug, PartialEq)] pub struct WaypointIcon { - pub style: ResourceLocation, + pub style: Identifier, pub color: Option<RgbColor>, } impl AzaleaWrite for WaypointIcon { @@ -50,7 +50,7 @@ impl AzaleaWrite for WaypointIcon { } impl AzaleaRead for WaypointIcon { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let style = ResourceLocation::azalea_read(buf)?; + let style = Identifier::azalea_read(buf)?; let color = Option::<CompactRgbColor>::azalea_read(buf)?; let color = color.map(|c| RgbColor::new(c.r, c.g, c.b)); diff --git a/azalea-protocol/src/packets/game/s_cookie_response.rs b/azalea-protocol/src/packets/game/s_cookie_response.rs index fd6b8a51..a6a99cf7 100644 --- a/azalea-protocol/src/packets/game/s_cookie_response.rs +++ b/azalea-protocol/src/packets/game/s_cookie_response.rs @@ -1,9 +1,9 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundCookieResponse { - pub key: ResourceLocation, + pub key: Identifier, pub payload: Option<Vec<u8>>, } diff --git a/azalea-protocol/src/packets/game/s_custom_click_action.rs b/azalea-protocol/src/packets/game/s_custom_click_action.rs index 338137c4..193405df 100644 --- a/azalea-protocol/src/packets/game/s_custom_click_action.rs +++ b/azalea-protocol/src/packets/game/s_custom_click_action.rs @@ -1,10 +1,10 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; use simdnbt::owned::Nbt; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundCustomClickAction { - pub id: ResourceLocation, + pub id: Identifier, pub payload: Nbt, } diff --git a/azalea-protocol/src/packets/game/s_custom_payload.rs b/azalea-protocol/src/packets/game/s_custom_payload.rs index 1f2897e2..8753c7f7 100644 --- a/azalea-protocol/src/packets/game/s_custom_payload.rs +++ b/azalea-protocol/src/packets/game/s_custom_payload.rs @@ -1,10 +1,9 @@ -use azalea_buf::AzBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; +use azalea_buf::{AzBuf, UnsizedByteArray}; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundCustomPayload { - pub identifier: ResourceLocation, + pub identifier: Identifier, pub data: UnsizedByteArray, } diff --git a/azalea-protocol/src/packets/game/s_place_recipe.rs b/azalea-protocol/src/packets/game/s_place_recipe.rs index fe56cd96..a1f007a0 100644 --- a/azalea-protocol/src/packets/game/s_place_recipe.rs +++ b/azalea-protocol/src/packets/game/s_place_recipe.rs @@ -1,11 +1,11 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundPlaceRecipe { #[var] pub container_id: i32, - pub recipe: ResourceLocation, + pub recipe: Identifier, pub shift_down: bool, } diff --git a/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs index 7fa1da45..350c7290 100644 --- a/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs +++ b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs @@ -1,8 +1,8 @@ use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundRecipeBookSeenRecipe { - pub recipe: ResourceLocation, + pub recipe: Identifier, } diff --git a/azalea-protocol/src/packets/game/s_seen_advancements.rs b/azalea-protocol/src/packets/game/s_seen_advancements.rs index 1c502568..7d9e552b 100644 --- a/azalea-protocol/src/packets/game/s_seen_advancements.rs +++ b/azalea-protocol/src/packets/game/s_seen_advancements.rs @@ -1,7 +1,7 @@ use std::io::{self, Cursor, Write}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol_macros::ServerboundGamePacket; use crate::packets::BufReadError; @@ -9,7 +9,7 @@ use crate::packets::BufReadError; #[derive(Clone, Debug, PartialEq, ServerboundGamePacket)] pub struct ServerboundSeenAdvancements { pub action: Action, - pub tab: Option<ResourceLocation>, + pub tab: Option<Identifier>, } #[derive(AzBuf, Clone, Copy, Debug, Eq, PartialEq)] @@ -22,7 +22,7 @@ impl AzaleaRead for ServerboundSeenAdvancements { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let action = Action::azalea_read(buf)?; let tab = if action == Action::OpenedTab { - Some(ResourceLocation::azalea_read(buf)?) + Some(Identifier::azalea_read(buf)?) } else { None }; diff --git a/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs index 8999faf4..ac942d88 100644 --- a/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs +++ b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs @@ -4,7 +4,7 @@ use std::{ }; use azalea_buf::{AzBuf, AzaleaRead}; -use azalea_core::{position::BlockPos, resource_location::ResourceLocation}; +use azalea_core::{identifier::Identifier, position::BlockPos}; use azalea_protocol_macros::ServerboundGamePacket; use crate::packets::{AzaleaWrite, BufReadError}; @@ -12,9 +12,9 @@ use crate::packets::{AzaleaWrite, BufReadError}; #[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] pub struct ServerboundSetJigsawBlock { pub pos: BlockPos, - pub name: ResourceLocation, - pub target: ResourceLocation, - pub pool: ResourceLocation, + pub name: Identifier, + pub target: Identifier, + pub pool: Identifier, pub final_state: String, pub joint: String, #[var] |
