SHOW:
|
|
- or go back to the newest paste.
1 | local e = 1 | |
2 | ||
3 | function selectBlocks(s) | |
4 | if getBlockCount() ~= 0 then | |
5 | if tmp ~= nil then | |
6 | if tmp["name"] == "minecraft:netherrack" then | |
7 | local x = turtle.getItemCount() | |
8 | if x < 1 then | |
9 | turtle.select(s + 1) | |
10 | end | |
11 | end | |
12 | end | |
13 | else | |
14 | e = 2 | |
15 | end | |
16 | end | |
17 | ||
18 | function bridge() | |
19 | turtle.dig() | |
20 | turtle.forward() | |
21 | turtle.digUp() | |
22 | turtle.placeDown() | |
23 | turtle.turnLeft() | |
24 | turtle.place() | |
25 | turtle.turnRight() | |
26 | turtle.turnRight() | |
27 | turtle.place() | |
28 | turtle.turnLeft() | |
29 | end | |
30 | ||
31 | function getBlockCount() | |
32 | local bc = 0 | |
33 | local tmp | |
34 | for z = 1, 16, 1 do | |
35 | tmp = turtle.getItemDetail(t) | |
36 | if tmp ~= nil then | |
37 | if tmp["name"] == "minecraft:netherrack" then | |
38 | bc = bc + tmp["count"] | |
39 | end | |
40 | end | |
41 | end | |
42 | return bc | |
43 | end | |
44 | ||
45 | function equipPickaxe() | |
46 | local ed = 0 | |
47 | local tmp | |
48 | shell.run("unequip", "left") | |
49 | shell.run("unequip", "right") | |
50 | for p = 1, 16, 1 do | |
51 | tmp = turtle.getItemDetail(p) | |
52 | if tmp ~= nil then | |
53 | if tmp["name"] == "minecraft:diamond_pickaxe" then | |
54 | turtle.equipLeft(p) | |
55 | ed = 1 | |
56 | end | |
57 | end | |
58 | end | |
59 | if ed == 0 then | |
60 | e = 2 | |
61 | print("Please put a Pickaxe into the Inventory") | |
62 | end | |
63 | end | |
64 | ||
65 | function doAll() | |
66 | shell.run("refuel", "all") | |
67 | equipPickaxe() | |
68 | turtle.select(1) | |
69 | while e == 1 do | |
70 | bridge() | |
71 | selectBlocks(turtle.getSelectedSlot()) | |
72 | end | |
73 | end | |
74 | ||
75 | doAll() |