1.7.10 compatibility
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -1086,35 +1086,39 @@ 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
|
||||||
v.count = v.qty
|
v.count = v.qty
|
||||||
v.maxDamage = v.max_dmg
|
v.maxDamage = v.max_dmg
|
||||||
v.maxCount = v.max_size
|
v.maxCount = v.max_size
|
||||||
v.nbtHash = v.nbt_hash
|
v.nbtHash = v.nbt_hash
|
||||||
if not itemDB:get(v) then
|
if not itemDB:get(v) then
|
||||||
itemDB:add(v)
|
itemDB:add(v)
|
||||||
|
end
|
||||||
|
table.insert(list, v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
itemDB:flush()
|
itemDB:flush()
|
||||||
return list
|
else
|
||||||
end
|
for i = 1,16 do
|
||||||
|
local qty = turtle.getItemCount(i)
|
||||||
local inventory = { }
|
if qty > 0 then
|
||||||
for i = 1,16 do
|
turtleChestAdapter:insert(i, qty)
|
||||||
local qty = turtle.getItemCount(i)
|
local items = turtleChestAdapter:listItems()
|
||||||
if qty > 0 then
|
local _, item = next(items)
|
||||||
turtleChestAdapter:insert(i, qty)
|
turtleChestAdapter:extract(1, qty, i)
|
||||||
local items = turtleChestAdapter:listItems()
|
table.insert(list, item)
|
||||||
_, inventory[i] = next(items)
|
end
|
||||||
turtleChestAdapter:extract(1, qty, i)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return inventory
|
|
||||||
|
return list
|
||||||
end
|
end
|
||||||
|
|
||||||
local function learnRecipe(page)
|
local function learnRecipe(page)
|
||||||
@@ -1131,32 +1135,35 @@ local function learnRecipe(page)
|
|||||||
ingredients = ingredients,
|
ingredients = ingredients,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _,v1 in pairs(results) do
|
if #results > 1 then
|
||||||
for _,v2 in pairs(ingredients) do
|
for _,v1 in pairs(results) do
|
||||||
if v1.name == v2.name and
|
for _,v2 in pairs(ingredients) do
|
||||||
v1.nbtHash == v2.nbtHash and
|
if v1.name == v2.name and
|
||||||
(v1.damage == v2.damage or
|
v1.nbtHash == v2.nbtHash and
|
||||||
(v1.maxDamage > 0 and v2.maxDamage > 0 and
|
(v1.damage == v2.damage or
|
||||||
v1.damage ~= v2.damage)) then
|
(v1.maxDamage > 0 and v2.maxDamage > 0 and
|
||||||
if not newRecipe.crafingTools then
|
v1.damage ~= v2.damage)) then
|
||||||
newRecipe.craftingTools = { }
|
if not newRecipe.crafingTools then
|
||||||
end
|
newRecipe.craftingTools = { }
|
||||||
local tool = Util.shallowCopy(v2)
|
end
|
||||||
if tool.maxDamage > 0 then
|
local tool = Util.shallowCopy(v2)
|
||||||
tool.damage = '*'
|
if tool.maxDamage > 0 then
|
||||||
end
|
tool.damage = '*'
|
||||||
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Turtles can only craft one item at a time using a tool :(
|
Turtles can only craft one item at a time using a tool :(
|
||||||
]]--
|
]]--
|
||||||
maxCount = 1
|
maxCount = 1
|
||||||
|
|
||||||
newRecipe.craftingTools[uniqueKey(tool)] = true
|
newRecipe.craftingTools[uniqueKey(tool)] = true
|
||||||
v1.craftingTool = true
|
v1.craftingTool = true
|
||||||
break
|
break
|
||||||
|
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user