Place Auto

Jan 13th, 2021 (edited)
358
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1.
2. local inputs = {...}
3.
4. local x = 2--inputs[1]
5. local y = 4--inputs[2]
6.
7. local left = 0
8.
9. local function findBlock()
10.     if left > 0 then return true end
11.     for i = 1, 16 do
12.         local ins = turtle.getItemDetail(i)
13.         if ins and (ins.name == "minecraft:dark_oak_log" or ins.name == "minecraft:stone") then
14.             turtle.select(i)
15.             left = ins.count
16.             return true
17.         end
18.     end
19.     return false
20. end
21.
22. if not findBlock() then
23.     error("No blocks given")
24. end
25.
26. turtle.placeDown()
27. left = left - 1
28.
29. local function step()
30.     turtle.forward()
31.     if not turtle.detectDown() then
32.         turtle.placeDown()
33.         left = left - 1
34.         if not findBlock() then error("No blocks left") end
35.     end
36. end
37.
38. for i = 1, x do
39.     for j = 1, 3 * y - 1 do
40.         step()
41.     end
42.     turtle.turnRight()
43.     step()
44.     step()
45.     turtle.turnRight()
46.     for j = 1, 3 * y - 1 do
47.         step()
48.     end
49.     if i ~= x then
50.         turtle.turnLeft()
51.         step()
52.         turtle.turnLeft()
53.     end
54. end
55.
56. turtle.turnRight()
57.
58. for i = 1, 3 * x - 2 do
59.     step()
60. end
61.
62. turtle.turnRight()
63.
64. for i = 1, x do
65.     for j = 1, 3 * (y - 1) do
66.         step()
67.     end
68.
69.     if i % 2 == 1 then
70.         turtle.turnRight()
71.     else
72.         turtle.turnLeft()
73.     end
74.
75.     step()
76.     step()
77.     step()
78.
79.     if i % 2 == 1 then
80.         turtle.turnRight()
81.     else
82.         turtle.turnLeft()
83.     end
84. end
RAW Paste Data