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 90e7d42375918636bf65fd6273675a576530778d
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/craftdef.cpp
@@ -907,8 +907,19 @@ 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())) {
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;*/

0 comments on commit 90e7d42

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