CraftOutput CraftDefinitionToolRepair::getOutput(const CraftInput &input, IGameDef *gamedef) const { ItemStack item1; ItemStack item2; for (const auto &item : input.items) { if (!item.empty()) { if (item1.empty()) item1 = item; else if (item2.empty()) item2 = item; } } ItemStack repaired = craftToolRepair(item1, item2, additional_wear, gamedef); return CraftOutput(repaired.getItemString(), 0); }
CraftOutput CraftDefinitionToolRepair::getOutput(const CraftInput &input, IGameDef *gamedef) const { ItemStack item1; ItemStack item2; for (std::vector<ItemStack>::const_iterator it = input.items.begin(); it != input.items.end(); it++) { if (!it->empty()) { if (item1.empty()) item1 = *it; else if (item2.empty()) item2 = *it; } } ItemStack repaired = craftToolRepair(item1, item2, additional_wear, gamedef); return CraftOutput(repaired.getItemString(), 0); }
bool CraftDefinitionToolRepair::check(const CraftInput &input, IGameDef *gamedef) const { if (input.method != CRAFT_METHOD_NORMAL) return false; ItemStack item1; ItemStack item2; for (const auto &item : input.items) { if (!item.empty()) { if (item1.empty()) item1 = item; else if (item2.empty()) item2 = item; else return false; } } ItemStack repaired = craftToolRepair(item1, item2, additional_wear, gamedef); return !repaired.empty(); }
bool CraftDefinitionToolRepair::check(const CraftInput &input, IGameDef *gamedef) const { if (input.method != CRAFT_METHOD_NORMAL) return false; ItemStack item1; ItemStack item2; for (std::vector<ItemStack>::const_iterator it = input.items.begin(); it != input.items.end(); it++) { if (!it->empty()) { if (item1.empty()) item1 = *it; else if (item2.empty()) item2 = *it; else return false; } } ItemStack repaired = craftToolRepair(item1, item2, additional_wear, gamedef); return !repaired.empty(); }