aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-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
-rw-r--r--azalea-core/src/checksum.rs4
-rw-r--r--azalea-core/src/data_registry.rs14
-rw-r--r--azalea-core/src/identifier.rs (renamed from azalea-core/src/resource_location.rs)58
-rw-r--r--azalea-core/src/lib.rs7
-rw-r--r--azalea-core/src/position.rs10
-rw-r--r--azalea-core/src/registry_holder.rs28
-rw-r--r--azalea-core/src/sound.rs4
-rw-r--r--azalea-entity/src/attributes.rs16
-rw-r--r--azalea-entity/src/lib.rs4
-rw-r--r--azalea-inventory/src/components/mod.rs44
-rw-r--r--azalea-inventory/src/components/profile.rs4
-rw-r--r--azalea-inventory/src/item/consume_effect.rs4
-rw-r--r--azalea-physics/src/fluids.rs4
-rw-r--r--azalea-physics/tests/physics.rs26
-rw-r--r--azalea-protocol/src/common/recipe.rs6
-rw-r--r--azalea-protocol/src/common/tags.rs12
-rw-r--r--azalea-protocol/src/packets/common.rs6
-rw-r--r--azalea-protocol/src/packets/config/c_cookie_request.rs4
-rw-r--r--azalea-protocol/src/packets/config/c_custom_payload.rs4
-rw-r--r--azalea-protocol/src/packets/config/c_registry_data.rs6
-rw-r--r--azalea-protocol/src/packets/config/c_store_cookie.rs4
-rw-r--r--azalea-protocol/src/packets/config/c_update_enabled_features.rs4
-rw-r--r--azalea-protocol/src/packets/config/s_cookie_response.rs4
-rw-r--r--azalea-protocol/src/packets/config/s_custom_click_action.rs4
-rw-r--r--azalea-protocol/src/packets/config/s_custom_payload.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_add_entity.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_commands.rs20
-rw-r--r--azalea-protocol/src/packets/game/c_cookie_request.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_custom_payload.rs7
-rw-r--r--azalea-protocol/src/packets/game/c_login.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_select_advancements_tab.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_stop_sound.rs6
-rw-r--r--azalea-protocol/src/packets/game/c_store_cookie.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_update_advancements.rs24
-rw-r--r--azalea-protocol/src/packets/game/c_update_recipes.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_waypoint.rs6
-rw-r--r--azalea-protocol/src/packets/game/s_cookie_response.rs4
-rw-r--r--azalea-protocol/src/packets/game/s_custom_click_action.rs4
-rw-r--r--azalea-protocol/src/packets/game/s_custom_payload.rs7
-rw-r--r--azalea-protocol/src/packets/game/s_place_recipe.rs4
-rw-r--r--azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs4
-rw-r--r--azalea-protocol/src/packets/game/s_seen_advancements.rs6
-rw-r--r--azalea-protocol/src/packets/game/s_set_jigsaw_block.rs8
-rw-r--r--azalea-protocol/src/packets/login/c_cookie_request.rs4
-rw-r--r--azalea-protocol/src/packets/login/c_custom_query.rs4
-rw-r--r--azalea-protocol/src/packets/login/s_cookie_response.rs4
-rw-r--r--azalea-registry/src/lib.rs36
-rw-r--r--azalea-world/src/container.rs8
-rw-r--r--azalea/src/lib.rs5
-rw-r--r--azalea/src/pathfinder/simulation.rs8
-rw-r--r--codegen/lib/code/data_components.py12
-rw-r--r--codegen/lib/code/utils.py4
-rw-r--r--codegen/lib/extract.py10
63 files changed, 301 insertions, 307 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b49fda01..03459fc9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ is breaking anyways, semantic versioning is not followed.
- Rename `SendPacketEvent` to `SendGamePacketEvent` and `PingEvent` to `GamePingEvent`.
- Swap the order of the type parameters in entity filtering functions so query is first, then filter.
- Add optional `timeout_ticks` field to `Client::open_container_at`.
+- Rename `ResourceLocation` to `Identifier` to match Minecraft's new internal naming.
### Fixed
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)),
diff --git a/azalea-core/src/checksum.rs b/azalea-core/src/checksum.rs
index 4661d171..df94d58e 100644
--- a/azalea-core/src/checksum.rs
+++ b/azalea-core/src/checksum.rs
@@ -6,7 +6,7 @@ use serde::{Serialize, ser};
use thiserror::Error;
use tracing::error;
-use crate::{registry_holder::RegistryHolder, resource_location::ResourceLocation};
+use crate::{identifier::Identifier, registry_holder::RegistryHolder};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, AzBuf)]
pub struct Checksum(pub u32);
@@ -200,7 +200,7 @@ impl<'a, 'r> ser::Serializer for ChecksumSerializer<'a, 'r> {
let value = self
.registries
.map
- .get(&ResourceLocation::from(name))
+ .get(&Identifier::from(name))
.and_then(|r| r.get_index(variant_index as usize))
.map(|r| r.0.to_string())
.unwrap_or_default();
diff --git a/azalea-core/src/data_registry.rs b/azalea-core/src/data_registry.rs
index 6e2c29ff..d3fae125 100644
--- a/azalea-core/src/data_registry.rs
+++ b/azalea-core/src/data_registry.rs
@@ -3,23 +3,23 @@ use std::{io::Cursor, str::FromStr};
use azalea_registry::DataRegistry;
use simdnbt::owned::NbtCompound;
-use crate::{registry_holder::RegistryHolder, resource_location::ResourceLocation};
+use crate::{identifier::Identifier, registry_holder::RegistryHolder};
pub trait ResolvableDataRegistry: DataRegistry {
- fn resolve_name(&self, registries: &RegistryHolder) -> Option<ResourceLocation> {
+ fn resolve_name(&self, registries: &RegistryHolder) -> Option<Identifier> {
self.resolve(registries).map(|(name, _)| name.clone())
}
fn resolve<'a>(
&self,
registries: &'a RegistryHolder,
- ) -> Option<(&'a ResourceLocation, &'a NbtCompound)> {
- let name_resourcelocation = ResourceLocation::from_str(Self::NAME).unwrap_or_else(|_| {
+ ) -> Option<(&'a Identifier, &'a NbtCompound)> {
+ let name_ident = Identifier::from_str(Self::NAME).unwrap_or_else(|_| {
panic!(
- "Name for registry should be a valid ResourceLocation: {}",
+ "Name for registry should be a valid Identifier: {}",
Self::NAME
)
});
- let registry_values = registries.map.get(&name_resourcelocation)?;
+ let registry_values = registries.map.get(&name_ident)?;
let resolved = registry_values.get_index(self.protocol_id() as usize)?;
Some(resolved)
}
@@ -27,7 +27,7 @@ pub trait ResolvableDataRegistry: DataRegistry {
fn resolve_and_deserialize<T: simdnbt::Deserialize>(
&self,
registries: &RegistryHolder,
- ) -> Option<Result<(ResourceLocation, T), simdnbt::DeserializeError>> {
+ ) -> Option<Result<(Identifier, T), simdnbt::DeserializeError>> {
let (name, value) = self.resolve(registries)?;
let mut nbt_bytes = Vec::new();
diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/identifier.rs
index 1591f678..d1e46aef 100644
--- a/azalea-core/src/resource_location.rs
+++ b/azalea-core/src/identifier.rs
@@ -1,4 +1,4 @@
-//! A resource, like minecraft:stone
+//! An arbitrary string identifier.
use std::{
fmt,
@@ -10,8 +10,12 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
use simdnbt::{FromNbtTag, ToNbtTag, owned::NbtTag};
+/// An identifier, like `minecraft:stone` or `brigadier:number`.
+///
+/// This was formerly called a `ResourceLocation`.
+#[doc(alias = "ResourceLocation")]
#[derive(Hash, Clone, PartialEq, Eq, Default)]
-pub struct ResourceLocation {
+pub struct Identifier {
pub namespace: String,
pub path: String,
}
@@ -19,8 +23,8 @@ pub struct ResourceLocation {
static DEFAULT_NAMESPACE: &str = "minecraft";
// static REALMS_NAMESPACE: &str = "realms";
-impl ResourceLocation {
- pub fn new(resource_string: &str) -> ResourceLocation {
+impl Identifier {
+ pub fn new(resource_string: &str) -> Identifier {
let sep_byte_position_option = resource_string.chars().position(|c| c == ':');
let (namespace, path) = if let Some(sep_byte_position) = sep_byte_position_option {
if sep_byte_position == 0 {
@@ -34,49 +38,49 @@ impl ResourceLocation {
} else {
(DEFAULT_NAMESPACE, resource_string)
};
- ResourceLocation {
+ Identifier {
namespace: namespace.to_string(),
path: path.to_string(),
}
}
}
-impl fmt::Display for ResourceLocation {
+impl fmt::Display for Identifier {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.namespace, self.path)
}
}
-impl fmt::Debug for ResourceLocation {
+impl fmt::Debug for Identifier {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.namespace, self.path)
}
}
-impl FromStr for ResourceLocation {
+impl FromStr for Identifier {
type Err = &'static str;
fn from_str(s: &str) -> Result<Self, Self::Err> {
- Ok(ResourceLocation::new(s))
+ Ok(Identifier::new(s))
}
}
-impl From<&str> for ResourceLocation {
+impl From<&str> for Identifier {
fn from(s: &str) -> Self {
- ResourceLocation::new(s)
+ Identifier::new(s)
}
}
-impl AzaleaRead for ResourceLocation {
+impl AzaleaRead for Identifier {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let location_string = String::azalea_read(buf)?;
- Ok(ResourceLocation::new(&location_string))
+ Ok(Identifier::new(&location_string))
}
}
-impl AzaleaWrite for ResourceLocation {
+impl AzaleaWrite for Identifier {
fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
self.to_string().azalea_write(buf)
}
}
-impl Serialize for ResourceLocation {
+impl Serialize for Identifier {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
@@ -85,30 +89,30 @@ impl Serialize for ResourceLocation {
}
}
-impl<'de> Deserialize<'de> for ResourceLocation {
+impl<'de> Deserialize<'de> for Identifier {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
if s.contains(':') {
- Ok(ResourceLocation::new(&s))
+ Ok(Identifier::new(&s))
} else {
Err(de::Error::invalid_value(
de::Unexpected::Str(&s),
- &"a valid ResourceLocation",
+ &"a valid Identifier",
))
}
}
}
-impl FromNbtTag for ResourceLocation {
+impl FromNbtTag for Identifier {
fn from_nbt_tag(tag: simdnbt::borrow::NbtTag) -> Option<Self> {
tag.string().and_then(|s| s.to_str().parse().ok())
}
}
-impl ToNbtTag for ResourceLocation {
+impl ToNbtTag for Identifier {
fn to_nbt_tag(self) -> NbtTag {
NbtTag::String(self.to_string().into())
}
@@ -120,25 +124,25 @@ mod tests {
#[test]
fn basic_resource_location() {
- let r = ResourceLocation::new("abcdef:ghijkl");
+ let r = Identifier::new("abcdef:ghijkl");
assert_eq!(r.namespace, "abcdef");
assert_eq!(r.path, "ghijkl");
}
#[test]
fn no_namespace() {
- let r = ResourceLocation::new("azalea");
+ let r = Identifier::new("azalea");
assert_eq!(r.namespace, "minecraft");
assert_eq!(r.path, "azalea");
}
#[test]
fn colon_start() {
- let r = ResourceLocation::new(":azalea");
+ let r = Identifier::new(":azalea");
assert_eq!(r.namespace, "minecraft");
assert_eq!(r.path, "azalea");
}
#[test]
fn colon_end() {
- let r = ResourceLocation::new("azalea:");
+ let r = Identifier::new("azalea:");
assert_eq!(r.namespace, "azalea");
assert_eq!(r.path, "");
}
@@ -146,15 +150,15 @@ mod tests {
#[test]
fn azbuf_resource_location() {
let mut buf = Vec::new();
- ResourceLocation::new("minecraft:dirt")
+ Identifier::new("minecraft:dirt")
.azalea_write(&mut buf)
.unwrap();
let mut buf = Cursor::new(&buf[..]);
assert_eq!(
- ResourceLocation::azalea_read(&mut buf).unwrap(),
- ResourceLocation::new("minecraft:dirt")
+ Identifier::azalea_read(&mut buf).unwrap(),
+ Identifier::new("minecraft:dirt")
);
}
}
diff --git a/azalea-core/src/lib.rs b/azalea-core/src/lib.rs
index 9fdf4b6c..b87e6143 100644
--- a/azalea-core/src/lib.rs
+++ b/azalea-core/src/lib.rs
@@ -15,11 +15,16 @@ pub mod direction;
pub mod filterable;
pub mod game_type;
pub mod hit_result;
+pub mod identifier;
pub mod math;
pub mod objectives;
pub mod position;
pub mod registry_holder;
-pub mod resource_location;
+pub mod resource_location {
+ #![deprecated(note = "renamed to `identifier`.")]
+ #[deprecated(note = "renamed to `identifier::Identifier`.")]
+ pub type ResourceLocation = crate::identifier::Identifier;
+}
pub mod sound;
#[cfg(feature = "bevy_ecs")]
pub mod tick;
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index 1686a7ad..03ea49ec 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -16,9 +16,7 @@ use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
use serde::{Serialize, Serializer};
use simdnbt::Deserialize;
-use crate::{
- codec_utils::IntArray, direction::Direction, math, resource_location::ResourceLocation,
-};
+use crate::{codec_utils::IntArray, direction::Direction, identifier::Identifier, math};
macro_rules! vec3_impl {
($name:ident, $type:ty) => {
@@ -723,7 +721,7 @@ impl nohash_hasher::IsEnabled for ChunkSectionBlockPos {}
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct GlobalPos {
// this is actually a ResourceKey in Minecraft, but i don't think it matters?
- pub dimension: ResourceLocation,
+ pub dimension: Identifier,
pub pos: BlockPos,
}
@@ -958,7 +956,7 @@ impl AzaleaRead for BlockPos {
impl AzaleaRead for GlobalPos {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
Ok(GlobalPos {
- dimension: ResourceLocation::azalea_read(buf)?,
+ dimension: Identifier::azalea_read(buf)?,
pos: BlockPos::azalea_read(buf)?,
})
}
@@ -987,7 +985,7 @@ impl AzaleaWrite for BlockPos {
impl AzaleaWrite for GlobalPos {
fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
- ResourceLocation::azalea_write(&self.dimension, buf)?;
+ Identifier::azalea_write(&self.dimension, buf)?;
BlockPos::azalea_write(&self.pos, buf)?;
Ok(())
diff --git a/azalea-core/src/registry_holder.rs b/azalea-core/src/registry_holder.rs
index 7c5bfede..6730cd20 100644
--- a/azalea-core/src/registry_holder.rs
+++ b/azalea-core/src/registry_holder.rs
@@ -14,7 +14,7 @@ use simdnbt::{
};
use tracing::error;
-use crate::resource_location::ResourceLocation;
+use crate::identifier::Identifier;
/// The base of the registry.
///
@@ -26,15 +26,11 @@ use crate::resource_location::ResourceLocation;
/// world.
#[derive(Default, Debug, Clone)]
pub struct RegistryHolder {
- pub map: HashMap<ResourceLocation, IndexMap<ResourceLocation, NbtCompound>>,
+ pub map: HashMap<Identifier, IndexMap<Identifier, NbtCompound>>,
}
impl RegistryHolder {
- pub fn append(
- &mut self,
- id: ResourceLocation,
- entries: Vec<(ResourceLocation, Option<NbtCompound>)>,
- ) {
+ pub fn append(&mut self, id: Identifier, entries: Vec<(Identifier, Option<NbtCompound>)>) {
let map = self.map.entry(id).or_default();
for (key, value) in entries {
if let Some(value) = value {
@@ -49,7 +45,7 @@ impl RegistryHolder {
///
/// You should do some type of error handling if this returns `None`.
pub fn dimension_type(&self) -> Option<RegistryType<DimensionTypeElement>> {
- let name = ResourceLocation::new("minecraft:dimension_type");
+ let name = Identifier::new("minecraft:dimension_type");
match self.get(&name) {
Some(Ok(registry)) => Some(registry),
Some(Err(err)) => {
@@ -65,7 +61,7 @@ impl RegistryHolder {
fn get<T: Deserialize>(
&self,
- name: &ResourceLocation,
+ name: &Identifier,
) -> Option<Result<RegistryType<T>, simdnbt::DeserializeError>> {
// this is suboptimal, ideally simdnbt should just have a way to get the
// owned::NbtCompound as a borrow::NbtCompound
@@ -95,14 +91,14 @@ impl RegistryHolder {
/// A collection of values for a certain type of registry data.
#[derive(Debug, Clone)]
pub struct RegistryType<T> {
- pub map: HashMap<ResourceLocation, T>,
+ pub map: HashMap<Identifier, T>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", simdnbt(deny_unknown_fields))]
pub struct TrimMaterialElement {
pub asset_name: String,
- pub ingredient: ResourceLocation,
+ pub ingredient: Identifier,
pub item_model_index: f32,
pub override_armor_materials: HashMap<String, String>,
pub description: Option<String>,
@@ -145,13 +141,13 @@ pub struct DimensionTypeElement {
pub ambient_light: f32,
pub bed_works: bool,
pub coordinate_scale: f32,
- pub effects: ResourceLocation,
+ pub effects: Identifier,
pub fixed_time: Option<u32>,
pub has_ceiling: bool,
pub has_raids: bool,
pub has_skylight: bool,
pub height: u32,
- pub infiniburn: ResourceLocation,
+ pub infiniburn: Identifier,
pub logical_height: u32,
pub min_y: i32,
pub monster_spawn_block_light_limit: u32,
@@ -185,7 +181,7 @@ pub enum MonsterSpawnLightLevel {
/// A complex value with a type, minimum, and maximum.
/// Vanilla minecraft only uses one type, "minecraft:uniform".
Complex {
- kind: ResourceLocation,
+ kind: Identifier,
value: MonsterSpawnLightLevelValues,
},
}
@@ -195,7 +191,7 @@ impl FromNbtTag for MonsterSpawnLightLevel {
if let Some(value) = tag.int() {
Some(Self::Simple(value as u32))
} else if let Some(value) = tag.compound() {
- let kind = ResourceLocation::from_nbt_tag(value.get("type")?)?;
+ let kind = Identifier::from_nbt_tag(value.get("type")?)?;
let value = MonsterSpawnLightLevelValues::from_nbt_tag(value.get("value")?)?;
Some(Self::Complex { kind, value })
} else {
@@ -285,7 +281,7 @@ pub struct BiomeEffects {
pub music: Option<BiomeMusic>,
pub mood_sound: BiomeMoodSound,
pub additions_sound: Option<AdditionsSound>,
- pub ambient_sound: Option<ResourceLocation>,
+ pub ambient_sound: Option<Identifier>,
pub particle: Option<BiomeParticle>,
}
diff --git a/azalea-core/src/sound.rs b/azalea-core/src/sound.rs
index 3f7b86c3..ebc18928 100644
--- a/azalea-core/src/sound.rs
+++ b/azalea-core/src/sound.rs
@@ -1,10 +1,10 @@
use azalea_buf::AzBuf;
use serde::Serialize;
-use crate::resource_location::ResourceLocation;
+use crate::identifier::Identifier;
#[derive(Clone, Debug, PartialEq, AzBuf, Serialize)]
pub struct CustomSound {
- pub location: ResourceLocation,
+ pub location: Identifier,
pub fixed_range: Option<f32>,
}
diff --git a/azalea-entity/src/attributes.rs b/azalea-entity/src/attributes.rs
index 75423746..ca02e639 100644
--- a/azalea-entity/src/attributes.rs
+++ b/azalea-entity/src/attributes.rs
@@ -3,7 +3,7 @@
use std::collections::{HashMap, hash_map};
use azalea_buf::AzBuf;
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use bevy_ecs::component::Component;
use thiserror::Error;
@@ -23,7 +23,7 @@ pub struct Attributes {
#[derive(Clone, Debug)]
pub struct AttributeInstance {
pub base: f64,
- modifiers_by_id: HashMap<ResourceLocation, AttributeModifier>,
+ modifiers_by_id: HashMap<Identifier, AttributeModifier>,
// TODO: add cache
}
@@ -73,14 +73,14 @@ impl AttributeInstance {
/// Remove the modifier with the given ID from this attribute, returning
/// the previous modifier is present.
- pub fn remove(&mut self, id: &ResourceLocation) -> Option<AttributeModifier> {
+ pub fn remove(&mut self, id: &Identifier) -> Option<AttributeModifier> {
self.modifiers_by_id.remove(id)
}
}
#[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct AttributeModifier {
- pub id: ResourceLocation,
+ pub id: Identifier,
pub amount: f64,
pub operation: AttributeModifierOperation,
}
@@ -94,21 +94,21 @@ pub enum AttributeModifierOperation {
pub fn sprinting_modifier() -> AttributeModifier {
AttributeModifier {
- id: ResourceLocation::new("sprinting"),
+ id: Identifier::new("sprinting"),
amount: 0.3f32 as f64,
operation: AttributeModifierOperation::AddMultipliedTotal,
}
}
pub fn base_attack_speed_modifier(amount: f64) -> AttributeModifier {
AttributeModifier {
- id: ResourceLocation::new("base_attack_speed"),
+ id: Identifier::new("base_attack_speed"),
amount,
operation: AttributeModifierOperation::AddValue,
}
}
pub fn creative_block_interaction_range_modifier() -> AttributeModifier {
AttributeModifier {
- id: ResourceLocation::new("creative_mode_block_range"),
+ id: Identifier::new("creative_mode_block_range"),
amount: 0.5,
operation: AttributeModifierOperation::AddValue,
}
@@ -116,7 +116,7 @@ pub fn creative_block_interaction_range_modifier() -> AttributeModifier {
pub fn creative_entity_interaction_range_modifier() -> AttributeModifier {
AttributeModifier {
- id: ResourceLocation::new("creative_mode_entity_range"),
+ id: Identifier::new("creative_mode_entity_range"),
amount: 2.0,
operation: AttributeModifierOperation::AddValue,
}
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs
index 1f9e426e..927b4637 100644
--- a/azalea-entity/src/lib.rs
+++ b/azalea-entity/src/lib.rs
@@ -22,9 +22,9 @@ use azalea_block::{BlockState, fluid_state::FluidKind};
use azalea_buf::AzBuf;
use azalea_core::{
aabb::Aabb,
+ identifier::Identifier,
math,
position::{BlockPos, ChunkPos, Vec3},
- resource_location::ResourceLocation,
};
use azalea_registry::EntityKind;
use azalea_world::{ChunkStorage, InstanceName};
@@ -496,7 +496,7 @@ impl EntityBundle {
uuid: Uuid,
pos: Vec3,
kind: azalea_registry::EntityKind,
- world_name: ResourceLocation,
+ world_name: Identifier,
) -> Self {
let dimensions = EntityDimensions::from(kind);
diff --git a/azalea-inventory/src/components/mod.rs b/azalea-inventory/src/components/mod.rs
index 7f3fa831..34d0a9b4 100644
--- a/azalea-inventory/src/components/mod.rs
+++ b/azalea-inventory/src/components/mod.rs
@@ -14,9 +14,9 @@ use azalea_core::{
checksum::{Checksum, get_checksum},
codec_utils::*,
filterable::Filterable,
+ identifier::Identifier,
position::GlobalPos,
registry_holder::RegistryHolder,
- resource_location::ResourceLocation,
sound::CustomSound,
};
use azalea_registry::{
@@ -372,7 +372,7 @@ pub struct BlockStatePropertyMatcher {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
pub struct BlockPredicate {
#[serde(skip_serializing_if = "is_default")]
- pub blocks: Option<HolderSet<Block, ResourceLocation>>,
+ pub blocks: Option<HolderSet<Block, Identifier>>,
#[serde(skip_serializing_if = "is_default")]
pub properties: Option<Vec<BlockStatePropertyMatcher>>,
#[serde(skip_serializing_if = "is_default")]
@@ -426,7 +426,7 @@ pub enum AttributeModifierOperation {
// circular dependency)
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
pub struct AttributeModifier {
- pub id: ResourceLocation,
+ pub id: Identifier,
pub amount: f64,
pub operation: AttributeModifierOperation,
}
@@ -558,7 +558,7 @@ impl Food {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
pub struct ToolRule {
- pub blocks: HolderSet<Block, ResourceLocation>,
+ pub blocks: HolderSet<Block, Identifier>,
#[serde(skip_serializing_if = "is_default")]
pub speed: Option<f32>,
#[serde(skip_serializing_if = "is_default")]
@@ -779,7 +779,7 @@ pub struct OminousBottleAmplifier {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(transparent)]
pub struct Recipes {
- pub recipes: Vec<ResourceLocation>,
+ pub recipes: Vec<Identifier>,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -839,7 +839,7 @@ impl Default for Fireworks {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(transparent)]
pub struct NoteBlockSound {
- pub sound: ResourceLocation,
+ pub sound: Identifier,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -930,7 +930,7 @@ pub struct ContainerLoot {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(untagged)]
pub enum JukeboxPlayable {
- Referenced(ResourceLocation),
+ Referenced(Identifier),
Direct(Holder<registry::JukeboxSong, JukeboxSongData>),
}
@@ -1006,7 +1006,7 @@ pub struct UseRemainder {
pub struct UseCooldown {
pub seconds: f32,
#[serde(skip_serializing_if = "is_default")]
- pub cooldown_group: Option<ResourceLocation>,
+ pub cooldown_group: Option<Identifier>,
}
impl UseCooldown {
@@ -1031,19 +1031,19 @@ pub struct Enchantable {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
pub struct Repairable {
- pub items: HolderSet<Item, ResourceLocation>,
+ pub items: HolderSet<Item, Identifier>,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(transparent)]
pub struct ItemModel {
- pub resource_location: ResourceLocation,
+ pub resource_location: Identifier,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
pub struct DamageResistant {
/// In vanilla this only allows tag keys, i.e. it must start with '#'
- pub types: ResourceLocation,
+ pub types: Identifier,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -1052,11 +1052,11 @@ pub struct Equippable {
#[serde(skip_serializing_if = "is_default_equip_sound")]
pub equip_sound: SoundEvent,
#[serde(skip_serializing_if = "is_default")]
- pub asset_id: Option<ResourceLocation>,
+ pub asset_id: Option<Identifier>,
#[serde(skip_serializing_if = "is_default")]
- pub camera_overlay: Option<ResourceLocation>,
+ pub camera_overlay: Option<Identifier>,
#[serde(skip_serializing_if = "is_default")]
- pub allowed_entities: Option<HolderSet<EntityKind, ResourceLocation>>,
+ pub allowed_entities: Option<HolderSet<EntityKind, Identifier>>,
#[serde(skip_serializing_if = "is_true")]
pub dispensable: bool,
#[serde(skip_serializing_if = "is_true")]
@@ -1119,7 +1119,7 @@ pub struct Glider;
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(transparent)]
pub struct TooltipStyle {
- pub resource_location: ResourceLocation,
+ pub resource_location: Identifier,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -1268,7 +1268,7 @@ pub struct PaintingVariantData {
pub width: i32,
#[var]
pub height: i32,
- pub asset_id: ResourceLocation,
+ pub asset_id: Identifier,
#[serde(skip_serializing_if = "is_default")]
pub title: Option<FormattedText>,
#[serde(skip_serializing_if = "is_default")]
@@ -1344,7 +1344,7 @@ pub struct BlocksAttacks {
#[serde(skip_serializing_if = "is_default")]
pub item_damage: ItemDamageFunction,
#[serde(skip_serializing_if = "is_default")]
- pub bypassed_by: Option<ResourceLocation>,
+ pub bypassed_by: Option<Identifier>,
#[serde(skip_serializing_if = "is_default")]
pub block_sound: Option<azalea_registry::Holder<SoundEvent, CustomSound>>,
#[serde(skip_serializing_if = "is_default")]
@@ -1383,7 +1383,7 @@ pub struct DamageReduction {
#[serde(skip_serializing_if = "is_default_horizontal_blocking_angle")]
pub horizontal_blocking_angle: f32,
#[serde(skip_serializing_if = "is_default")]
- pub kind: Option<HolderSet<DamageKind, ResourceLocation>>,
+ pub kind: Option<HolderSet<DamageKind, Identifier>>,
pub base: f32,
pub factor: f32,
}
@@ -1409,7 +1409,7 @@ impl Default for ItemDamageFunction {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(untagged)]
pub enum ProvidesTrimMaterial {
- Referenced(ResourceLocation),
+ Referenced(Identifier),
Direct(Holder<TrimMaterial, DirectTrimMaterial>),
}
@@ -1422,7 +1422,7 @@ pub struct DirectTrimMaterial {
pub struct MaterialAssetGroup {
pub base: AssetInfo,
#[serde(skip_serializing_if = "is_default")]
- pub overrides: Vec<(ResourceLocation, AssetInfo)>,
+ pub overrides: Vec<(Identifier, AssetInfo)>,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -1433,7 +1433,7 @@ pub struct AssetInfo {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(transparent)]
pub struct ProvidesBannerPatterns {
- pub key: ResourceLocation,
+ pub key: Identifier,
}
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
@@ -1457,7 +1457,7 @@ pub struct CowVariant {
#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)]
#[serde(untagged)]
pub enum ChickenVariant {
- Referenced(ResourceLocation),
+ Referenced(Identifier),
Direct(ChickenVariantData),
}
diff --git a/azalea-inventory/src/components/profile.rs b/azalea-inventory/src/components/profile.rs
index 499d42bb..153b43d3 100644
--- a/azalea-inventory/src/components/profile.rs
+++ b/azalea-inventory/src/components/profile.rs
@@ -2,7 +2,7 @@ use azalea_auth::game_profile::{
GameProfile, GameProfileProperties, SerializableProfileProperties,
};
use azalea_buf::AzBuf;
-use azalea_core::{codec_utils::*, resource_location::ResourceLocation};
+use azalea_core::{codec_utils::*, identifier::Identifier};
use serde::{Serialize, Serializer};
use uuid::Uuid;
@@ -70,5 +70,5 @@ pub enum PlayerModelType {
#[derive(Clone, Debug, AzBuf, PartialEq, Serialize)]
#[serde(transparent)]
pub struct ResourceTexture {
- pub id: ResourceLocation,
+ pub id: Identifier,
}
diff --git a/azalea-inventory/src/item/consume_effect.rs b/azalea-inventory/src/item/consume_effect.rs
index 8aab42b8..7054e6c8 100644
--- a/azalea-inventory/src/item/consume_effect.rs
+++ b/azalea-inventory/src/item/consume_effect.rs
@@ -1,5 +1,5 @@
use azalea_buf::AzBuf;
-use azalea_core::{codec_utils::is_default, resource_location::ResourceLocation};
+use azalea_core::{codec_utils::is_default, identifier::Identifier};
use azalea_registry::{HolderSet, MobEffect, SoundEvent};
use serde::Serialize;
@@ -16,7 +16,7 @@ pub enum ConsumeEffect {
},
RemoveEffects {
#[serde(skip_serializing_if = "is_default")]
- effects: HolderSet<MobEffect, ResourceLocation>,
+ effects: HolderSet<MobEffect, Identifier>,
},
ClearAllEffects,
TeleportRandomly {
diff --git a/azalea-physics/src/fluids.rs b/azalea-physics/src/fluids.rs
index c37a9917..01ffe75f 100644
--- a/azalea-physics/src/fluids.rs
+++ b/azalea-physics/src/fluids.rs
@@ -4,8 +4,8 @@ use azalea_block::{
};
use azalea_core::{
direction::Direction,
+ identifier::Identifier,
position::{BlockPos, Vec3},
- resource_location::ResourceLocation,
};
use azalea_entity::{HasClientLoaded, LocalEntity, Physics, Position};
use azalea_world::{Instance, InstanceContainer, InstanceName};
@@ -40,7 +40,7 @@ pub fn update_in_water_state_and_do_fluid_pushing(
let is_ultrawarm = world
.registries
.map
- .get(&ResourceLocation::new("minecraft:dimension_type"))
+ .get(&Identifier::new("minecraft:dimension_type"))
.and_then(|d| {
d.get(&**instance_name)
.map(|d| d.byte("ultrawarm") != Some(0))
diff --git a/azalea-physics/tests/physics.rs b/azalea-physics/tests/physics.rs
index b312b31e..09cb5379 100644
--- a/azalea-physics/tests/physics.rs
+++ b/azalea-physics/tests/physics.rs
@@ -5,9 +5,9 @@ use azalea_block::{
properties::WaterLevel,
};
use azalea_core::{
+ identifier::Identifier,
position::{BlockPos, ChunkPos, Vec3},
registry_holder::RegistryHolder,
- resource_location::ResourceLocation,
tick::GameTick,
};
use azalea_entity::{EntityBundle, EntityPlugin, HasClientLoaded, LocalEntity, Physics, Position};
@@ -29,7 +29,7 @@ pub fn insert_overworld(app: &mut App) -> Arc<RwLock<Instance>> {
app.world_mut()
.resource_mut::<InstanceContainer>()
.get_or_insert(
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
384,
-64,
&RegistryHolder::default(),
@@ -59,7 +59,7 @@ fn test_gravity() {
z: 0.,
},
azalea_registry::EntityKind::Zombie,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -115,7 +115,7 @@ fn test_collision() {
z: 0.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -172,7 +172,7 @@ fn test_slab_collision() {
z: 0.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -223,7 +223,7 @@ fn test_top_slab_collision() {
z: 0.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -258,7 +258,7 @@ fn test_weird_wall_collision() {
.world_mut()
.resource_mut::<InstanceContainer>()
.get_or_insert(
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
384,
-64,
&RegistryHolder::default(),
@@ -281,7 +281,7 @@ fn test_weird_wall_collision() {
z: 0.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -321,7 +321,7 @@ fn test_negative_coordinates_weird_wall_collision() {
.world_mut()
.resource_mut::<InstanceContainer>()
.get_or_insert(
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
384,
-64,
&RegistryHolder::default(),
@@ -344,7 +344,7 @@ fn test_negative_coordinates_weird_wall_collision() {
z: -7.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -388,7 +388,7 @@ fn spawn_and_unload_world() {
.world_mut()
.resource_mut::<InstanceContainer>()
.get_or_insert(
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
384,
-64,
&RegistryHolder::default(),
@@ -411,7 +411,7 @@ fn spawn_and_unload_world() {
z: -7.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
@@ -527,7 +527,7 @@ fn test_afk_pool() {
z: 1.5,
},
azalea_registry::EntityKind::Player,
- ResourceLocation::new("minecraft:overworld"),
+ Identifier::new("minecraft:overworld"),
),
MinecraftEntityId(0),
LocalEntity,
diff --git a/azalea-protocol/src/common/recipe.rs b/azalea-protocol/src/common/recipe.rs
index 8ab2d5ba..709679f1 100644
--- a/azalea-protocol/src/common/recipe.rs
+++ b/azalea-protocol/src/common/recipe.rs
@@ -1,5 +1,5 @@
use azalea_buf::AzBuf;
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_inventory::ItemStack;
use azalea_registry::HolderSet;
@@ -56,7 +56,7 @@ pub struct SmithingRecipeDisplay {
#[derive(Clone, Debug, PartialEq, AzBuf)]
pub struct Ingredient {
- pub allowed: HolderSet<azalea_registry::Item, ResourceLocation>,
+ pub allowed: HolderSet<azalea_registry::Item, Identifier>,
}
/// [`azalea_registry::SlotDisplay`]
@@ -66,7 +66,7 @@ pub enum SlotDisplayData {
AnyFuel,
Item(ItemStackDisplay),
ItemStack(ItemStackSlotDisplay),
- Tag(ResourceLocation),
+ Tag(Identifier),
SmithingTrim(Box<SmithingTrimDemoSlotDisplay>),
WithRemainder(Box<WithRemainderSlotDisplay>),
Composite(CompositeSlotDisplay),
diff --git a/azalea-protocol/src/common/tags.rs b/azalea-protocol/src/common/tags.rs
index 0b798519..f8ddfc81 100644
--- a/azalea-protocol/src/common/tags.rs
+++ b/azalea-protocol/src/common/tags.rs
@@ -4,15 +4,15 @@ use std::{
};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use indexmap::IndexMap;
#[derive(Clone, Debug, PartialEq)]
-pub struct TagMap(pub IndexMap<ResourceLocation, Vec<Tags>>);
+pub struct TagMap(pub IndexMap<Identifier, Vec<Tags>>);
#[derive(Clone, Debug, PartialEq)]
pub struct Tags {
- pub name: ResourceLocation,
+ pub name: Identifier,
pub elements: Vec<i32>,
}
@@ -21,7 +21,7 @@ impl AzaleaRead for TagMap {
let length = u32::azalea_read_var(buf)? as usize;
let mut data = IndexMap::with_capacity(length);
for _ in 0..length {
- let tag_type = ResourceLocation::azalea_read(buf)?;
+ let tag_type = Identifier::azalea_read(buf)?;
let tags_count = i32::azalea_read_var(buf)? as usize;
let mut tags_vec = Vec::with_capacity(tags_count);
for _ in 0..tags_count {
@@ -46,7 +46,7 @@ impl AzaleaWrite for TagMap {
}
impl AzaleaRead for Tags {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
- let name = ResourceLocation::azalea_read(buf)?;
+ let name = Identifier::azalea_read(buf)?;
let elements = Vec::<i32>::azalea_read_var(buf)?;
Ok(Tags { name, elements })
}
@@ -61,7 +61,7 @@ impl AzaleaWrite for Tags {
}
impl Deref for TagMap {
- type Target = IndexMap<ResourceLocation, Vec<Tags>>;
+ type Target = IndexMap<Identifier, Vec<Tags>>;
fn deref(&self) -> &Self::Target {
&self.0
diff --git a/azalea-protocol/src/packets/common.rs b/azalea-protocol/src/packets/common.rs
index ad87fa8d..fcbf0b05 100644
--- a/azalea-protocol/src/packets/common.rs
+++ b/azalea-protocol/src/packets/common.rs
@@ -2,16 +2,16 @@ use azalea_buf::AzBuf;
use azalea_core::{
data_registry::ResolvableDataRegistry,
game_type::{GameMode, OptionalGameType},
+ identifier::Identifier,
position::GlobalPos,
registry_holder::{DimensionTypeElement, RegistryHolder},
- resource_location::ResourceLocation,
};
use tracing::error;
#[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct CommonPlayerSpawnInfo {
pub dimension_type: azalea_registry::DimensionType,
- pub dimension: ResourceLocation,
+ pub dimension: Identifier,
pub seed: i64,
pub game_type: GameMode,
pub previous_game_type: OptionalGameType,
@@ -27,7 +27,7 @@ impl CommonPlayerSpawnInfo {
pub fn dimension_type(
&self,
registry_holder: &RegistryHolder,
- ) -> Option<(ResourceLocation, DimensionTypeElement)> {
+ ) -> Option<(Identifier, DimensionTypeElement)> {
let dimension_res = self
.dimension_type
.resolve_and_deserialize::<DimensionTypeElement>(registry_holder);
diff --git a/azalea-protocol/src/packets/config/c_cookie_request.rs b/azalea-protocol/src/packets/config/c_cookie_request.rs
index c1a42cac..ff368b63 100644
--- a/azalea-protocol/src/packets/config/c_cookie_request.rs
+++ b/azalea-protocol/src/packets/config/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::ClientboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)]
pub struct ClientboundCookieRequest {
- pub key: ResourceLocation,
+ pub key: Identifier,
}
diff --git a/azalea-protocol/src/packets/config/c_custom_payload.rs b/azalea-protocol/src/packets/config/c_custom_payload.rs
index 19335264..03776bf9 100644
--- a/azalea-protocol/src/packets/config/c_custom_payload.rs
+++ b/azalea-protocol/src/packets/config/c_custom_payload.rs
@@ -1,9 +1,9 @@
use azalea_buf::{AzBuf, UnsizedByteArray};
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)]
pub struct ClientboundCustomPayload {
- pub identifier: ResourceLocation,
+ pub identifier: Identifier,
pub data: UnsizedByteArray,
}
diff --git a/azalea-protocol/src/packets/config/c_registry_data.rs b/azalea-protocol/src/packets/config/c_registry_data.rs
index 18d2e73b..16a86a9f 100644
--- a/azalea-protocol/src/packets/config/c_registry_data.rs
+++ b/azalea-protocol/src/packets/config/c_registry_data.rs
@@ -1,10 +1,10 @@
use azalea_buf::AzBuf;
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol_macros::ClientboundConfigPacket;
use simdnbt::owned::NbtCompound;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)]
pub struct ClientboundRegistryData {
- pub registry_id: ResourceLocation,
- pub entries: Vec<(ResourceLocation, Option<NbtCompound>)>,
+ pub registry_id: Identifier,
+ pub entries: Vec<(Identifier, Option<NbtCompound>)>,
}
diff --git a/azalea-protocol/src/packets/config/c_store_cookie.rs b/azalea-protocol/src/packets/config/c_store_cookie.rs
index 5fa03729..3d797d18 100644
--- a/azalea-protocol/src/packets/config/c_store_cookie.rs
+++ b/azalea-protocol/src/packets/config/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::ClientboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)]
pub struct ClientboundStoreCookie {
- pub key: ResourceLocation,
+ pub key: Identifier,
pub payload: Vec<u8>,
}
diff --git a/azalea-protocol/src/packets/config/c_update_enabled_features.rs b/azalea-protocol/src/packets/config/c_update_enabled_features.rs
index 7d86ceb4..b4e0e9c1 100644
--- a/azalea-protocol/src/packets/config/c_update_enabled_features.rs
+++ b/azalea-protocol/src/packets/config/c_update_enabled_features.rs
@@ -1,8 +1,8 @@
use azalea_buf::AzBuf;
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol_macros::ClientboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)]
pub struct ClientboundUpdateEnabledFeatures {
- pub features: Vec<ResourceLocation>,
+ pub features: Vec<Identifier>,
}
diff --git a/azalea-protocol/src/packets/config/s_cookie_response.rs b/azalea-protocol/src/packets/config/s_cookie_response.rs
index 590a651e..ae44953e 100644
--- a/azalea-protocol/src/packets/config/s_cookie_response.rs
+++ b/azalea-protocol/src/packets/config/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::ServerboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundConfigPacket)]
pub struct ServerboundCookieResponse {
- pub key: ResourceLocation,
+ pub key: Identifier,
pub payload: Option<Vec<u8>>,
}
diff --git a/azalea-protocol/src/packets/config/s_custom_click_action.rs b/azalea-protocol/src/packets/config/s_custom_click_action.rs
index 0c33d635..21b5cfbb 100644
--- a/azalea-protocol/src/packets/config/s_custom_click_action.rs
+++ b/azalea-protocol/src/packets/config/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::ServerboundConfigPacket;
use simdnbt::owned::Nbt;
#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundConfigPacket)]
pub struct ServerboundCustomClickAction {
- pub id: ResourceLocation,
+ pub id: Identifier,
pub payload: Nbt,
}
diff --git a/azalea-protocol/src/packets/config/s_custom_payload.rs b/azalea-protocol/src/packets/config/s_custom_payload.rs
index fec04fb5..1bdc85af 100644
--- a/azalea-protocol/src/packets/config/s_custom_payload.rs
+++ b/azalea-protocol/src/packets/config/s_custom_payload.rs
@@ -1,9 +1,9 @@
use azalea_buf::{AzBuf, UnsizedByteArray};
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol_macros::ServerboundConfigPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundConfigPacket)]
pub struct ServerboundCustomPayload {
- pub identifier: ResourceLocation,
+ pub identifier: Identifier,
pub data: UnsizedByteArray,
}
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]
diff --git a/azalea-protocol/src/packets/login/c_cookie_request.rs b/azalea-protocol/src/packets/login/c_cookie_request.rs
index 2574d718..fbe72c6a 100644
--- a/azalea-protocol/src/packets/login/c_cookie_request.rs
+++ b/azalea-protocol/src/packets/login/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::ClientboundLoginPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundLoginPacket)]
pub struct ClientboundCookieRequest {
- pub key: ResourceLocation,
+ pub key: Identifier,
}
diff --git a/azalea-protocol/src/packets/login/c_custom_query.rs b/azalea-protocol/src/packets/login/c_custom_query.rs
index c74d6e21..9c7ee50a 100644
--- a/azalea-protocol/src/packets/login/c_custom_query.rs
+++ b/azalea-protocol/src/packets/login/c_custom_query.rs
@@ -1,13 +1,13 @@
use std::hash::Hash;
use azalea_buf::{AzBuf, UnsizedByteArray};
-use azalea_core::resource_location::ResourceLocation;
+use azalea_core::identifier::Identifier;
use azalea_protocol_macros::ClientboundLoginPacket;
#[derive(Hash, Clone, Debug, AzBuf, PartialEq, ClientboundLoginPacket)]
pub struct ClientboundCustomQuery {
#[var]
pub transaction_id: u32,
- pub identifier: ResourceLocation,
+ pub identifier: Identifier,
pub data: UnsizedByteArray,
}
diff --git a/azalea-protocol/src/packets/login/s_cookie_response.rs b/azalea-protocol/src/packets/login/s_cookie_response.rs
index 8a7af784..c9e7ced9 100644
--- a/azalea-protocol/src/packets/login/s_cookie_response.rs
+++ b/azalea-protocol/src/packets/login/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::ServerboundLoginPacket;
#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundLoginPacket)]
pub struct ServerboundCookieResponse {
- pub key: ResourceLocation,
+ pub key: Identifier,
pub payload: Option<Vec<u8>>,
}
diff --git a/azalea-registry/src/lib.rs b/azalea-registry/src/lib.rs
index 88b154a2..a3145b15 100644
--- a/azalea-registry/src/lib.rs
+++ b/azalea-registry/src/lib.rs
@@ -88,22 +88,20 @@ impl<D: Registry, C: AzaleaRead + AzaleaWrite> AzaleaWrite for CustomRegistry<D,
}
#[derive(Clone, PartialEq)]
-pub enum HolderSet<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> {
+pub enum HolderSet<D: Registry, Identifier: AzaleaRead + AzaleaWrite> {
Direct {
contents: Vec<D>,
},
Named {
- key: ResourceLocation,
- contents: Vec<ResourceLocation>,
+ key: Identifier,
+ contents: Vec<Identifier>,
},
}
-impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> AzaleaRead
- for HolderSet<D, ResourceLocation>
-{
+impl<D: Registry, Identifier: AzaleaRead + AzaleaWrite> AzaleaRead for HolderSet<D, Identifier> {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let size = i32::azalea_read_var(buf)? - 1;
if size == -1 {
- let key = ResourceLocation::azalea_read(buf)?;
+ let key = Identifier::azalea_read(buf)?;
Ok(Self::Named {
key,
contents: Vec::new(),
@@ -117,9 +115,7 @@ impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> AzaleaRead
}
}
}
-impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> AzaleaWrite
- for HolderSet<D, ResourceLocation>
-{
+impl<D: Registry, Identifier: AzaleaRead + AzaleaWrite> AzaleaWrite for HolderSet<D, Identifier> {
fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> {
match self {
Self::Direct { contents } => {
@@ -136,8 +132,8 @@ impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> AzaleaWrite
Ok(())
}
}
-impl<D: Registry + Debug, ResourceLocation: AzaleaRead + AzaleaWrite + Debug> Debug
- for HolderSet<D, ResourceLocation>
+impl<D: Registry + Debug, Identifier: AzaleaRead + AzaleaWrite + Debug> Debug
+ for HolderSet<D, Identifier>
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
@@ -150,16 +146,14 @@ impl<D: Registry + Debug, ResourceLocation: AzaleaRead + AzaleaWrite + Debug> De
}
}
}
-impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> From<Vec<D>>
- for HolderSet<D, ResourceLocation>
-{
+impl<D: Registry, Identifier: AzaleaRead + AzaleaWrite> From<Vec<D>> for HolderSet<D, Identifier> {
fn from(contents: Vec<D>) -> Self {
Self::Direct { contents }
}
}
#[cfg(feature = "serde")]
-impl<D: Registry + Serialize, ResourceLocation: AzaleaRead + AzaleaWrite + Serialize> Serialize
- for HolderSet<D, ResourceLocation>
+impl<D: Registry + Serialize, Identifier: AzaleaRead + AzaleaWrite + Serialize> Serialize
+ for HolderSet<D, Identifier>
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -177,9 +171,7 @@ impl<D: Registry + Serialize, ResourceLocation: AzaleaRead + AzaleaWrite + Seria
}
}
}
-impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> Default
- for HolderSet<D, ResourceLocation>
-{
+impl<D: Registry, Identifier: AzaleaRead + AzaleaWrite> Default for HolderSet<D, Identifier> {
fn default() -> Self {
Self::Direct {
contents: Vec::new(),
@@ -188,7 +180,7 @@ impl<D: Registry, ResourceLocation: AzaleaRead + AzaleaWrite> Default
}
/// A reference to either a registry or a custom value (usually something with a
-/// ResourceLocation).
+/// Identifier).
pub enum Holder<R: Registry, Direct: AzaleaRead + AzaleaWrite> {
Reference(R),
Direct(Direct),
@@ -1646,7 +1638,7 @@ enum CommandArgumentKind {
Team => "minecraft:team",
ItemSlot => "minecraft:item_slot",
ItemSlots => "minecraft:item_slots",
- ResourceLocation => "minecraft:resource_location",
+ Identifier => "minecraft:resource_location",
Function => "minecraft:function",
EntityAnchor => "minecraft:entity_anchor",
IntRange => "minecraft:int_range",
diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs
index 279f3061..ff79ec81 100644
--- a/azalea-world/src/container.rs
+++ b/azalea-world/src/container.rs
@@ -3,7 +3,7 @@ use std::{
sync::{Arc, Weak},
};
-use azalea_core::{registry_holder::RegistryHolder, resource_location::ResourceLocation};
+use azalea_core::{identifier::Identifier, registry_holder::RegistryHolder};
use bevy_ecs::{component::Component, resource::Resource};
use derive_more::{Deref, DerefMut};
use nohash_hasher::IntMap;
@@ -31,7 +31,7 @@ pub struct InstanceContainer {
// telling them apart. We hope most servers are nice and don't do that though. It's only an
// issue when there's multiple clients with the same WorldContainer in different worlds
// anyways.
- pub instances: FxHashMap<ResourceLocation, Weak<RwLock<Instance>>>,
+ pub instances: FxHashMap<Identifier, Weak<RwLock<Instance>>>,
}
impl InstanceContainer {
@@ -50,7 +50,7 @@ impl InstanceContainer {
#[must_use = "the world will be immediately forgotten if unused"]
pub fn get_or_insert(
&mut self,
- name: ResourceLocation,
+ name: Identifier,
height: u32,
min_y: i32,
default_registries: &RegistryHolder,
@@ -93,4 +93,4 @@ impl InstanceContainer {
/// same instance.
#[derive(Component, Clone, Debug, PartialEq, Deref, DerefMut)]
#[doc(alias("worldname", "world name"))]
-pub struct InstanceName(pub ResourceLocation);
+pub struct InstanceName(pub Identifier);
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs
index 069837b3..f4f0844d 100644
--- a/azalea/src/lib.rs
+++ b/azalea/src/lib.rs
@@ -21,10 +21,13 @@ pub use azalea_buf as buf;
pub use azalea_chat::FormattedText;
pub use azalea_client::*;
pub use azalea_core as core;
+#[deprecated(note = "renamed to `Identifier`.")]
+#[expect(deprecated)]
+pub use azalea_core::resource_location::ResourceLocation;
// these are re-exported on this level because they're very common
pub use azalea_core::{
+ identifier::Identifier,
position::{BlockPos, Vec3},
- resource_location::ResourceLocation,
};
pub use azalea_entity as entity;
pub use azalea_physics as physics;
diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs
index 94836d3b..3b8a46cc 100644
--- a/azalea/src/pathfinder/simulation.rs
+++ b/azalea/src/pathfinder/simulation.rs
@@ -6,9 +6,7 @@ use azalea_client::{
PhysicsState, interact::BlockStatePredictionHandler, inventory::Inventory,
local_player::LocalGameMode, mining::MineBundle,
};
-use azalea_core::{
- game_type::GameMode, position::Vec3, resource_location::ResourceLocation, tick::GameTick,
-};
+use azalea_core::{game_type::GameMode, identifier::Identifier, position::Vec3, tick::GameTick};
use azalea_entity::{
Attributes, LookDirection, Physics, Position, default_attributes, dimensions::EntityDimensions,
};
@@ -44,8 +42,8 @@ impl SimulatedPlayerBundle {
}
}
-fn simulation_instance_name() -> ResourceLocation {
- ResourceLocation::new("azalea:simulation")
+fn simulation_instance_name() -> Identifier {
+ Identifier::new("azalea:simulation")
}
fn create_simulation_instance(chunks: ChunkStorage) -> (App, Arc<RwLock<Instance>>) {
diff --git a/codegen/lib/code/data_components.py b/codegen/lib/code/data_components.py
index 89796a91..57e30172 100644
--- a/codegen/lib/code/data_components.py
+++ b/codegen/lib/code/data_components.py
@@ -220,7 +220,7 @@ use crate::{
"probability": "f32",
}
enum_and_struct_fields["ConsumeEffect::RemoveEffects"] = {
- "effects": "HolderSet<MobEffect, ResourceLocation>",
+ "effects": "HolderSet<MobEffect, Identifier>",
}
enum_and_struct_fields["ConsumeEffect::ClearAllEffects"] = {}
enum_and_struct_fields["ConsumeEffect::TeleportRandomly"] = {
@@ -342,7 +342,7 @@ use crate::{
return t
if isinstance(python_value, dict):
- if target_rust_type == "ResourceLocation" and len(python_value) == 1:
+ if target_rust_type == "Identifier" and len(python_value) == 1:
return python_to_rust_value(
list(python_value.values())[0], target_rust_type
)
@@ -401,8 +401,8 @@ use crate::{
return str(python_value).lower()
if isinstance(python_value, str):
fields_for_rust_type = enum_and_struct_fields.get(target_rust_type, [])
- if "Referenced(ResourceLocation)" in fields_for_rust_type:
- return f"{target_rust_type}::Referenced({python_to_rust_value(python_value, 'ResourceLocation')})"
+ if "Referenced(Identifier)" in fields_for_rust_type:
+ return f"{target_rust_type}::Referenced({python_to_rust_value(python_value, 'Identifier')})"
elif "Registry(registry::Instrument)" in fields_for_rust_type:
return f"{target_rust_type}::Registry({python_to_rust_value(python_value, 'azalea_registry::Instrument')})"
elif target_rust_type.startswith("HolderSet<"):
@@ -415,8 +415,8 @@ use crate::{
holder_type = target_rust_type.split("<", 1)[1].split(",", 1)[0]
inner_type = python_to_rust_value(python_value, holder_type)
return f"azalea_registry::Holder::Reference({inner_type})"
- elif target_rust_type == "ResourceLocation":
- # convert minecraft:air into ResourceLocation::from_static("minecraft:air")
+ elif target_rust_type == "Identifier":
+ # convert minecraft:air into Identifier::from_static("minecraft:air")
return f'"{python_value}".into()'
else:
# enum variant
diff --git a/codegen/lib/code/utils.py b/codegen/lib/code/utils.py
index b8970628..bbb8f647 100644
--- a/codegen/lib/code/utils.py
+++ b/codegen/lib/code/utils.py
@@ -57,8 +57,8 @@ def burger_type_to_rust_type(
field_type_rs = "FormattedText"
uses.add("azalea_chat::FormattedText")
elif burger_type == "identifier":
- field_type_rs = "ResourceLocation"
- uses.add("azalea_core::resource_location::ResourceLocation")
+ field_type_rs = "Identifier"
+ uses.add("azalea_core::resource_location::Identifier")
elif burger_type == "uuid":
field_type_rs = "Uuid"
uses.add("uuid::Uuid")
diff --git a/codegen/lib/extract.py b/codegen/lib/extract.py
index 357059f6..b575b697 100644
--- a/codegen/lib/extract.py
+++ b/codegen/lib/extract.py
@@ -254,16 +254,16 @@ def get_packet_list(version_id: str):
packet_list = []
for state, state_value in packets_report.items():
for direction, direction_value in state_value.items():
- for packet_resourcelocation, packet_value in direction_value.items():
- assert packet_resourcelocation.startswith("minecraft:")
- packet_resourcelocation = upper_first_letter(
- to_camel_case(packet_resourcelocation[len("minecraft:") :])
+ for packet_identifier, packet_value in direction_value.items():
+ assert packet_identifier.startswith("minecraft:")
+ packet_identifier = upper_first_letter(
+ to_camel_case(packet_identifier[len("minecraft:") :])
)
packet_list.append(
{
"state": state,
"direction": direction,
- "name": packet_resourcelocation,
+ "name": packet_identifier,
"id": packet_value["protocol_id"],
}
)