-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbbfarming.lua
79 lines (72 loc) · 1.43 KB
/
bbfarming.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FLAG = true
LENGTH = 18
WIDTH = 18
local function cropHandling()
local frontSuccess, frontData = turtle.inspect()
local downSuccess, downData = turtle.inspectDown()
if frontSuccess then
if frontData.name == "minecraft:bamboo" then
turtle.dig()
turtle.dig()
end
end
if downSuccess then
if downData.state.age == 3 then
turtle.digDown()
end
end
assert(turtle.forward())
end
local function fuelHandling()
local storage = "tconstruct:seared_table"
if select(2, turtle.inspect()).name == storage then
turtle.select(16)
turtle.drop()
sleep(0.5)
turtle.suck()
turtle.refuel()
turtle.getFuelLevel()
turtle.select(1)
end
end
local turns = 0
local rotations = 0
while FLAG do
if turns == LENGTH-1 then
for i = 1,LENGTH-2 do
cropHandling()
end
assert(turtle.turnLeft())
for i = 1, WIDTH-1 do
cropHandling()
end
fuelHandling()
assert(turtle.turnLeft())
for i = 1, 15 do
turtle.select(i)
turtle.drop()
end
turns = 0
rotations = 0
else
local has_block, data = turtle.inspect()
if has_block then
if data.name ~= "minecraft:bamboo" then
if rotations == 0 then
assert(turtle.turnLeft())
cropHandling()
assert(turtle.turnLeft())
rotations = rotations + 1
turns = turns + 1
elseif rotations == 1 then
assert(turtle.turnRight())
cropHandling()
assert(turtle.turnRight())
rotations = rotations - 1
turns = turns + 1
end
end
end
end
cropHandling()
end