diff --git a/Assets/Textures/block.png b/Assets/Textures/block.png
index a86703b..b1d0348 100644
Binary files a/Assets/Textures/block.png and b/Assets/Textures/block.png differ
diff --git a/Assets/Textures/block.xml b/Assets/Textures/block.xml
index 38941b7..29ae0c3 100644
--- a/Assets/Textures/block.xml
+++ b/Assets/Textures/block.xml
@@ -20,10 +20,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Textures/items.png b/Assets/Textures/items.png
index 21b50ef..cbc5191 100644
Binary files a/Assets/Textures/items.png and b/Assets/Textures/items.png differ
diff --git a/Assets/Textures/items.xml b/Assets/Textures/items.xml
index 51a6a26..106a71f 100644
--- a/Assets/Textures/items.xml
+++ b/Assets/Textures/items.xml
@@ -1,44 +1,47 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eea44b8..690c141 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -66,7 +66,7 @@ glad.c
"app.rc" "Game/Objects/Base/Blocks/Water.cpp" "Game/Objects/Base/Blocks/Bedrock.h" "Game/Objects/Base/Blocks/CoalOre.h" "Game/Objects/Base/Blocks/IronOre.h" "Game/Objects/Base/Blocks/GoldOre.h" "Game/Objects/Base/Blocks/DiamondOre.h"
Engine/Helpers/Performance.h
- "Game/Objects/Base/FallingBlock.h" "Game/Objects/Base/FallingBlock.cpp" "Game/Objects/Base/Blocks/Sand.cpp")
+ "Game/Objects/Base/FallingBlock.h" "Game/Objects/Base/FallingBlock.cpp" "Game/Objects/Base/Blocks/Sand.cpp" "Game/Objects/Base/Blocks/NullBlock.h")
link_directories(bassLibrary)
diff --git a/src/Engine/External/Spritesheet.cpp b/src/Engine/External/Spritesheet.cpp
index 655632b..a90d758 100644
--- a/src/Engine/External/Spritesheet.cpp
+++ b/src/Engine/External/Spritesheet.cpp
@@ -39,7 +39,10 @@ const Sprite SpriteSheet::GetSprite(std::string s) const
}
}
- return Sprite();
+ if (s == "null")
+ return Sprite{ "null", 0, 0, 0, 0 };
+
+ return GetSprite("null");
}
glm::vec4 SpriteSheet::GetUV(std::string s) const
diff --git a/src/Game/CraftingManager.cpp b/src/Game/CraftingManager.cpp
index 7f771bf..596deb6 100644
--- a/src/Game/CraftingManager.cpp
+++ b/src/Game/CraftingManager.cpp
@@ -34,10 +34,10 @@ void CraftingManager::Init()
Data::InventoryItem(Data::ITEM_STICK, 4),
{
{
- {Data::InventoryItem(Data::ITEM_WOODENPLANKS, 2)},{},{}
+ {Data::InventoryItem(Data::ITEM_WOODENPLANKS, 1)},{},{}
},
{
- {},{},{}
+ {Data::InventoryItem(Data::ITEM_WOODENPLANKS, 1)},{},{}
},
{
{},{},{}
@@ -126,6 +126,278 @@ void CraftingManager::Init()
true
});
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_STONE_AXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{}
+ },
+ {
+ {Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {}, {Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_STONE_PICKAXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_STONE_SWORD, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_STONE_SHOVEL, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_COBBLESTONE, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_IRON_AXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{}
+ },
+ {
+ {Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {}, {Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_IRON_PICKAXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_IRON_SWORD, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_IRON_SHOVEL, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_IRON_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_GOLD_AXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{}
+ },
+ {
+ {Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {}, {Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_GOLD_PICKAXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_GOLD_SWORD, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_GOLD_SHOVEL, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_GOLD_INGOT, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_DIAMOND_AXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{}
+ },
+ {
+ {Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {}, {Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_DIAMOND_PICKAXE, 1),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_DIAMOND_SWORD, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_DIAMOND_SHOVEL, 1),
+ {
+ {
+ {},{Data::InventoryItem(Data::ITEM_DIAMOND, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ },
+ {
+ {},{Data::InventoryItem(Data::ITEM_STICK, 1)},{}
+ }
+ },
+ true
+ });
+
+ AddRecipe({
+ Data::InventoryItem(Data::ITEM_TORCH, 4),
+ {
+ {
+ {Data::InventoryItem(Data::ITEM_COAL, 1)},{},{}
+ },
+ {
+ {Data::InventoryItem(Data::ITEM_STICK, 1)},{},{}
+ },
+ {
+ {},{},{}
+ }
+ },
+ true
+ });
+
#pragma endregion
}
diff --git a/src/Game/Data/Player.h b/src/Game/Data/Player.h
index 9c48124..8db8433 100644
--- a/src/Game/Data/Player.h
+++ b/src/Game/Data/Player.h
@@ -67,6 +67,7 @@ namespace Data
ITEM_IRON_INGOT = 150,
ITEM_GOLD_INGOT = 151,
ITEM_DIAMOND = 152,
+ ITEM_TORCH = 153,
};
struct NBT {
@@ -284,6 +285,10 @@ namespace Data
case ITEM_DIAMOND:
tag = "item_diamond";
break;
+ case ITEM_TORCH:
+ tag = "item_torch";
+ placeable = true;
+ break;
default:
stackable = false;
tag = "item_null";
diff --git a/src/Game/Objects/Base/Block.h b/src/Game/Objects/Base/Block.h
index 13c5e19..dce67db 100644
--- a/src/Game/Objects/Base/Block.h
+++ b/src/Game/Objects/Base/Block.h
@@ -53,6 +53,7 @@ struct BlockFace {
enum BlockType
{
+ NULLBLOCK = -1,
DIRT = 1,
GRASS = 2,
STONE = 3,
diff --git a/src/Game/Objects/Base/Blocks/NullBlock.h b/src/Game/Objects/Base/Blocks/NullBlock.h
new file mode 100644
index 0000000..ce85889
--- /dev/null
+++ b/src/Game/Objects/Base/Blocks/NullBlock.h
@@ -0,0 +1,79 @@
+#ifndef _NULLBLOCK_H
+#define _NULLBLOCK_H
+
+#include "../Block.h"
+
+class NullBlock : public Block
+{
+public:
+ NullBlock(glm::vec3 _position) : Block(_position, NULLBLOCK) {
+ position = _position;
+ toughness = 0.0f;
+ }
+
+ BlockFace CreateFrontFace() override
+ {
+ glm::vec4 side = t->spriteSheet.GetUVFlip("null");
+
+ std::vector frontVertices = CreateQuad(position, glm::vec3(1, 1, 0), 0, side);
+
+ return BlockFace(frontVertices, { 0, 1, 3, 1, 2, 3 });
+ }
+
+ BlockFace CreateBackFace() override
+ {
+ glm::vec4 side = t->spriteSheet.GetUVFlip("null");
+
+ std::vector indices = { 0, 1, 3, 1, 2, 3 };
+
+ std::vector backVertices = CreateQuad(position + glm::vec3(0, 0, 1), glm::vec3(1, 1, 0), 0, side);
+
+ std::swap(indices[0], indices[1]);
+ std::swap(indices[3], indices[4]);
+
+ return BlockFace(backVertices, indices);
+ }
+
+ BlockFace CreateLeftFace() override
+ {
+ glm::vec4 side = t->spriteSheet.GetUVFlip("null");
+
+ std::vector leftVertices = CreateQuad(position + glm::vec3(1, 0, 0), glm::vec3(0, 1, 1), 0, side);
+
+ return BlockFace(leftVertices, { 0, 1, 3, 1, 2, 3 });
+ }
+
+ BlockFace CreateRightFace() override
+ {
+ std::vector indices = { 0, 1, 3, 1, 2, 3 };
+
+ glm::vec4 side = t->spriteSheet.GetUVFlip("null");
+
+ std::vector rightVertices = CreateQuad(position, glm::vec3(0, 1, 1), 0, side);
+
+ std::swap(indices[0], indices[1]);
+ std::swap(indices[3], indices[4]);
+
+ return BlockFace(rightVertices, indices);
+ }
+
+ BlockFace CreateTopFace() override
+ {
+ glm::vec4 dirt = t->spriteSheet.GetUVFlip("null");
+
+ std::vector topVertices = CreateQuad(position + glm::vec3(0, 1, 0), glm::vec3(1, 0, 0), 1, dirt);
+
+ return BlockFace(topVertices, { 0, 1, 3, 1, 2, 3 });
+ }
+
+ BlockFace CreateBottomFace() override
+ {
+ glm::vec4 dirt = t->spriteSheet.GetUVFlip("null");
+
+ std::vector bottomVertices = CreateQuad(position + glm::vec3(0, 0, 1), glm::vec3(1, 0, 0), -1, dirt);
+
+ return BlockFace(bottomVertices, { 0, 1, 3, 1, 2, 3 });
+ }
+};
+
+#endif
\ No newline at end of file
diff --git a/src/Game/Objects/Base/Chunk.cpp b/src/Game/Objects/Base/Chunk.cpp
index 1d68397..f7ecea3 100644
--- a/src/Game/Objects/Base/Chunk.cpp
+++ b/src/Game/Objects/Base/Chunk.cpp
@@ -21,6 +21,7 @@
#include "Blocks/IronOre.h"
#include "Blocks/GoldOre.h"
#include "Blocks/DiamondOre.h"
+#include "Blocks/NullBlock.h"
void Chunk::ApplyNormal(std::vector& vertices, glm::vec3 normal)
{
@@ -803,9 +804,12 @@ Block* Chunk::CreateBlock(int x, int y, int z, int id, Data::BlockData data)
case DIAMOND_ORE:
block = new DiamondOre(position + glm::vec3(x, y, z));
break;
- default:
+ case DIRT:
block = new Dirt(position + glm::vec3(x, y, z));
break;
+ default:
+ block = new NullBlock(position + glm::vec3(x, y, z));
+ break;
}
block->chunkPosition = glm::vec3(x, y, z);
block->t = txp;
diff --git a/src/Game/Objects/Base/Hud.cpp b/src/Game/Objects/Base/Hud.cpp
index 5c18862..bc6e505 100644
--- a/src/Game/Objects/Base/Hud.cpp
+++ b/src/Game/Objects/Base/Hud.cpp
@@ -81,7 +81,7 @@ void Hud::SetSelected(int s)
}
else
{
- hand->src = i->spriteSheet.GetUVFlip("hand");
+ hand->src = {};
hand->UpdateSprite();
}
}