From fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 13 Nov 2025 12:34:47 +0930 Subject: rename ResourceLocation to Identifier ahead of mojmap changes --- .../tests/change_dimension_to_nether_and_back.rs | 28 +++++++++++----------- .../despawn_entities_when_changing_dimension.rs | 12 +++++----- azalea-client/tests/fast_login.rs | 6 ++--- .../tests/login_to_dimension_with_same_name.rs | 22 ++++++++--------- azalea-client/tests/reply_to_ping_with_pong.rs | 6 ++--- azalea-client/tests/set_health_before_login.rs | 6 ++--- 6 files changed, 40 insertions(+), 40 deletions(-) (limited to 'azalea-client/tests') diff --git a/azalea-client/tests/change_dimension_to_nether_and_back.rs b/azalea-client/tests/change_dimension_to_nether_and_back.rs index e3b5d96e..9594da04 100644 --- a/azalea-client/tests/change_dimension_to_nether_and_back.rs +++ b/azalea-client/tests/change_dimension_to_nether_and_back.rs @@ -1,5 +1,5 @@ use azalea_client::{InConfigState, InGameState, test_utils::prelude::*}; -use azalea_core::{position::ChunkPos, resource_location::ResourceLocation}; +use azalea_core::{identifier::Identifier, position::ChunkPos}; use azalea_entity::LocalEntity; use azalea_protocol::packets::{ ConnectionProtocol, Packet, @@ -19,11 +19,11 @@ fn test_change_dimension_to_nether_and_back() { fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { let make_basic_login_or_respawn_packet = if using_respawn { - |dimension: DimensionType, instance_name: ResourceLocation| { + |dimension: DimensionType, instance_name: Identifier| { make_basic_respawn_packet(dimension, instance_name).into_variant() } } else { - |dimension: DimensionType, instance_name: ResourceLocation| { + |dimension: DimensionType, instance_name: Identifier| { make_basic_login_packet(dimension, instance_name).into_variant() } }; @@ -33,26 +33,26 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { assert!(!simulation.has_component::()); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![ ( // this dimension should never be created. it just exists to make sure we're not // hard-coding the dimension type id anywhere. - ResourceLocation::new("azalea:fakedimension"), + Identifier::new("azalea:fakedimension"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(16)), ("min_y".into(), NbtTag::Int(0)), ])), ), ( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), ])), ), ( - ResourceLocation::new("minecraft:nether"), + Identifier::new("minecraft:nether"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(256)), ("min_y".into(), NbtTag::Int(0)), @@ -76,13 +76,13 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { simulation.receive_packet(make_basic_login_packet( DimensionType::new_raw(1), // overworld - ResourceLocation::new("azalea:a"), + Identifier::new("azalea:a"), )); simulation.tick(); assert_eq!( *simulation.component::(), - ResourceLocation::new("azalea:a"), + Identifier::new("azalea:a"), "InstanceName should be azalea:a after setting dimension to that" ); @@ -99,7 +99,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { simulation.receive_packet(make_basic_login_or_respawn_packet( DimensionType::new_raw(2), // nether - ResourceLocation::new("azalea:b"), + Identifier::new("azalea:b"), )); simulation.tick(); @@ -109,7 +109,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { ); assert_eq!( *simulation.component::(), - ResourceLocation::new("azalea:b"), + Identifier::new("azalea:b"), "InstanceName should be azalea:b after changing dimensions to that" ); @@ -121,7 +121,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { .expect("chunk should exist"); simulation.receive_packet(make_basic_login_or_respawn_packet( DimensionType::new_raw(2), // nether - ResourceLocation::new("minecraft:nether"), + Identifier::new("minecraft:nether"), )); simulation.tick(); @@ -131,13 +131,13 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) { simulation.receive_packet(make_basic_login_packet( DimensionType::new_raw(1), // overworld - ResourceLocation::new("azalea:a"), + Identifier::new("azalea:a"), )); simulation.tick(); assert_eq!( *simulation.component::(), - ResourceLocation::new("azalea:a"), + Identifier::new("azalea:a"), "InstanceName should be azalea:a after setting dimension back to that" ); assert!( diff --git a/azalea-client/tests/despawn_entities_when_changing_dimension.rs b/azalea-client/tests/despawn_entities_when_changing_dimension.rs index 9143b3eb..38388c04 100644 --- a/azalea-client/tests/despawn_entities_when_changing_dimension.rs +++ b/azalea-client/tests/despawn_entities_when_changing_dimension.rs @@ -1,5 +1,5 @@ use azalea_client::test_utils::prelude::*; -use azalea_core::{position::ChunkPos, resource_location::ResourceLocation}; +use azalea_core::{identifier::Identifier, position::ChunkPos}; use azalea_entity::metadata::Cow; use azalea_protocol::packets::{ ConnectionProtocol, @@ -15,17 +15,17 @@ fn test_despawn_entities_when_changing_dimension() { let mut simulation = Simulation::new(ConnectionProtocol::Configuration); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![ ( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), ])), ), ( - ResourceLocation::new("minecraft:nether"), + Identifier::new("minecraft:nether"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(256)), ("min_y".into(), NbtTag::Int(0)), @@ -45,7 +45,7 @@ fn test_despawn_entities_when_changing_dimension() { simulation.receive_packet(make_basic_login_packet( DimensionType::new_raw(0), // overworld - ResourceLocation::new("azalea:a"), + Identifier::new("azalea:a"), )); simulation.tick(); @@ -65,7 +65,7 @@ fn test_despawn_entities_when_changing_dimension() { simulation.receive_packet(make_basic_respawn_packet( DimensionType::new_raw(1), // nether - ResourceLocation::new("azalea:b"), + Identifier::new("azalea:b"), )); simulation.tick(); diff --git a/azalea-client/tests/fast_login.rs b/azalea-client/tests/fast_login.rs index f11ada9c..7962d79e 100644 --- a/azalea-client/tests/fast_login.rs +++ b/azalea-client/tests/fast_login.rs @@ -1,5 +1,5 @@ use azalea_client::{InConfigState, test_utils::prelude::*}; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_entity::metadata::Health; use azalea_protocol::packets::{ ConnectionProtocol, @@ -16,9 +16,9 @@ fn test_fast_login() { assert!(simulation.has_component::()); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), diff --git a/azalea-client/tests/login_to_dimension_with_same_name.rs b/azalea-client/tests/login_to_dimension_with_same_name.rs index eb1db2a8..0a28cfd3 100644 --- a/azalea-client/tests/login_to_dimension_with_same_name.rs +++ b/azalea-client/tests/login_to_dimension_with_same_name.rs @@ -1,7 +1,7 @@ use azalea_client::{ InConfigState, InGameState, local_player::InstanceHolder, test_utils::prelude::*, }; -use azalea_core::{position::ChunkPos, resource_location::ResourceLocation}; +use azalea_core::{identifier::Identifier, position::ChunkPos}; use azalea_entity::LocalEntity; use azalea_protocol::packets::{ ConnectionProtocol, Packet, @@ -22,11 +22,11 @@ fn test_login_to_dimension_with_same_name() { fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { let make_basic_login_or_respawn_packet = if using_respawn { - |dimension: DimensionType, instance_name: ResourceLocation| { + |dimension: DimensionType, instance_name: Identifier| { make_basic_respawn_packet(dimension, instance_name).into_variant() } } else { - |dimension: DimensionType, instance_name: ResourceLocation| { + |dimension: DimensionType, instance_name: Identifier| { make_basic_login_packet(dimension, instance_name).into_variant() } }; @@ -36,9 +36,9 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { assert!(!simulation.has_component::()); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), @@ -61,13 +61,13 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { simulation.receive_packet(make_basic_login_packet( DimensionType::new_raw(0), // overworld - ResourceLocation::new("azalea:overworld"), + Identifier::new("azalea:overworld"), )); simulation.tick(); assert_eq!( *simulation.component::(), - ResourceLocation::new("azalea:overworld"), + Identifier::new("azalea:overworld"), "InstanceName should be azalea:overworld after setting dimension to that" ); @@ -84,9 +84,9 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { simulation.receive_packet(ClientboundStartConfiguration); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(256)), ("min_y".into(), NbtTag::Int(0)), @@ -98,7 +98,7 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { simulation.receive_packet(ClientboundFinishConfiguration); simulation.receive_packet(make_basic_login_or_respawn_packet( DimensionType::new_raw(0), - ResourceLocation::new("azalea:overworld"), + Identifier::new("azalea:overworld"), )); simulation.tick(); @@ -108,7 +108,7 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) { ); assert_eq!( *simulation.component::(), - ResourceLocation::new("azalea:overworld"), + Identifier::new("azalea:overworld"), "InstanceName should still be azalea:overworld after changing dimensions to that" ); assert_eq!( diff --git a/azalea-client/tests/reply_to_ping_with_pong.rs b/azalea-client/tests/reply_to_ping_with_pong.rs index 444ec41c..ff369a1d 100644 --- a/azalea-client/tests/reply_to_ping_with_pong.rs +++ b/azalea-client/tests/reply_to_ping_with_pong.rs @@ -4,7 +4,7 @@ use azalea_client::{ packet::{config::SendConfigPacketEvent, game::SendGamePacketEvent}, test_utils::prelude::*, }; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_protocol::packets::{ ConnectionProtocol, config::{ @@ -42,9 +42,9 @@ fn reply_to_ping_with_pong() { // move into game state and test ClientboundPing there simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), diff --git a/azalea-client/tests/set_health_before_login.rs b/azalea-client/tests/set_health_before_login.rs index 367bd10c..5b2dfc8e 100644 --- a/azalea-client/tests/set_health_before_login.rs +++ b/azalea-client/tests/set_health_before_login.rs @@ -1,5 +1,5 @@ use azalea_client::{InConfigState, test_utils::prelude::*}; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use azalea_entity::{LocalEntity, metadata::Health}; use azalea_protocol::packets::{ ConnectionProtocol, @@ -16,9 +16,9 @@ fn test_set_health_before_login() { assert!(simulation.has_component::()); simulation.receive_packet(ClientboundRegistryData { - registry_id: ResourceLocation::new("minecraft:dimension_type"), + registry_id: Identifier::new("minecraft:dimension_type"), entries: vec![( - ResourceLocation::new("minecraft:overworld"), + Identifier::new("minecraft:overworld"), Some(NbtCompound::from_values(vec![ ("height".into(), NbtTag::Int(384)), ("min_y".into(), NbtTag::Int(-64)), -- cgit v1.2.3