SHOW:
|
|
- or go back to the newest paste.
1 | local efficiency = 8 --the amount of items each fuel item can smelt | |
2 | local furnaces = 6 --the amount of furnaces the chef has (MAX 8) | |
3 | local amounts = {} | |
4 | function selectNext() --selects the next non-empty slot in the turtle and returns true, else returns false | |
5 | for i = 1, 16 do | |
6 | if turtle.getItemCount(i) ~= 0 then | |
7 | turtle.select(i) | |
8 | return true | |
9 | end | |
10 | end | |
11 | return false | |
12 | end | |
13 | while turtle.suck() do | |
14 | for i = 2, furnaces do --get's the ores out of the chest, until chest is empty or has [furnaces] stacks | |
15 | table.insert(amounts, 0) | |
16 | if not turtle.suck() then break end | |
17 | end | |
18 | for k, v in pairs(amounts) do --puts the ores it has collected into the furnaces | |
19 | turtle.back() | |
20 | selectNext() | |
21 | amounts[k] = turtle.getItemCount() | |
22 | turtle.dropDown() | |
23 | end | |
24 | while turtle.forward() do end --resets to the chest location | |
25 | turtle.select(1) | |
26 | turtle.down() | |
27 | for k, v in pairs(amounts) do | |
28 | turtle.suck(math.ceil(v/efficiency)) --sucks out of the coal chest how much fuel it needs | |
29 | end | |
30 | turtle.down() | |
31 | local biggestStack = 0 | |
32 | for k, v in pairs(amounts) do | |
33 | if v > biggestStack then --calculates the size of the biggest stack | |
34 | biggestStack = v | |
35 | end | |
36 | turtle.back() | |
37 | selectNext() | |
38 | turtle.dropUp(math.ceil(v/efficiency)) --puts the correct amount of fuel into each furnace | |
39 | end | |
40 | sleep(biggestStack*10) --waits for the biggest stack to be done | |
41 | for k, v in pairs(amounts) do --collects all the items | |
42 | turtle.suckUp() | |
43 | turtle.forward() | |
44 | end | |
45 | while selectNext() do turtle.drop() end | |
46 | turtle.up() | |
47 | turtle.up() | |
48 | turtle.select(1) | |
49 | end |