[CraftingRecipe] Small fix for shapeless recipes.
This commit is contained in:
parent
b18333d43c
commit
6fdf1fc81d
@ -58,14 +58,14 @@ void Registry::registerItems() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Registry::registerRecipes() {
|
void Registry::registerRecipes() {
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 0, 6, 12, 0, 0, 12, 0}, ItemStack{13});
|
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 0, 6, 12, 0, 0, 12, 0}, ItemStack{ItemType::StoneAxe});
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 0, 0, 12, 0, 0, 12, 0}, ItemStack{14});
|
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 0, 0, 12, 0, 0, 12, 0}, ItemStack{ItemType::StoneHoe});
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 6, 0, 12, 0, 0, 12, 0}, ItemStack{15});
|
m_recipes.emplace_back(std::array<u32, 9>{6, 6, 6, 0, 12, 0, 0, 12, 0}, ItemStack{ItemType::StonePickaxe});
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{0, 6, 0, 0, 12, 0, 0, 12, 0}, ItemStack{16});
|
m_recipes.emplace_back(std::array<u32, 9>{0, 6, 0, 0, 12, 0, 0, 12, 0}, ItemStack{ItemType::StoneShovel});
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{0, 6, 0, 0, 6, 0, 0, 12, 0}, ItemStack{17});
|
m_recipes.emplace_back(std::array<u32, 9>{0, 6, 0, 0, 6, 0, 0, 12, 0}, ItemStack{ItemType::StoneSword});
|
||||||
|
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{11, 11, 0, 0, 0, 0, 0, 0, 0}, ItemStack{12, 4}, true);
|
m_recipes.emplace_back(std::array<u32, 9>{5, 0, 0, 0, 0, 0, 0, 0, 0}, ItemStack{ItemType::Wood, 4}, true);
|
||||||
m_recipes.emplace_back(std::array<u32, 9>{5, 0, 0, 0, 0, 0, 0, 0, 0}, ItemStack{11, 4}, true);
|
m_recipes.emplace_back(std::array<u32, 9>{11, 11, 0, 0, 0, 0, 0, 0, 0}, ItemStack{ItemType::Stick, 4}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CraftingRecipe *Registry::getRecipe(const Inventory &inventory) const {
|
const CraftingRecipe *Registry::getRecipe(const Inventory &inventory) const {
|
||||||
|
@ -33,8 +33,6 @@ bool CraftingRecipe::isMatching(const Inventory &inventory) const {
|
|||||||
else {
|
else {
|
||||||
std::array<bool, 9> match{false, false, false, false, false, false, false, false, false};
|
std::array<bool, 9> match{false, false, false, false, false, false, false, false, false};
|
||||||
for (u32 id : m_recipe) {
|
for (u32 id : m_recipe) {
|
||||||
if (!id) continue;
|
|
||||||
|
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
for (u16 i = 0 ; i < 9 ; ++i) {
|
for (u16 i = 0 ; i < 9 ; ++i) {
|
||||||
if (inventory.getStack(i % 3, i / 3).item().id() == id && !match[i]) {
|
if (inventory.getStack(i % 3, i / 3).item().id() == id && !match[i]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user