View difference between Paste ID: 0n4GCaDF and UPXAaS35
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("tillapi")
2
3
local positions = { {-3,1,2} , {-2,1,2} , {-1,1,2} ,
4
					{-3,0,2} , {-2,0,2} , {-1,0,2} ,
5
					{-3,-1,2} , {-2,-1,2} , {-1,-1,2} }
6
                    
7
local slotList = { 1,2,3,5,6,7,9,10,11}
8
9
function goCrafting(count1)
10
	tillapi.offsetGoTo(-4,1,2)
11
    turtle.select(13)
12
    turtle.place()
13
    tillapi.offsetGoTo(-4,-1,0)
14
    turtle.select(slotList[count1])
15
    while turtle.getItemCount() == 0 do
16
    	redstone.setOutput("bottom",true)
17
        sleep(1)
18
        redstone.setOutput("bottom",false)
19
        sleep(1)
20
        turtle.suckUp(1)
21-
        
21+
	end
22
    tillapi.forceMoveBack()
23-
    --tillapi.offsetGoTo(-4,1,2)
23+
24
    tillapi.forceMoveUp()
25
    tillapi.forceMoveUp()
26
    turtle.select(13)
27
    turtle.attack()
28
    local pos = positions[count1]
29
    tillapi.offsetGoTo(pos[1],pos[2],pos[3])
30
    turtle.place()
31
end
32
33-
    
33+
if fs.exists("logFile") then 
34
	local log = fs.open("logFile","r") 
35
	local pos1 = positions[tonumber(log.readLine())]
36
	if turtle.getItemCount(13) ~= 0 then
37
		tillapi.offsetGoTo(pos1[1],pos1[2],pos1[3])
38
		turtle.select(13)
39-
    tillapi.offsetGoTo(value[1],value[2],value[3])
39+
		turtle.place()
40
	else
41
		tillapi.offsetGoTo(-4,1,2)
42
    	turtle.select(13)
43
		turtle.attack()
44
    	local detail1 = turtle.getItemDetail(13)
45
    	if detail1["name"]=="minecraft:item_frame" then
46-
    	goCrafting(count0)
46+
    		turtle.place()
47
    	else
48
			tillapi.offsetGoTo(pos1[1],pos1[2],pos1[3])
49
			turtle.select(13)
50
			turtle.place()
51
		end
52
	end
53
end
54
fs.delete("logFile")
55
56
tillapi.offsetGoTo(0,0,0)
57
for k=1,16 do
58
	turtle.select(k)
59
	turtle.dropDown(64)
60
end
61
62
local count0 = 0
63
for key,value in ipairs(positions) do
64
	count0=count0+1
65
	tillapi.offsetGoTo(value[1],value[2],value[3])
66
	turtle.select(13)
67
    turtle.attack()
68
    local detail = turtle.getItemDetail(13)
69
    if detail["name"]=="minecraft:item_frame" then
70
    	turtle.place()
71
    else
72
		if fs.exists("logFile") then fs.delete("logFile") end
73
		local log = fs.open("logFile","w")
74
		log.writeLine(tostring(count0))
75
		log.flush()
76
		log.close()
77
		goCrafting(count0)
78
    end
79
end
80
81
tillapi.offsetGoTo(0,-2,1)
82
turtle.select(13)
83
turtle.suck()
84
turtle.equipRight()
85
turtle.drop()
86
turtle.select(14)
87
turtle.craft()
88
turtle.select(13)
89
turtle.suck()
90
turtle.equipRight()
91
turtle.drop()
92
tillapi.offsetGoTo(0,-1,1)
93
turtle.select(14)
94
turtle.drop()
95
if fs.exists("logFile") then fs.delete("logFile") end
96
tillapi.offsetGoTo(0,0,0)
97
tillapi.craftRefuel()