Add oak planks and oak logs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sijmen 2021-06-16 23:25:55 +02:00
parent 8ecb9ea813
commit 5252da6ccb
Signed by: vijfhoek
GPG key ID: 82D05C89B28B0DAE
3 changed files with 20 additions and 13 deletions

View file

@ -25,8 +25,8 @@ impl HotbarHud {
None,
Some(BlockType::Grass),
Some(BlockType::Cobblestone),
None,
None,
Some(BlockType::OakPlanks),
Some(BlockType::OakLog),
None,
];

View file

@ -114,7 +114,7 @@ impl Texture {
}
}
pub const TEXTURE_COUNT: usize = 40;
pub const TEXTURE_COUNT: usize = 43;
pub struct TextureManager {
pub bind_group_layout: wgpu::BindGroupLayout,
@ -186,6 +186,9 @@ impl TextureManager {
let path = format!("assets/water_still_plains/frame-{}.png", i);
self.load(render_context, &path)?; // 8 - 39
}
self.load(render_context, "assets/block/oak_log.png")?; // 40
self.load(render_context, "assets/block/oak_log_top.png")?; // 41
self.load(render_context, "assets/block/oak_planks.png")?; // 42
assert_eq!(TEXTURE_COUNT, self.textures.len());
let texture_array = render_context

View file

@ -5,14 +5,16 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum BlockType {
Cobblestone = 1,
Dirt = 2,
Stone = 3,
Grass = 4,
Bedrock = 5,
Sand = 6,
Gravel = 7,
Water = 8,
Cobblestone,
Dirt,
Stone,
Grass,
Bedrock,
Sand,
Gravel,
Water,
OakLog,
OakPlanks,
}
impl BlockType {
@ -22,11 +24,13 @@ impl BlockType {
BlockType::Cobblestone => ( 0, 0, 0, 0, 0, 0),
BlockType::Dirt => ( 1, 1, 1, 1, 1, 1),
BlockType::Stone => ( 2, 2, 2, 2, 2, 2),
BlockType::Grass => ( 4, 4, 4, 4, 2, 3),
BlockType::Grass => ( 4, 4, 4, 4, 1, 3),
BlockType::Bedrock => ( 5, 5, 5, 5, 5, 5),
BlockType::Sand => ( 6, 6, 6, 6, 6, 6),
BlockType::Gravel => ( 7, 7, 7, 7, 7, 7),
BlockType::Water => ( 8, 8, 8, 8, 8, 8), // up to 71
BlockType::Water => ( 8, 8, 8, 8, 8, 8), // up to 39
BlockType::OakLog => (40, 40, 40, 40, 41, 41),
BlockType::OakPlanks => (42, 42, 42, 42, 42, 42),
}
}