Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local efficiency = 8 --the amount of items each fuel item can smelt
- local furnaces = 6 --the amount of furnaces the chef has (MAX 8)
- local amounts = {}
- function selectNext() --selects the next non-empty slot in the turtle and returns true, else returns false
- for i = 1, 16 do
- if turtle.getItemCount(i) ~= 0 then
- turtle.select(i)
- return true
- end
- end
- return false
- end
- while turtle.suck() do
- for i = 2, furnaces do --get's the ores out of the chest, until chest is empty or has [furnaces] stacks
- table.insert(amounts, 0)
- if not turtle.suck() then break end
- end
- for k, v in pairs(amounts) do --puts the ores it has collected into the furnaces
- turtle.back()
- selectNext()
- amounts[k] = turtle.getItemCount()
- turtle.dropDown()
- end
- while turtle.forward() do end --resets to the chest location
- turtle.select(1)
- turtle.down()
- for k, v in pairs(amounts) do
- turtle.suck(math.ceil(v/efficiency)) --sucks out of the coal chest how much fuel it needs
- end
- turtle.down()
- local biggestStack = 0
- for k, v in pairs(amounts) do
- if v > biggestStack then --calculates the size of the biggest stack
- biggestStack = v
- end
- turtle.back()
- selectNext()
- turtle.dropUp(math.ceil(v/efficiency)) --puts the correct amount of fuel into each furnace
- end
- sleep(biggestStack*10) --waits for the biggest stack to be done
- for k, v in pairs(amounts) do --collects all the items
- turtle.suckUp()
- turtle.forward()
- end
- while selectNext() do turtle.drop() end
- turtle.up()
- turtle.up()
- turtle.select(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement