aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEsteban I. RM <me@exio4.xyz>2017-10-15 02:52:05 -0300
committersfan5 <sfan5@live.de>2017-10-16 10:13:45 +0200
commit90e7d42375918636bf65fd6273675a576530778d (patch)
treeca3305cf46de354ff22a106eedbb6d2b60d4aa9e /src
parent75320e7e88ab5088a46c9e42c1e789cbdacb13b0 (diff)
downloadminetest-90e7d42375918636bf65fd6273675a576530778d.tar.gz
minetest-90e7d42375918636bf65fd6273675a576530778d.tar.bz2
minetest-90e7d42375918636bf65fd6273675a576530778d.zip
Don't try to craft a non-existent item
Diffstat (limited to 'src')
-rw-r--r--src/craftdef.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/craftdef.cpp b/src/craftdef.cpp
index 8aa809930..922ea345e 100644
--- a/src/craftdef.cpp
+++ b/src/craftdef.cpp
@@ -907,8 +907,19 @@ public:
<< " 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;*/