diff options
| author | mat <git@matdoes.dev> | 2023-11-18 20:44:49 -0600 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-11-18 20:44:49 -0600 |
| commit | f0b58c7e748e1e94ad0dd08124cfc186e865709c (patch) | |
| tree | e57770be77d78262f89cc146179122a0b849c6c2 /azalea-client/src/received_registries.rs | |
| parent | 000abfa13665abccf543b875d10c8c2a48dd75be (diff) | |
| download | azalea-drasl-f0b58c7e748e1e94ad0dd08124cfc186e865709c.tar.xz | |
share registries in swarms and fix some bugs
Diffstat (limited to 'azalea-client/src/received_registries.rs')
| -rw-r--r-- | azalea-client/src/received_registries.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/azalea-client/src/received_registries.rs b/azalea-client/src/received_registries.rs deleted file mode 100644 index f959a590..00000000 --- a/azalea-client/src/received_registries.rs +++ /dev/null @@ -1,28 +0,0 @@ -use std::collections::HashMap; - -use azalea_core::resource_location::ResourceLocation; -use azalea_nbt::Nbt; -use azalea_protocol::packets::configuration::clientbound_registry_data_packet::registry::{ - DimensionTypeElement, RegistryType, -}; -use bevy_ecs::prelude::*; -use serde::de::DeserializeOwned; - -/// The registries that were sent to us during the configuration state. -#[derive(Default, Component, Clone)] -pub struct ReceivedRegistries { - pub registries: HashMap<ResourceLocation, Nbt>, -} - -impl ReceivedRegistries { - fn get<T: DeserializeOwned>(&self, name: &ResourceLocation) -> Option<T> { - let nbt = self.registries.get(name)?; - serde_json::from_value(serde_json::to_value(nbt).ok()?).ok() - } - - /// Get the dimension type registry, or `None` if it doesn't exist. You - /// should do some type of error handling if this returns `None`. - pub fn dimension_type(&self) -> Option<RegistryType<DimensionTypeElement>> { - self.get(&ResourceLocation::new("minecraft:dimension_type")) - } -} |
