1.7.10 compatibility

This commit is contained in:
kepler155c
2018-03-20 04:36:47 -04:00
parent 2f8cb22105
commit a9c7672fbf
2 changed files with 55 additions and 52 deletions

View File

@@ -145,18 +145,12 @@ function MEAdapter:craft(item, count)
nbt_hash = item.nbtHash, nbt_hash = item.nbtHash,
}, },
count or 1, count or 1,
cpu cpu.name -- CPUs must be named ! use anvil
) )
os.sleep(0) -- tell it to craft, yet it doesn't show busy - try waiting a cycle... os.sleep(0) -- needed ?
cpus = self.getCraftingCPUs() or { } cpus = self.getCraftingCPUs() or { }
if not cpus[cpu].busy then
-- print('sleeping again')
os.sleep(.1) -- sigh
cpus = self.getCraftingCPUs() or { }
end
-- not working :(
if cpus[cpu].busy then if cpus[cpu].busy then
self.jobList[cpu] = { self.jobList[cpu] = {
name = item.name, name = item.name,

View File

@@ -1086,9 +1086,11 @@ function listingPage:applyFilter()
end end
local function getTurtleInventory() local function getTurtleInventory()
local list = { }
if duckAntenna then if duckAntenna then
local list = duckAntenna.getAllStacks(false) for _,v in pairs(duckAntenna.getAllStacks(false)) do
for _,v in pairs(list) do if v.qty > 0 then
v.name = v.id v.name = v.id
v.damage = v.dmg v.damage = v.dmg
v.displayName = v.display_name v.displayName = v.display_name
@@ -1099,22 +1101,24 @@ local function getTurtleInventory()
if not itemDB:get(v) then if not itemDB:get(v) then
itemDB:add(v) itemDB:add(v)
end end
table.insert(list, v)
end
end end
itemDB:flush() itemDB:flush()
return list else
end
local inventory = { }
for i = 1,16 do for i = 1,16 do
local qty = turtle.getItemCount(i) local qty = turtle.getItemCount(i)
if qty > 0 then if qty > 0 then
turtleChestAdapter:insert(i, qty) turtleChestAdapter:insert(i, qty)
local items = turtleChestAdapter:listItems() local items = turtleChestAdapter:listItems()
_, inventory[i] = next(items) local _, item = next(items)
turtleChestAdapter:extract(1, qty, i) turtleChestAdapter:extract(1, qty, i)
table.insert(list, item)
end end
end end
return inventory end
return list
end end
local function learnRecipe(page) local function learnRecipe(page)
@@ -1131,6 +1135,7 @@ local function learnRecipe(page)
ingredients = ingredients, ingredients = ingredients,
} }
if #results > 1 then
for _,v1 in pairs(results) do for _,v1 in pairs(results) do
for _,v2 in pairs(ingredients) do for _,v2 in pairs(ingredients) do
if v1.name == v2.name and if v1.name == v2.name and
@@ -1157,6 +1162,8 @@ local function learnRecipe(page)
end end
end end
end end
end
local recipe local recipe
for _,v in pairs(results) do for _,v in pairs(results) do
if not v.craftingTool then if not v.craftingTool then
@@ -1169,6 +1176,8 @@ local function learnRecipe(page)
end end
if not recipe then if not recipe then
debug(results)
debug(newRecipe)
error('Failed') error('Failed')
end end