Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anvil Saving #168

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
10 changes: 9 additions & 1 deletion pumpkin-world/src/block/block_registry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::LazyLock;
use std::{collections::HashMap, sync::LazyLock};

use serde::Deserialize;

Expand All @@ -9,6 +9,14 @@ pub static BLOCKS: LazyLock<TopLevel> = LazyLock::new(|| {
.expect("Could not parse blocks.json registry.")
});

pub static BLOCK_IDS_TO_BLOCK_STRING: LazyLock<HashMap<u16, String>> = LazyLock::new(|| {
let mut map = HashMap::new();
for block in &*BLOCKS.blocks {
map.insert(block.default_state_id, block.name.clone());
}
map
});

pub fn get_block(registry_id: &str) -> Option<&Block> {
BLOCKS
.blocks
Expand Down
Loading
Loading