From b070e58b0e6298da59a6f70c911eaa2e4a135066 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Mon, 30 Dec 2019 18:09:22 +0900 Subject: [PATCH] [CraftingRecipe] Fixed shaped recipe matching. --- TODO | 2 +- common/source/core/Config.cpp | 2 +- common/source/inventory/CraftingRecipe.cpp | 2 +- mods/blocks.lua | 6 ------ server/source/core/ServerApplication.cpp | 2 ++ 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index 54ca3929..2862c047 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,7 @@ TODO # Issues • DONE: Crafting doesn’t always work -• TODO: A mix of pickaxe + axe recipes gives a pickaxe?! +• DONE: A mix of pickaxe + axe recipes gives a pickaxe?! • TODO: Shapeless recipe code isn’t working • TODO: `Workbench` and `Furnace` are not scaled correctly with lower GUI scale settings • TODO: Blocks can be accessed from outside the world (will need a refactoring) diff --git a/common/source/core/Config.cpp b/common/source/core/Config.cpp index fd6e805b..1a66836d 100644 --- a/common/source/core/Config.cpp +++ b/common/source/core/Config.cpp @@ -21,7 +21,7 @@ bool Config::isNoClipEnabled = false; // Graphics bool Config::isTorchSmoothLightingEnabled = true; -bool Config::isSunSmoothLightingEnabled = false; +bool Config::isSunSmoothLightingEnabled = true; bool Config::isAmbientOcclusionEnabled = false; bool Config::isWireframeModeEnabled = false; u16 Config::renderDistance = 8; diff --git a/common/source/inventory/CraftingRecipe.cpp b/common/source/inventory/CraftingRecipe.cpp index 979fd3be..f2d60da8 100644 --- a/common/source/inventory/CraftingRecipe.cpp +++ b/common/source/inventory/CraftingRecipe.cpp @@ -114,7 +114,7 @@ bool CraftingRecipe::checkMatch(const Inventory &inventory, int offsetX, int off std::string inventoryItem = inventory.getStack(offsetX + x, offsetY + y).item().name(); if (m_pattern[y][x] == ' ') { - itemFound = !inventoryItem.empty(); + itemFound = inventoryItem.empty(); } else { auto it = m_keys.find(m_pattern[y][x]); diff --git a/mods/blocks.lua b/mods/blocks.lua index 50742001..001fbed3 100644 --- a/mods/blocks.lua +++ b/mods/blocks.lua @@ -1,9 +1,3 @@ -mod:block { - id = "", - name = "Air", - texture = 0, -} - mod:block { id = "dirt", name = "Dirt", diff --git a/server/source/core/ServerApplication.cpp b/server/source/core/ServerApplication.cpp index 875a90c0..6b547f53 100644 --- a/server/source/core/ServerApplication.cpp +++ b/server/source/core/ServerApplication.cpp @@ -29,6 +29,8 @@ void ServerApplication::init() { m_port = std::stoi(m_argumentParser.getArgument("port").parameter); Registry::setInstance(m_registry); + m_registry.registerBlock(0, "", "Air"); + m_registry.registerItem(0, "", "Air").setIsBlock(true); m_scriptEngine.init(); // m_luaCore.setPlayer(m_player); // FIXME