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,
},
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 { }
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
self.jobList[cpu] = {
name = item.name,

View File

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