cleanup + adv brewing

This commit is contained in:
kepler155c
2018-11-13 13:43:30 -05:00
parent c50de60f43
commit 986fe160c7
8 changed files with 58 additions and 40 deletions

View File

@@ -52,7 +52,6 @@ function ExportTask:cycle(context)
end
for key in pairs(entry.filter or { }) do
-- bad for perf to do listItems each time
local items = Milo:getMatches(Milo:listItems(), itemDB:splitKey(key), entry.ignoreDamage, entry.ignoreNbtHash)
for _,item in pairs(items) do
if item and item.count > 0 then
@@ -63,7 +62,9 @@ function ExportTask:cycle(context)
else
-- _debug('attempting to export %s %d', item.name, item.count)
-- TODO: always going to try and export even if the chest is full
context.storage:export(machine.name, nil, item.count, item)
if context.storage:export(machine.name, nil, item.count, item) == 0 then
break
end
end
end
end

View File

@@ -64,7 +64,7 @@ function importView:setNode(node)
}
local m = device[self.machine.name]
for k = 1, m.size() do
for k = 1, m.size() do
table.insert(self.slots.choices, { name = k, value = k })
end
end

View File

@@ -1,5 +1,8 @@
local Craft = require('turtle.craft')
local Milo = require('milo')
local Craft = require('turtle.craft')
local itemDB = require('itemDB')
local Milo = require('milo')
local BLAZE_POWDER = "minecraft:blaze_powder:0"
local PotionImportTask = {
name = 'potions',
@@ -16,6 +19,20 @@ function PotionImportTask:cycle(context)
if bs.adapter.getBrewTime() == 0 then
local list = bs.adapter.list()
-- refill blaze powder
if not list[5] then
local blazePowder = context.storage.cache[BLAZE_POWDER]
if blazePowder then
context.storage:export(bs.name, 5, 1, blazePowder)
else
local item = itemDB:get(BLAZE_POWDER)
if item then
item.requested = 1
Milo:requestCrafting(item)
end
end
end
if list[1] and not list[4] then
-- brewing has completd
@@ -25,6 +42,7 @@ function PotionImportTask:cycle(context)
Milo:saveMachineRecipe(self.brewQueue[bs.name], list[1], bs.name)
end
end
for slot = 1, 3 do
if list[slot] then
context.storage:import(bs.name, slot, 1, list[slot])