From 01b82b1094c02ec5e7dcfde5e6ff16af01217420 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sun, 5 Feb 2023 01:43:47 +0100 Subject: [PATCH] cobblestone --- assets/blocks/cobblestone.png | Bin 0 -> 578 bytes kubi-shared/src/blocks.rs | 1 + kubi/src/block_placement.rs | 2 +- kubi/src/prefabs.rs | 28 +++++++++++++++------------- kubi/src/world/block.rs | 6 ++++++ 5 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 assets/blocks/cobblestone.png diff --git a/assets/blocks/cobblestone.png b/assets/blocks/cobblestone.png new file mode 100644 index 0000000000000000000000000000000000000000..44b13240dd83efdbea89d62a1281ceebb28b33c2 GIT binary patch literal 578 zcmV-I0=@l-P)Px#1ZP1_K>z@;j|==^1poj5=TJ;kMS6OAVPRokUtg`Qt)`}?e0+RuZEc^QpL=_I zPft%*S66CkYNMm0hK7czsi}m7gk)r7gM)*Lii(Sii(p`2prD|got<}gcaM*cf`Wom zQ&W_blz@PMn3$MuZf<^levFKaRaI4@qN0|TmStsSO-)TwQc{y`Ts;a8Iyu6#6n{;$^T3T9}nVEloe}#pGj*X6Xc6M=baY{-`Nl8hhq@pF^9aqcZLu)}@8|7vT?G7n8>5{IVl07S-ei%i5nT;CKKll7Tr%dWDrRjWDm1$1pu4#Mdrz4n%mQ}`7dGC zPTZ_6P}MN2y{f(~2dgy%4A_h}iRzNu!ixLuGX{1Z8ShnRVte!8OlBXSz__<4N~fd# zmvn~T3h3eBiBoL_(LUbf2SImElg-Lu&Pw+4ODxUS()ddQTD|y;cO6Ce4+EtbXY+DM Ql>h($07*qoM6N<$g5jz9)&Kwi literal 0 HcmV?d00001 diff --git a/kubi-shared/src/blocks.rs b/kubi-shared/src/blocks.rs index 3e601fc..0f94b33 100644 --- a/kubi-shared/src/blocks.rs +++ b/kubi-shared/src/blocks.rs @@ -9,4 +9,5 @@ pub enum Block { Dirt, Grass, Sand, + Cobblestone, } diff --git a/kubi/src/block_placement.rs b/kubi/src/block_placement.rs index f46ff1b..3eff4be 100644 --- a/kubi/src/block_placement.rs +++ b/kubi/src/block_placement.rs @@ -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) }; diff --git a/kubi/src/prefabs.rs b/kubi/src/prefabs.rs index 8b90291..4529bce 100644 --- a/kubi/src/prefabs.rs +++ b/kubi/src/prefabs.rs @@ -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", } } } diff --git a/kubi/src/world/block.rs b/kubi/src/world/block.rs index 45c2552..66a0905 100644 --- a/kubi/src/world/block.rs +++ b/kubi/src/world/block.rs @@ -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, + } } } }