SHOW:
|
|
- or go back to the newest paste.
1 | - | local function surface() |
1 | + | local function surface() |
2 | - | while turtle.detect() do |
2 | + | while turtle.detect() do |
3 | - | turtle.up() |
3 | + | turtle.up() |
4 | - | end |
4 | + | end |
5 | end | |
6 | - | |
6 | + | |
7 | - | local function getBelowName() |
7 | + | local function getBelowName() |
8 | - | present,tile = turtle.inspectDown() |
8 | + | present,tile = turtle.inspectDown() |
9 | - | if present then |
9 | + | if present then |
10 | - | return tile.name |
10 | + | return tile.name |
11 | - | end |
11 | + | end |
12 | end | |
13 | - | |
13 | + | |
14 | - | local function getBelowNameRaw() |
14 | + | local function getBelowNameRaw(name) |
15 | - | name = getBelowName() |
15 | + | name = name or getBelowName() |
16 | - | return string.sub(name,string.find(name,":")+1,#name) |
16 | + | return string.sub(name,string.find(name,":")+1,#name) |
17 | end | |
18 | - | |
18 | + | |
19 | - | local function getItemSlotName(id) |
19 | + | local function getItemSlotName(id) |
20 | - | turtle.select(id) |
20 | + | turtle.select(id) |
21 | - | slot = turtle.getItemDetail() |
21 | + | slot = turtle.getItemDetail() |
22 | - | return slot.name |
22 | + | return slot.name |
23 | end | |
24 | - | |
24 | + | |
25 | - | deniedblocks = {"minecraft:dirt","minecraft:cobblestone","minecraft:stone"} |
25 | + | deniedblocks = {"minecraft:dirt","minecraft:cobblestone","minecraft:stone"} |
26 | - | |
26 | + | |
27 | - | print("Starting...") |
27 | + | print("Starting...") |
28 | - | |
28 | + | |
29 | - | while true do |
29 | + | while true do |
30 | - | surface() |
30 | + | surface() |
31 | - | turtle.forward() |
31 | + | turtle.forward() |
32 | - | while getBelowNameRaw() ~= "bedrock" do |
32 | + | if turtle.detectDown() then |
33 | - | blockbelow = getBelowName() |
33 | + | blockbelow = getBelowName() |
34 | - | if blockbelow == "minecraft:lava" or blockbelow == "minecraft:flowing_lava" then |
34 | + | else |
35 | - | turtle.select(1) |
35 | + | blockbelow = "minecraft:air" |
36 | - | turtle.place() |
36 | + | end |
37 | - | turtle.refuel() |
37 | + | while getBelowNameRaw(blockbelow) ~= "minecraft:bedrock" do |
38 | - | print("Refueled. Fuel level now " .. turtle.getFuelLevel()) |
38 | + | if blockbelow == "minecraft:lava" or blockbelow == "minecraft:flowing_lava" then |
39 | - | else |
39 | + | turtle.select(1) |
40 | - | turtle.digDown() |
40 | + | turtle.place() |
41 | - | end |
41 | + | turtle.refuel() |
42 | - | for i=1,16,1 do |
42 | + | print("Refueled. Fuel level now " .. turtle.getFuelLevel()) |
43 | - | if turtle.getItemCount(i) > 0 then |
43 | + | else |
44 | - | slotname = getItemSlotName(i) |
44 | + | turtle.digDown() |
45 | - | for j=1,#deniedblocks,1 do |
45 | + | end |
46 | - | if slotname == deniedblocks[j] then |
46 | + | for i=1,16,1 do |
47 | - | print("Slot " .. i .. " has denied block (" .. slotname .. "). Ejecting...") |
47 | + | if turtle.getItemCount(i) > 0 then |
48 | - | turtle.dropUp() |
48 | + | slotname = getItemSlotName(i) |
49 | - | end |
49 | + | for j=1,#deniedblocks,1 do |
50 | - | end |
50 | + | if slotname == deniedblocks[j] then |
51 | - | end |
51 | + | print("Slot " .. i .. " has denied block (" .. slotname .. "). Ejecting...") |
52 | - | end |
52 | + | turtle.dropUp() |
53 | - | turtle.down() |
53 | + | end |
54 | - | end |
54 | + | end |
55 | - | print("Layer done!") |
55 | + | end |
56 | end | |
57 | turtle.down() | |
58 | end | |
59 | print("Layer done!") | |
60 | end |