From: Esteban I. RM Date: Sun, 15 Oct 2017 05:52:05 +0000 (-0300) Subject: Don't try to craft a non-existent item X-Git-Tag: 5.0.0~770 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=90e7d42375918636bf65fd6273675a576530778d;p=oweals%2Fminetest.git Don't try to craft a non-existent item --- diff --git a/src/craftdef.cpp b/src/craftdef.cpp index 8aa809930..922ea345e 100644 --- a/src/craftdef.cpp +++ b/src/craftdef.cpp @@ -907,8 +907,19 @@ public: << " against " << def->dump() << std::endl;*/ if (def->check(input, gamedef)) { + // Check if the crafted node/item exists + CraftOutput out = def->getOutput(input, gamedef); + ItemStack is; + is.deSerialize(out.item, gamedef->idef()); + if (!is.isKnown(gamedef->idef())) { + infostream << "trying to craft non-existent " + << out.item << ", ignoring recipe" << std::endl; + continue; + } + // Get output, then decrement input (if requested) - output = def->getOutput(input, gamedef); + output = out; + if (decrementInput) def->decrementInput(input, output_replacement, gamedef); /*errorstream << "Check RETURNS TRUE" << std::endl;*/