make registries public

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

No files matched your search

+4 -4
View File
@@ -7,28 +7,28 @@ use crate::world::WorldError;
const BLOCKS_JSON: &str = include_str!("../../assets/blocks.json"); const BLOCKS_JSON: &str = include_str!("../../assets/blocks.json");
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlockDefinition { pub struct BlockDefinition {
#[serde(rename = "type")] #[serde(rename = "type")]
kind: String, kind: String,
block_set_type: Option<String>, block_set_type: Option<String>,
} }
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlockState { pub struct BlockState {
default: Option<bool>, default: Option<bool>,
id: i64, id: i64,
properties: Option<HashMap<String, String>>, properties: Option<HashMap<String, String>>,
} }
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlocksElement { pub struct BlocksElement {
definition: BlockDefinition, definition: BlockDefinition,
properties: Option<HashMap<String, Vec<String>>>, properties: Option<HashMap<String, Vec<String>>>,
states: Vec<BlockState>, states: Vec<BlockState>,
} }
lazy_static! { 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."); serde_json::from_str(BLOCKS_JSON).expect("Could not parse block.json registry.");
} }
+1 -1
View File
@@ -3,7 +3,7 @@ use num_derive::FromPrimitive;
use crate::vector3::Vector3; use crate::vector3::Vector3;
pub mod block_registry; pub mod block_registry;
pub use block_registry::BLOCKS;
#[derive(FromPrimitive)] #[derive(FromPrimitive)]
pub enum BlockFace { pub enum BlockFace {
Bottom = 0, Bottom = 0,
+2 -2
View File
@@ -23,12 +23,12 @@ pub struct ItemComponents {
} }
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct ItemElement { pub struct ItemElement {
components: ItemComponents, components: ItemComponents,
} }
lazy_static! { 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."); serde_json::from_str(ITEMS_JSON).expect("Could not parse items.json registry.");
} }
+1 -1
View File
@@ -1,6 +1,6 @@
mod item_registry; mod item_registry;
mod item_categories; mod item_categories;
pub use item_registry::ITEMS;
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
/// Item Rarity /// Item Rarity