Skip to content

Commit

Permalink
Don't try to craft a non-existent item
Browse files Browse the repository at this point in the history
  • Loading branch information
EXio4 authored and sfan5 committed Oct 16, 2017
1 parent 75320e7 commit 422e502
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/craftdef.cpp
Expand Up @@ -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;*/
Expand Down

0 comments on commit 422e502

Please sign in to comment.