Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local craftSlots = {1, 2, 3, 5, 6, 7, 9, 10, 11}
- local nonCraftSlots = {4, 8, 12, 13, 14, 15, 16}
- local function getChestItemCount()
- local inputChest = peripheral.wrap("bottom")
- if peripheral.hasType("bottom", "inventory") then
- local inputChest = peripheral.wrap("bottom")
- local items = inputChest.list()
- if not items then
- return 0
- end
- local itemCount = 0
- for _, detail in pairs(items) do
- itemCount = itemCount + detail.count
- end
- return itemCount
- else
- return 0
- end
- end
- while true do
- if getChestItemCount() > 4*9*64 then
- failed = false
- for _, i in ipairs(craftSlots) do
- if turtle.getItemCount(i) < 64 then
- turtle.select(i)
- turtle.suckDown(64-turtle.getItemCount())
- end
- if turtle.getItemCount(i) == 0 then
- failed = true
- end
- end
- for _, i in ipairs(nonCraftSlots) do
- if turtle.getItemCount(i) > 0 then
- turtle.dropDown()
- end
- end
- if not failed then
- turtle.craft()
- for i=1, 16 do
- detail = turtle.getItemDetail(i)
- if detail and detail.name == "betterend:charcoal_block" then
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- else
- sleep(10)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment