recipe nbts + item get/add helper

This commit is contained in:
kepler155c@gmail.com
2019-01-04 00:29:03 -05:00
parent d0a7a6e488
commit 6606975f5b
7 changed files with 62 additions and 41 deletions

View File

@@ -131,6 +131,7 @@ local function turtleCraft(recipe, storage, request, count)
if storage:export(storage.turtleInventory, k, count, item) ~= count then
request.status = 'unknown error'
request.statusCode = Craft.STATUS_ERROR
_debug('failed to export: ' .. item.name)
return
end
@@ -203,18 +204,11 @@ local function adjustCounts(recipe, count, ingredients, storage)
-- increment crafted
local result = ingredients[recipe.result]
result.count = result.count + (count * recipe.count)
end
function Craft.craftRecipeInternal(recipe, count, storage, origItem)
local request = origItem.ingredients[recipe.result]
if request.aborted then
_debug('aborted')
return 0
end
if origItem.pending[recipe.result] then
request.status = 'processing'
request.statusCode = Craft.STATUS_INFO
@@ -281,6 +275,12 @@ _G._p = origItem.ingredients
canCraft = canCraft - maxCount
end
if request.aborted then
origItem.aborted = true
_debug('aborted')
return 0
end
return crafted * recipe.count
end