Skip to content
Permalink
Browse files

Don't try to craft a non-existent item

  • Loading branch information...
EXio4 authored and sfan5 committed Oct 15, 2017
1 parent 75320e7 commit 422e502ac4ca6c7d581e431b8dd622315b8e889b
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/craftdef.cpp
@@ -907,8 +907,18 @@ class CCraftDefManager: public IWritableCraftDefManager
<< " 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())) {
errorstream << "trying to craft nonexistant " << 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;*/

0 comments on commit 422e502

Please sign in to comment.
You can’t perform that action at this time.