aboutsummaryrefslogtreecommitdiff
path: root/azalea-client
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-11-13 12:34:47 +0930
committermat <git@matdoes.dev>2025-11-13 07:04:52 +0400
commitfbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00 (patch)
tree3126fb34a4e0ac979a1103a8227a2b9a136c1553 /azalea-client
parenta4312599f7c04709a92b7be238dcf577bafbb14f (diff)
downloadazalea-drasl-fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00.tar.xz
rename ResourceLocation to Identifier ahead of mojmap changes
Diffstat (limited to 'azalea-client')
-rw-r--r--azalea-client/src/client.rs7
-rw-r--r--azalea-client/src/plugins/packet/game/events.rs4
-rw-r--r--azalea-client/src/test_utils/simulation.rs12
-rw-r--r--azalea-client/tests/change_dimension_to_nether_and_back.rs28
-rw-r--r--azalea-client/tests/despawn_entities_when_changing_dimension.rs12
-rw-r--r--azalea-client/tests/fast_login.rs6
-rw-r--r--azalea-client/tests/login_to_dimension_with_same_name.rs22
-rw-r--r--azalea-client/tests/reply_to_ping_with_pong.rs6
-rw-r--r--azalea-client/tests/set_health_before_login.rs6
9 files changed, 51 insertions, 52 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 6957619e..e0902779 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -10,8 +10,7 @@ use std::{
use azalea_auth::game_profile::GameProfile;
use azalea_core::{
- data_registry::ResolvableDataRegistry, position::Vec3, resource_location::ResourceLocation,
- tick::GameTick,
+ data_registry::ResolvableDataRegistry, identifier::Identifier, position::Vec3, tick::GameTick,
};
use azalea_entity::{
EntityUpdateSystems, PlayerAbilities, Position,
@@ -487,7 +486,7 @@ impl Client {
pub fn resolve_registry_name(
&self,
registry: &impl ResolvableDataRegistry,
- ) -> Option<ResourceLocation> {
+ ) -> Option<Identifier> {
self.with_registry_holder(|registries| registry.resolve_name(registries))
}
/// Resolve the given registry to its name and data and call the given
@@ -502,7 +501,7 @@ impl Client {
pub fn with_resolved_registry<R>(
&self,
registry: impl ResolvableDataRegistry,
- f: impl FnOnce(&ResourceLocation, &NbtCompound) -> R,
+ f: impl FnOnce(&Identifier, &NbtCompound) -> R,
) -> Option<R> {
self.with_registry_holder(|registries| {
registry
diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs
index 7c773b44..53d93855 100644
--- a/azalea-client/src/plugins/packet/game/events.rs
+++ b/azalea-client/src/plugins/packet/game/events.rs
@@ -1,7 +1,7 @@
use std::sync::{Arc, Weak};
use azalea_chat::FormattedText;
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol::packets::{
Packet,
game::{ClientboundGamePacket, ClientboundPlayerCombatKill, ServerboundGamePacket},
@@ -145,7 +145,7 @@ pub struct ResourcePackEvent {
#[derive(Message, Debug, Clone)]
pub struct InstanceLoadedEvent {
pub entity: Entity,
- pub name: ResourceLocation,
+ pub name: Identifier,
pub instance: Weak<RwLock<Instance>>,
}
diff --git a/azalea-client/src/test_utils/simulation.rs b/azalea-client/src/test_utils/simulation.rs
index 8d52177a..13470600 100644
--- a/azalea-client/src/test_utils/simulation.rs
+++ b/azalea-client/src/test_utils/simulation.rs
@@ -6,8 +6,8 @@ use azalea_buf::AzaleaWrite;
use azalea_core::{
delta::LpVec3,
game_type::{GameMode, OptionalGameType},
+ identifier::Identifier,
position::{BlockPos, ChunkPos, Vec3},
- resource_location::ResourceLocation,
tick::GameTick,
};
use azalea_entity::metadata::PlayerMetadataBundle;
@@ -76,9 +76,9 @@ impl Simulation {
ConnectionProtocol::Configuration => {}
ConnectionProtocol::Game => {
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)),
@@ -302,13 +302,13 @@ fn tick_app(app: &mut App) {
pub fn default_login_packet() -> ClientboundLogin {
make_basic_login_packet(
DimensionType::new_raw(0), // overworld
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
)
}
pub fn make_basic_login_packet(
dimension_type: DimensionType,
- dimension: ResourceLocation,
+ dimension: Identifier,
) -> ClientboundLogin {
ClientboundLogin {
player_id: MinecraftEntityId(0),
@@ -338,7 +338,7 @@ pub fn make_basic_login_packet(
pub fn make_basic_respawn_packet(
dimension_type: DimensionType,
- dimension: ResourceLocation,
+ dimension: Identifier,
) -> ClientboundRespawn {
ClientboundRespawn {
common: CommonPlayerSpawnInfo {
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::<InGameState>());
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::<InstanceName>(),
- 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::<InstanceName>(),
- 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::<InstanceName>(),
- 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::<InConfigState>());
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::<InGameState>());
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::<InstanceName>(),
- 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::<InstanceName>(),
- 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::<InConfigState>());
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)),