Skip to content

Commit 0db861d

Browse files
committed
rename ResourceLocation to Identifier per mojmap changes
1 parent e58c065 commit 0db861d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+288
-304
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ is breaking anyways, semantic versioning is not followed.
1515

1616
### Changed
1717

18-
- Update to Minecraft 1.21.10. (help from @eihqnh)
18+
- Update to Minecraft 1.21.11. (with help from @eihqnh)
1919
- Update to Bevy 0.17.
2020
- `Client::query`, `map_component`, and `map_get_component` were replaced by `Client::query_self`.
2121
- Rename `SendPacketEvent` to `SendGamePacketEvent` and `PingEvent` to `GamePingEvent`.

azalea-client/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010

1111
use azalea_auth::game_profile::GameProfile;
1212
use azalea_core::{
13-
data_registry::ResolvableDataRegistry, position::Vec3, resource_location::ResourceLocation,
13+
data_registry::ResolvableDataRegistry, position::Vec3, resource_location::Identifier,
1414
tick::GameTick,
1515
};
1616
use azalea_entity::{
@@ -487,7 +487,7 @@ impl Client {
487487
pub fn resolve_registry_name(
488488
&self,
489489
registry: &impl ResolvableDataRegistry,
490-
) -> Option<ResourceLocation> {
490+
) -> Option<Identifier> {
491491
self.with_registry_holder(|registries| registry.resolve_name(registries))
492492
}
493493
/// Resolve the given registry to its name and data and call the given
@@ -502,7 +502,7 @@ impl Client {
502502
pub fn with_resolved_registry<R>(
503503
&self,
504504
registry: impl ResolvableDataRegistry,
505-
f: impl FnOnce(&ResourceLocation, &NbtCompound) -> R,
505+
f: impl FnOnce(&Identifier, &NbtCompound) -> R,
506506
) -> Option<R> {
507507
self.with_registry_holder(|registries| {
508508
registry

azalea-client/src/plugins/packet/game/events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::{Arc, Weak};
22

33
use azalea_chat::FormattedText;
4-
use azalea_core::resource_location::ResourceLocation;
4+
use azalea_core::resource_location::Identifier;
55
use azalea_protocol::packets::{
66
Packet,
77
game::{ClientboundGamePacket, ClientboundPlayerCombatKill, ServerboundGamePacket},
@@ -145,7 +145,7 @@ pub struct ResourcePackEvent {
145145
#[derive(Message, Debug, Clone)]
146146
pub struct InstanceLoadedEvent {
147147
pub entity: Entity,
148-
pub name: ResourceLocation,
148+
pub name: Identifier,
149149
pub instance: Weak<RwLock<Instance>>,
150150
}
151151

azalea-client/src/test_utils/simulation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use azalea_core::{
77
delta::LpVec3,
88
game_type::{GameMode, OptionalGameType},
99
position::{BlockPos, ChunkPos, Vec3},
10-
resource_location::ResourceLocation,
10+
resource_location::Identifier,
1111
tick::GameTick,
1212
};
1313
use azalea_entity::metadata::PlayerMetadataBundle;
@@ -76,9 +76,9 @@ impl Simulation {
7676
ConnectionProtocol::Configuration => {}
7777
ConnectionProtocol::Game => {
7878
simulation.receive_packet(ClientboundRegistryData {
79-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
79+
registry_id: Identifier::new("minecraft:dimension_type"),
8080
entries: vec![(
81-
ResourceLocation::new("minecraft:overworld"),
81+
Identifier::new("minecraft:overworld"),
8282
Some(NbtCompound::from_values(vec![
8383
("height".into(), NbtTag::Int(384)),
8484
("min_y".into(), NbtTag::Int(-64)),
@@ -302,13 +302,13 @@ fn tick_app(app: &mut App) {
302302
pub fn default_login_packet() -> ClientboundLogin {
303303
make_basic_login_packet(
304304
DimensionType::new_raw(0), // overworld
305-
ResourceLocation::new("minecraft:overworld"),
305+
Identifier::new("minecraft:overworld"),
306306
)
307307
}
308308

309309
pub fn make_basic_login_packet(
310310
dimension_type: DimensionType,
311-
dimension: ResourceLocation,
311+
dimension: Identifier,
312312
) -> ClientboundLogin {
313313
ClientboundLogin {
314314
player_id: MinecraftEntityId(0),
@@ -338,7 +338,7 @@ pub fn make_basic_login_packet(
338338

339339
pub fn make_basic_respawn_packet(
340340
dimension_type: DimensionType,
341-
dimension: ResourceLocation,
341+
dimension: Identifier,
342342
) -> ClientboundRespawn {
343343
ClientboundRespawn {
344344
common: CommonPlayerSpawnInfo {

azalea-client/tests/change_dimension_to_nether_and_back.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use azalea_client::{InConfigState, InGameState, test_utils::prelude::*};
2-
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
2+
use azalea_core::{position::ChunkPos, resource_location::Identifier};
33
use azalea_entity::LocalEntity;
44
use azalea_protocol::packets::{
55
ConnectionProtocol, Packet,
@@ -19,11 +19,11 @@ fn test_change_dimension_to_nether_and_back() {
1919

2020
fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
2121
let make_basic_login_or_respawn_packet = if using_respawn {
22-
|dimension: DimensionType, instance_name: ResourceLocation| {
22+
|dimension: DimensionType, instance_name: Identifier| {
2323
make_basic_respawn_packet(dimension, instance_name).into_variant()
2424
}
2525
} else {
26-
|dimension: DimensionType, instance_name: ResourceLocation| {
26+
|dimension: DimensionType, instance_name: Identifier| {
2727
make_basic_login_packet(dimension, instance_name).into_variant()
2828
}
2929
};
@@ -33,26 +33,26 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
3333
assert!(!simulation.has_component::<InGameState>());
3434

3535
simulation.receive_packet(ClientboundRegistryData {
36-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
36+
registry_id: Identifier::new("minecraft:dimension_type"),
3737
entries: vec![
3838
(
3939
// this dimension should never be created. it just exists to make sure we're not
4040
// hard-coding the dimension type id anywhere.
41-
ResourceLocation::new("azalea:fakedimension"),
41+
Identifier::new("azalea:fakedimension"),
4242
Some(NbtCompound::from_values(vec![
4343
("height".into(), NbtTag::Int(16)),
4444
("min_y".into(), NbtTag::Int(0)),
4545
])),
4646
),
4747
(
48-
ResourceLocation::new("minecraft:overworld"),
48+
Identifier::new("minecraft:overworld"),
4949
Some(NbtCompound::from_values(vec![
5050
("height".into(), NbtTag::Int(384)),
5151
("min_y".into(), NbtTag::Int(-64)),
5252
])),
5353
),
5454
(
55-
ResourceLocation::new("minecraft:nether"),
55+
Identifier::new("minecraft:nether"),
5656
Some(NbtCompound::from_values(vec![
5757
("height".into(), NbtTag::Int(256)),
5858
("min_y".into(), NbtTag::Int(0)),
@@ -76,13 +76,13 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
7676

7777
simulation.receive_packet(make_basic_login_packet(
7878
DimensionType::new_raw(1), // overworld
79-
ResourceLocation::new("azalea:a"),
79+
Identifier::new("azalea:a"),
8080
));
8181
simulation.tick();
8282

8383
assert_eq!(
8484
*simulation.component::<InstanceName>(),
85-
ResourceLocation::new("azalea:a"),
85+
Identifier::new("azalea:a"),
8686
"InstanceName should be azalea:a after setting dimension to that"
8787
);
8888

@@ -99,7 +99,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
9999

100100
simulation.receive_packet(make_basic_login_or_respawn_packet(
101101
DimensionType::new_raw(2), // nether
102-
ResourceLocation::new("azalea:b"),
102+
Identifier::new("azalea:b"),
103103
));
104104
simulation.tick();
105105

@@ -109,7 +109,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
109109
);
110110
assert_eq!(
111111
*simulation.component::<InstanceName>(),
112-
ResourceLocation::new("azalea:b"),
112+
Identifier::new("azalea:b"),
113113
"InstanceName should be azalea:b after changing dimensions to that"
114114
);
115115

@@ -121,7 +121,7 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
121121
.expect("chunk should exist");
122122
simulation.receive_packet(make_basic_login_or_respawn_packet(
123123
DimensionType::new_raw(2), // nether
124-
ResourceLocation::new("minecraft:nether"),
124+
Identifier::new("minecraft:nether"),
125125
));
126126
simulation.tick();
127127

@@ -131,13 +131,13 @@ fn generic_test_change_dimension_to_nether_and_back(using_respawn: bool) {
131131

132132
simulation.receive_packet(make_basic_login_packet(
133133
DimensionType::new_raw(1), // overworld
134-
ResourceLocation::new("azalea:a"),
134+
Identifier::new("azalea:a"),
135135
));
136136
simulation.tick();
137137

138138
assert_eq!(
139139
*simulation.component::<InstanceName>(),
140-
ResourceLocation::new("azalea:a"),
140+
Identifier::new("azalea:a"),
141141
"InstanceName should be azalea:a after setting dimension back to that"
142142
);
143143
assert!(

azalea-client/tests/despawn_entities_when_changing_dimension.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use azalea_client::test_utils::prelude::*;
2-
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
2+
use azalea_core::{position::ChunkPos, resource_location::Identifier};
33
use azalea_entity::metadata::Cow;
44
use azalea_protocol::packets::{
55
ConnectionProtocol,
@@ -15,17 +15,17 @@ fn test_despawn_entities_when_changing_dimension() {
1515

1616
let mut simulation = Simulation::new(ConnectionProtocol::Configuration);
1717
simulation.receive_packet(ClientboundRegistryData {
18-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
18+
registry_id: Identifier::new("minecraft:dimension_type"),
1919
entries: vec![
2020
(
21-
ResourceLocation::new("minecraft:overworld"),
21+
Identifier::new("minecraft:overworld"),
2222
Some(NbtCompound::from_values(vec![
2323
("height".into(), NbtTag::Int(384)),
2424
("min_y".into(), NbtTag::Int(-64)),
2525
])),
2626
),
2727
(
28-
ResourceLocation::new("minecraft:nether"),
28+
Identifier::new("minecraft:nether"),
2929
Some(NbtCompound::from_values(vec![
3030
("height".into(), NbtTag::Int(256)),
3131
("min_y".into(), NbtTag::Int(0)),
@@ -45,7 +45,7 @@ fn test_despawn_entities_when_changing_dimension() {
4545

4646
simulation.receive_packet(make_basic_login_packet(
4747
DimensionType::new_raw(0), // overworld
48-
ResourceLocation::new("azalea:a"),
48+
Identifier::new("azalea:a"),
4949
));
5050
simulation.tick();
5151

@@ -65,7 +65,7 @@ fn test_despawn_entities_when_changing_dimension() {
6565

6666
simulation.receive_packet(make_basic_respawn_packet(
6767
DimensionType::new_raw(1), // nether
68-
ResourceLocation::new("azalea:b"),
68+
Identifier::new("azalea:b"),
6969
));
7070
simulation.tick();
7171

azalea-client/tests/fast_login.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use azalea_client::{InConfigState, test_utils::prelude::*};
2-
use azalea_core::resource_location::ResourceLocation;
2+
use azalea_core::resource_location::Identifier;
33
use azalea_entity::metadata::Health;
44
use azalea_protocol::packets::{
55
ConnectionProtocol,
@@ -16,9 +16,9 @@ fn test_fast_login() {
1616
assert!(simulation.has_component::<InConfigState>());
1717

1818
simulation.receive_packet(ClientboundRegistryData {
19-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
19+
registry_id: Identifier::new("minecraft:dimension_type"),
2020
entries: vec![(
21-
ResourceLocation::new("minecraft:overworld"),
21+
Identifier::new("minecraft:overworld"),
2222
Some(NbtCompound::from_values(vec![
2323
("height".into(), NbtTag::Int(384)),
2424
("min_y".into(), NbtTag::Int(-64)),

azalea-client/tests/login_to_dimension_with_same_name.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use azalea_client::{
22
InConfigState, InGameState, local_player::InstanceHolder, test_utils::prelude::*,
33
};
4-
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
4+
use azalea_core::{position::ChunkPos, resource_location::Identifier};
55
use azalea_entity::LocalEntity;
66
use azalea_protocol::packets::{
77
ConnectionProtocol, Packet,
@@ -22,11 +22,11 @@ fn test_login_to_dimension_with_same_name() {
2222

2323
fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
2424
let make_basic_login_or_respawn_packet = if using_respawn {
25-
|dimension: DimensionType, instance_name: ResourceLocation| {
25+
|dimension: DimensionType, instance_name: Identifier| {
2626
make_basic_respawn_packet(dimension, instance_name).into_variant()
2727
}
2828
} else {
29-
|dimension: DimensionType, instance_name: ResourceLocation| {
29+
|dimension: DimensionType, instance_name: Identifier| {
3030
make_basic_login_packet(dimension, instance_name).into_variant()
3131
}
3232
};
@@ -36,9 +36,9 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
3636
assert!(!simulation.has_component::<InGameState>());
3737

3838
simulation.receive_packet(ClientboundRegistryData {
39-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
39+
registry_id: Identifier::new("minecraft:dimension_type"),
4040
entries: vec![(
41-
ResourceLocation::new("minecraft:overworld"),
41+
Identifier::new("minecraft:overworld"),
4242
Some(NbtCompound::from_values(vec![
4343
("height".into(), NbtTag::Int(384)),
4444
("min_y".into(), NbtTag::Int(-64)),
@@ -61,13 +61,13 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
6161

6262
simulation.receive_packet(make_basic_login_packet(
6363
DimensionType::new_raw(0), // overworld
64-
ResourceLocation::new("azalea:overworld"),
64+
Identifier::new("azalea:overworld"),
6565
));
6666
simulation.tick();
6767

6868
assert_eq!(
6969
*simulation.component::<InstanceName>(),
70-
ResourceLocation::new("azalea:overworld"),
70+
Identifier::new("azalea:overworld"),
7171
"InstanceName should be azalea:overworld after setting dimension to that"
7272
);
7373

@@ -84,9 +84,9 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
8484

8585
simulation.receive_packet(ClientboundStartConfiguration);
8686
simulation.receive_packet(ClientboundRegistryData {
87-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
87+
registry_id: Identifier::new("minecraft:dimension_type"),
8888
entries: vec![(
89-
ResourceLocation::new("minecraft:overworld"),
89+
Identifier::new("minecraft:overworld"),
9090
Some(NbtCompound::from_values(vec![
9191
("height".into(), NbtTag::Int(256)),
9292
("min_y".into(), NbtTag::Int(0)),
@@ -98,7 +98,7 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
9898
simulation.receive_packet(ClientboundFinishConfiguration);
9999
simulation.receive_packet(make_basic_login_or_respawn_packet(
100100
DimensionType::new_raw(0),
101-
ResourceLocation::new("azalea:overworld"),
101+
Identifier::new("azalea:overworld"),
102102
));
103103
simulation.tick();
104104

@@ -108,7 +108,7 @@ fn generic_test_login_to_dimension_with_same_name(using_respawn: bool) {
108108
);
109109
assert_eq!(
110110
*simulation.component::<InstanceName>(),
111-
ResourceLocation::new("azalea:overworld"),
111+
Identifier::new("azalea:overworld"),
112112
"InstanceName should still be azalea:overworld after changing dimensions to that"
113113
);
114114
assert_eq!(

azalea-client/tests/reply_to_ping_with_pong.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use azalea_client::{
44
packet::{config::SendConfigPacketEvent, game::SendGamePacketEvent},
55
test_utils::prelude::*,
66
};
7-
use azalea_core::resource_location::ResourceLocation;
7+
use azalea_core::resource_location::Identifier;
88
use azalea_protocol::packets::{
99
ConnectionProtocol,
1010
config::{
@@ -42,9 +42,9 @@ fn reply_to_ping_with_pong() {
4242
// move into game state and test ClientboundPing there
4343

4444
simulation.receive_packet(ClientboundRegistryData {
45-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
45+
registry_id: Identifier::new("minecraft:dimension_type"),
4646
entries: vec![(
47-
ResourceLocation::new("minecraft:overworld"),
47+
Identifier::new("minecraft:overworld"),
4848
Some(NbtCompound::from_values(vec![
4949
("height".into(), NbtTag::Int(384)),
5050
("min_y".into(), NbtTag::Int(-64)),

azalea-client/tests/set_health_before_login.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use azalea_client::{InConfigState, test_utils::prelude::*};
2-
use azalea_core::resource_location::ResourceLocation;
2+
use azalea_core::resource_location::Identifier;
33
use azalea_entity::{LocalEntity, metadata::Health};
44
use azalea_protocol::packets::{
55
ConnectionProtocol,
@@ -16,9 +16,9 @@ fn test_set_health_before_login() {
1616
assert!(simulation.has_component::<InConfigState>());
1717

1818
simulation.receive_packet(ClientboundRegistryData {
19-
registry_id: ResourceLocation::new("minecraft:dimension_type"),
19+
registry_id: Identifier::new("minecraft:dimension_type"),
2020
entries: vec![(
21-
ResourceLocation::new("minecraft:overworld"),
21+
Identifier::new("minecraft:overworld"),
2222
Some(NbtCompound::from_values(vec![
2323
("height".into(), NbtTag::Int(384)),
2424
("min_y".into(), NbtTag::Int(-64)),

0 commit comments

Comments
 (0)