Skip to content

Commit 90e7d42

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

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/craftdef.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,19 @@ 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+
infostream << "trying to craft non-existent "
916+
<< out.item << ", ignoring recipe" << std::endl;
917+
continue;
918+
}
919+
910920
// Get output, then decrement input (if requested)
911-
output = def->getOutput(input, gamedef);
921+
output = out;
922+
912923
if (decrementInput)
913924
def->decrementInput(input, output_replacement, gamedef);
914925
/*errorstream << "Check RETURNS TRUE" << std::endl;*/

0 commit comments

Comments
 (0)