diff --git a/pumpkin-world/src/block/block_registry.rs b/pumpkin-world/src/block/block_registry.rs index fa2b790b6..1a36df8d5 100644 --- a/pumpkin-world/src/block/block_registry.rs +++ b/pumpkin-world/src/block/block_registry.rs @@ -1,26 +1,27 @@ use std::collections::HashMap; use lazy_static::lazy_static; +use serde::Deserialize; use crate::level::WorldError; const BLOCKS_JSON: &str = include_str!("../../assets/blocks.json"); -#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[derive(Deserialize, Debug, Clone, PartialEq, Eq)] pub struct BlockDefinition { #[serde(rename = "type")] kind: String, block_set_type: Option, } -#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[derive(Deserialize, Debug, Clone, PartialEq, Eq)] pub struct BlockState { default: Option, id: i64, properties: Option>, } -#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[derive(Deserialize, Debug, Clone, PartialEq, Eq)] pub struct BlocksElement { definition: BlockDefinition, properties: Option>>, diff --git a/pumpkin-world/src/chunk.rs b/pumpkin-world/src/chunk.rs index 6aae014d0..c8c0a2adc 100644 --- a/pumpkin-world/src/chunk.rs +++ b/pumpkin-world/src/chunk.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use fastnbt::LongArray; +use serde::{Deserialize, Serialize}; use crate::{ coordinates::{ChunkCoordinates, ChunkRelativeBlockCoordinates}, @@ -14,27 +15,27 @@ pub struct ChunkData { pub heightmaps: ChunkHeightmaps, } -#[derive(serde::Deserialize, Debug, Clone)] +#[derive(Deserialize, Debug, Clone)] #[serde(rename_all = "PascalCase")] struct PaletteEntry { name: String, properties: Option>, } -#[derive(serde::Deserialize, Debug, Clone)] +#[derive(Deserialize, Debug, Clone)] struct ChunkSectionBlockStates { data: Option, palette: Vec, } -#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Debug, Clone)] #[serde(rename_all = "UPPERCASE")] pub struct ChunkHeightmaps { motion_blocking: LongArray, world_surface: LongArray, } -#[derive(serde::Deserialize, Debug)] +#[derive(Deserialize, Debug)] #[allow(dead_code)] struct ChunkSection { #[serde(rename = "Y")] @@ -42,7 +43,7 @@ struct ChunkSection { block_states: Option, } -#[derive(serde::Deserialize, Debug)] +#[derive(Deserialize, Debug)] #[allow(dead_code)] struct ChunkNbt { #[serde(rename = "DataVersion")]