-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfarmcc2.lua
More file actions
82 lines (77 loc) · 1.63 KB
/
farmcc2.lua
File metadata and controls
82 lines (77 loc) · 1.63 KB
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
80
81
82
size = 14*14 --Used for fuel requirement
R_MRK = "minecraft:stone"
L_MRK = "minecraft:cobblestone"
function justRefuel()
if turtle.getFuelLevel() < size+30 then
turtle.turnLeft()
turtle.select(2)
turtle.suck()
turtle.refuel()
turtle.select(1)
turtle.turnRight()
end
end
function tryHarvest()
local res,block = turtle.inspectDown()
if res and block.metadata == 7 then
turtle.digDown()
end
turtle.placeDown()
end
function unload()
for i=2,16 do
turtle.select(i)
turtle.dropDown()
end
turtle.select(1)
end
function reposition()
local res, block = turtle.inspect()
if res and block.name == "minecraft:chest" then
unload()
turtle.turnRight()
return
end
turtle.turnRight()
local ri, val = turtle.inspect()
turtle.turnLeft()
if ri then
turtle.forward()
turtle.turnLeft()
end
turtle.turnLeft()
local le, val = turtle.inspect()
turtle.turnRight()
if le and val.name ~= "minecraft:chest" then
turtle.forward()
turtle.turnRight()
end
end
function begin()
reposition()
while true do
justRefuel()
while turtle.forward() do
tryHarvest()
end
local res, block = turtle.inspect()
if res and block.name == R_MRK then
turtle.turnRight()
turtle.forward()
tryHarvest()
turtle.turnRight()
elseif res and block.name == L_MRK then
turtle.turnLeft()
turtle.forward()
tryHarvest()
turtle.turnLeft()
elseif res and block.name == "minecraft:planks" then
turtle.turnRight()
while turtle.forward() do end
turtle.turnRight()
unload()
sleep(60*60)
end
end
end
begin()