aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsteban I. RM <me@exio4.xyz>2017-10-15 02:52:05 -0300
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit0041bcc73e04b9e24c0148c0a735d271d2d1b893 (patch)
tree83adf7673fd332fc02bae58fc92bd009af29201b
parentcc48c95ca7abe6949e637ca537a3e75a2de2fac4 (diff)
downloadminetest-0041bcc73e04b9e24c0148c0a735d271d2d1b893.tar.gz
minetest-0041bcc73e04b9e24c0148c0a735d271d2d1b893.tar.bz2
minetest-0041bcc73e04b9e24c0148c0a735d271d2d1b893.zip
Don't try to craft a non-existent item
-rw-r--r--src/craftdef.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/craftdef.cpp b/src/craftdef.cpp
index 286d1eada..210fe9f03 100644
--- a/src/craftdef.cpp
+++ b/src/craftdef.cpp
@@ -923,8 +923,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;*/