cobblestone

This commit is contained in:
griffi-gh 2023-02-05 01:43:47 +01:00
parent df8640718d
commit 01b82b1094
5 changed files with 23 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View file

@ -9,4 +9,5 @@ pub enum Block {
Dirt,
Grass,
Sand,
Cobblestone,
}

View file

@ -24,7 +24,7 @@ pub fn block_placement_system(
//get coord and block type
let (place_position, place_block) = if action_place {
let position = (ray.position - ray.direction * 0.5).floor().as_ivec3();
(position, Block::Dirt)
(position, Block::Cobblestone)
} else {
(ray.block_position, Block::Air)
};

View file

@ -16,19 +16,20 @@ pub trait AssetPaths {
#[derive(Clone, Copy, Debug, EnumIter)]
#[repr(u8)]
pub enum BlockTexture {
Stone = 0,
Dirt = 1,
GrassTop = 2,
GrassSide = 3,
Sand = 4,
Bedrock = 5,
Wood = 6,
WoodTop = 7,
Leaf = 8,
Torch = 9,
TallGrass = 10,
Snow = 11,
GrassSideSnow = 12,
Stone,
Dirt,
GrassTop,
GrassSide,
Sand,
Bedrock,
Wood,
WoodTop,
Leaf,
Torch,
TallGrass,
Snow,
GrassSideSnow,
Cobblestone,
}
impl AssetPaths for BlockTexture {
fn file_name(self) -> &'static str {
@ -46,6 +47,7 @@ impl AssetPaths for BlockTexture {
Self::TallGrass => "tall_grass.png",
Self::Snow => "snow.png",
Self::GrassSideSnow => "grass_side_snow.png",
Self::Cobblestone => "cobblestone.png",
}
}
}

View file

@ -41,6 +41,12 @@ impl BlockDescriptorSource for Block {
collision: CollisionType::Solid,
raycast_collision: true,
},
Self::Cobblestone => BlockDescriptor {
name: "cobblestone",
render: RenderType::SolidBlock(CubeTexture::all(BlockTexture::Cobblestone)),
collision: CollisionType::Solid,
raycast_collision: true,
}
}
}
}