Skip to content

Commit 422e502

Browse files
EXio4sfan5
authored andcommitted
Don't try to craft a non-existent item
1 parent 75320e7 commit 422e502

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/craftdef.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,18 @@ class CCraftDefManager: public IWritableCraftDefManager
907907
<< " against " << def->dump() << std::endl;*/
908908

909909
if (def->check(input, gamedef)) {
910+
// Check if the crafted node/item exists
911+
CraftOutput out = def->getOutput(input, gamedef);
912+
ItemStack is;
913+
is.deSerialize(out.item, gamedef->idef());
914+
if (!is.isKnown(gamedef->idef())) {
915+
errorstream << "trying to craft nonexistant " << out.item << ", ignoring recipe" << std::endl;
916+
continue;
917+
}
918+
910919
// Get output, then decrement input (if requested)
911-
output = def->getOutput(input, gamedef);
920+
output = out;
921+
912922
if (decrementInput)
913923
def->decrementInput(input, output_replacement, gamedef);
914924
/*errorstream << "Check RETURNS TRUE" << std::endl;*/

0 commit comments

Comments
 (0)