mirror of
https://github.com/minetest/minetest.git
synced 2024-12-02 04:23:45 +01:00
Don't try to craft a non-existent item
This commit is contained in:
parent
cc48c95ca7
commit
0041bcc73e
@ -923,8 +923,19 @@ public:
|
|||||||
<< " against " << def->dump() << std::endl;*/
|
<< " against " << def->dump() << std::endl;*/
|
||||||
|
|
||||||
if (def->check(input, gamedef)) {
|
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)
|
// Get output, then decrement input (if requested)
|
||||||
output = def->getOutput(input, gamedef);
|
output = out;
|
||||||
|
|
||||||
if (decrementInput)
|
if (decrementInput)
|
||||||
def->decrementInput(input, output_replacement, gamedef);
|
def->decrementInput(input, output_replacement, gamedef);
|
||||||
/*errorstream << "Check RETURNS TRUE" << std::endl;*/
|
/*errorstream << "Check RETURNS TRUE" << std::endl;*/
|
||||||
|
Loading…
Reference in New Issue
Block a user