SHOW:
|
|
- or go back to the newest paste.
| 1 | e = peripheral.wrap("left")
| |
| 2 | e.setAutoCollect(true) | |
| 3 | hasBooks = true | |
| 4 | ||
| 5 | - | turtle.turnRight() |
| 5 | + | |
| 6 | - | for i = 2, 16 do |
| 6 | + | turtle.turnRight() |
| 7 | - | turtle.select(i) |
| 7 | + | for i = 2, 16 do |
| 8 | - | turtle.drop() |
| 8 | + | turtle.select(i) |
| 9 | - | end |
| 9 | + | turtle.drop() |
| 10 | end | |
| 11 | - | turtle.turnLeft() |
| 11 | + | turtle.select(1) |
| 12 | turtle.turnLeft() | |
| 13 | end | |
| 14 | ||
| 15 | - | if turtle.getItemCount(16) > 0 then |
| 15 | + | |
| 16 | - | unload() |
| 16 | + | if turtle.getItemCount(16) > 0 then |
| 17 | - | end |
| 17 | + | unload() |
| 18 | end | |
| 19 | end | |
| 20 | ||
| 21 | - | if e.getLevels() >= 30 then |
| 21 | + | function hasBook() |
| 22 | - | turtle.select(1) |
| 22 | + | if turtle.getItemCount(1) == 1 and turtle.getItemDetail(1).name == "minecraft:book" then |
| 23 | - | e.enchant(30) |
| 23 | + | return true |
| 24 | - | sleep(1) |
| 24 | + | else |
| 25 | - | turtle.suckDown(1) |
| 25 | + | return false |
| 26 | - | end |
| 26 | + | end |
| 27 | - | checkFull() |
| 27 | + | |
| 28 | - | turtle.attack() |
| 28 | + | |
| 29 | - | print(e.getLevels()) |
| 29 | + | function depositBook() |
| 30 | turtle.turnLeft() | |
| 31 | turtle.drop() | |
| 32 | turtle.turnRight() | |
| 33 | end | |
| 34 | ||
| 35 | function enchant() | |
| 36 | if e.getLevels() >= 30 and hasBook() then | |
| 37 | turtle.select(1) | |
| 38 | e.enchant(30) | |
| 39 | depositBook() | |
| 40 | turtle.suckDown(1) | |
| 41 | end | |
| 42 | end | |
| 43 | ||
| 44 | while true do | |
| 45 | enchant() | |
| 46 | checkFull() | |
| 47 | turtle.attack() | |
| 48 | turtle.suck() | |
| 49 | end |