make registries public

This commit is contained in:
Edvin Bryntesson
2024-08-20 12:31:46 +02:00
parent f4ab2ce585
commit 1b1300e194
4 changed files with 8 additions and 8 deletions

View File

@@ -7,28 +7,28 @@ use crate::world::WorldError;
const BLOCKS_JSON: &str = include_str!("../../assets/blocks.json");
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlockDefinition {
pub struct BlockDefinition {
#[serde(rename = "type")]
kind: String,
block_set_type: Option<String>,
}
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlockState {
pub struct BlockState {
default: Option<bool>,
id: i64,
properties: Option<HashMap<String, String>>,
}
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlocksElement {
pub struct BlocksElement {
definition: BlockDefinition,
properties: Option<HashMap<String, Vec<String>>>,
states: Vec<BlockState>,
}
lazy_static! {
static ref BLOCKS: HashMap<String, BlocksElement> =
pub static ref BLOCKS: HashMap<String, BlocksElement> =
serde_json::from_str(BLOCKS_JSON).expect("Could not parse block.json registry.");
}

View File

@@ -3,7 +3,7 @@ use num_derive::FromPrimitive;
use crate::vector3::Vector3;
pub mod block_registry;
pub use block_registry::BLOCKS;
#[derive(FromPrimitive)]
pub enum BlockFace {
Bottom = 0,

View File

@@ -23,12 +23,12 @@ pub struct ItemComponents {
}
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct ItemElement {
pub struct ItemElement {
components: ItemComponents,
}
lazy_static! {
static ref ITEMS: HashMap<String, ItemElement> =
pub static ref ITEMS: HashMap<String, ItemElement> =
serde_json::from_str(ITEMS_JSON).expect("Could not parse items.json registry.");
}

View File

@@ -1,6 +1,6 @@
mod item_registry;
mod item_categories;
pub use item_registry::ITEMS;
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
/// Item Rarity