item and item.name == "minecraft:cobblestone"
and item.count or 0
local free_space = p.getItemLimit(2) - count
- debug("Output "..shorten(output).." needs "..free_space.." cobble")
+ debug("Output "..shorten(output).." needs "..tostring(free_space).." cobble")
if free_space > 0 then
table.insert(t, { address = output, free_space = free_space })
end
local count =
item and item.name == "minecraft:cobblestone"
and item.count or 0
- debug("Input "..shorten(input).." has"..count.." cobble")
+ debug("Input "..shorten(input).." has "..tostring(count).." cobble")
table.insert(t, { address = input, count = count })
end
table.sort(t, function(a, b) return a.count > b.count end)
to_move_total = to_move_total + output.free_space
for _, input in ipairs(input_amounts()) do
if to_move <= 0 then
- debug("Output "..shorten(output).." full")
+ debug("Output "..shorten(output.address).." full")
break
end
local moved = p.pullItems(input.address, 1, math.min(input.count, to_move), 2)
-- moved may not be integer if pullItems failed.. look out
to_move = to_move - moved
to_move_total = to_move_total - moved
- debug("Moved "..tostring(moved).." cobble from input "..shorten(input).." to output "..shorten(output))
- if to_move > 0 then debug("Output "..shorten(output).." still needs "..tostring(to_move).." cobble") end
+ debug("Moved "..tostring(moved).." cobble from input "..shorten(input.address).." to output "..shorten(output.address))
+ if to_move > 0 then debug("Output "..shorten(output.address).." still needs "..tostring(to_move).." cobble") end
end
end
debug("Done moving cobble")