mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
make registries public
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user