diff options
| author | Shayne Hartford <shaybox@shaybox.com> | 2025-02-17 18:28:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 17:28:37 -0600 |
| commit | c285fadd34df2a43a5cfe1d3c02a3cc47bf69e9e (patch) | |
| tree | 8e68e7869a23be9dcbfad43a8de957b35d3723f1 /azalea-world | |
| parent | 022771b71bdbfa29253342af36a63f0fe00ea962 (diff) | |
| download | azalea-drasl-c285fadd34df2a43a5cfe1d3c02a3cc47bf69e9e.tar.xz | |
Enable serde feature in sub-crates (#202)
Add serde derive to MinecraftEntityId
Diffstat (limited to 'azalea-world')
| -rw-r--r-- | azalea-world/Cargo.toml | 8 | ||||
| -rw-r--r-- | azalea-world/src/world.rs | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index 2ce3d097..5354259e 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -13,19 +13,21 @@ criterion = "0.5.1" [dependencies] azalea-block = { path = "../azalea-block", default-features = false, version = "0.11.0" } azalea-buf = { path = "../azalea-buf", version = "0.11.0" } -azalea-core = { path = "../azalea-core", version = "0.11.0", features = [ - "bevy_ecs", -] } +azalea-core = { path = "../azalea-core", version = "0.11.0", features = ["bevy_ecs"] } azalea-registry = { path = "../azalea-registry", version = "0.11.0" } bevy_ecs.workspace = true derive_more = { workspace = true, features = ["deref", "deref_mut"] } nohash-hasher.workspace = true parking_lot.workspace = true rustc-hash.workspace = true +serde = { workspace = true, optional = true } simdnbt.workspace = true thiserror.workspace = true tracing.workspace = true +[features] +serde = ["dep:serde"] + [[bench]] name = "chunks" harness = false diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index ffd60026..ae257696 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -14,6 +14,8 @@ use azalea_core::registry_holder::RegistryHolder; use bevy_ecs::{component::Component, entity::Entity}; use derive_more::{Deref, DerefMut}; use nohash_hasher::IntMap; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; use crate::{ChunkStorage, PartialChunkStorage}; @@ -57,7 +59,8 @@ impl PartialInstance { /// `#[var]` attribute. /// /// [`Entity`]: bevy_ecs::entity::Entity -#[derive(Component, Copy, Clone, Debug, PartialEq, Eq, Deref, DerefMut)] +#[derive(Component, Copy, Clone, Debug, Default, PartialEq, Eq, Deref, DerefMut)] +#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct MinecraftEntityId(pub i32); impl Hash for MinecraftEntityId { |
