SHOW:
|
|
- or go back to the newest paste.
| 1 | chestFull = false | |
| 2 | ||
| 3 | - | function fillSlots(start, finish) |
| 3 | + | function fillSlot(slot) |
| 4 | - | for i=start,finish do |
| 4 | + | turtle.select(slot) |
| 5 | while turtle.getItemCount() < 16 do | |
| 6 | - | while turtle.getItemCount() < 64 do |
| 6 | + | turtle.suck(16-turtle.getItemCount()) |
| 7 | - | turtle.suckUp(64-turtle.getItemCount()) |
| 7 | + | |
| 8 | end | |
| 9 | ||
| 10 | function emptyInventory() | |
| 11 | for i=1,16 do | |
| 12 | turtle.select(i) | |
| 13 | item = turtle.getItemDetail() | |
| 14 | if item and item.name == "ic2:itembatre" then | |
| 15 | dropped, message = turtle.drop() | |
| 16 | - | if item and item.name == "ic2:blockmachinelv" then |
| 16 | + | |
| 17 | - | dropped, message = turtle.dropDown() |
| 17 | + | |
| 18 | chestFull = true | |
| 19 | return | |
| 20 | else | |
| 21 | chestFull = false | |
| 22 | end | |
| 23 | end | |
| 24 | end | |
| 25 | end | |
| 26 | ||
| 27 | function craftBattery() | |
| 28 | turtle.turnRight() | |
| 29 | - | function craftMachineBlock() |
| 29 | + | turtle.turnRight() |
| 30 | - | fillSlots(1, 3) |
| 30 | + | |
| 31 | - | fillSlots(5, 5) |
| 31 | + | turtle.select(2) |
| 32 | - | fillSlots(7, 7) |
| 32 | + | while turtle.getItemCount() < 16 do |
| 33 | - | fillSlots(9, 11) |
| 33 | + | turtle.suckUp(16-turtle.getItemCount()) |
| 34 | end | |
| 35 | ||
| 36 | fillSlot(5) | |
| 37 | fillSlot(7) | |
| 38 | fillSlot(9) | |
| 39 | - | while redstone.getInput("back") and not chestFull do
|
| 39 | + | fillSlot(11) |
| 40 | ||
| 41 | turtle.turnRight() | |
| 42 | - | craftMachineBlock() |
| 42 | + | |
| 43 | fillSlot(6) | |
| 44 | fillSlot(10) | |
| 45 | ||
| 46 | turtle.craft() | |
| 47 | ||
| 48 | turtle.turnRight() | |
| 49 | ||
| 50 | emptyInventory() | |
| 51 | end | |
| 52 | ||
| 53 | while true do | |
| 54 | while not chestFull do | |
| 55 | emptyInventory() | |
| 56 | if not chestFull then | |
| 57 | craftBattery() | |
| 58 | end | |
| 59 | end | |
| 60 | sleep(1) | |
| 61 | end |