mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-01 05:29:05 +02:00
resource: update block type code generator for Rust
This commit is contained in:
parent
6379472282
commit
718ecf5909
6 changed files with 6399 additions and 12 deletions
|
@ -1,3 +1,4 @@
|
|||
pub mod io;
|
||||
pub mod resource;
|
||||
pub mod types;
|
||||
pub mod world;
|
||||
|
|
6327
src/resource/block_types.rs
Normal file
6327
src/resource/block_types.rs
Normal file
File diff suppressed because it is too large
Load diff
33
src/resource/mod.rs
Normal file
33
src/resource/mod.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
mod block_types;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use enumflags2::{bitflags, BitFlags};
|
||||
|
||||
#[bitflags]
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum BlockFlags {
|
||||
Opaque,
|
||||
Grass,
|
||||
Foliage,
|
||||
Birch,
|
||||
Spruce,
|
||||
Water,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct BlockColor(pub u8, pub u8, pub u8);
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct BlockType {
|
||||
pub flags: BitFlags<BlockFlags>,
|
||||
pub color: BlockColor,
|
||||
}
|
||||
|
||||
pub fn get_block_types() -> HashMap<String, BlockType> {
|
||||
block_types::BLOCK_TYPES
|
||||
.iter()
|
||||
.map(|(k, v)| (String::from(*k), *v))
|
||||
.collect()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue