SHOW:
|
|
- or go back to the newest paste.
1 | function fuelCheck() | |
2 | local fuelLevel = turtle.getFuelLevel() | |
3 | if fuelLevel < 60 then | |
4 | turtle.select(1) | |
5 | turtle.refuel(1) | |
6 | print("Refueled!") | |
7 | end | |
8 | end | |
9 | ||
10 | function chopTree() | |
11 | local success, data = turtle.inspect() | |
12 | if data.name == "minecraft:log" then | |
13 | print("Tree detected... chopping.") | |
14 | turtle.dig() | |
15 | turtle.forward() | |
16 | turtle.dig() | |
17 | while turtle.detectUp() == true do | |
18 | turtle.digUp() | |
19 | turtle.up() | |
20 | turtle.dig() | |
21 | end | |
22 | ||
23 | while turtle.detectDown() == false do | |
24 | turtle.down() | |
25 | end | |
26 | turtle.turnRight() | |
27 | turtle.dig() | |
28 | turtle.forward() | |
29 | turtle.turnLeft() | |
30 | turtle.dig() | |
31 | ||
32 | while turtle.detectUp() == true do | |
33 | turtle.digUp() | |
34 | turtle.up() | |
35 | turtle.dig() | |
36 | end | |
37 | ||
38 | while turtle.detectDown() == false do | |
39 | turtle.down() | |
40 | end | |
41 | turtle.select(3) | |
42 | turtle.place() | |
43 | turtle.turnRight() | |
44 | turtle.back() | |
45 | turtle.place() | |
46 | turtle.turnLeft() | |
47 | turtle.place() | |
48 | turtle.back() | |
49 | turtle.place() | |
50 | turtle.back() | |
51 | turtle.select(1) | |
52 | end | |
53 | end | |
54 | ||
55 | local chopping = true | |
56 | while chopping do | |
57 | fuelCheck() | |
58 | chopTree() | |
59 | turtle.suck() | |
60 | turtle.suckUp() | |
61 | end |