View difference between Paste ID: ytYKkcnW and rMSeFnr7
SHOW: | | - or go back to the newest paste.
1
dofile("denesik_lib.lua")
2-
rotateToRed("back")
2+
3
--listSide={"front","top","down",
4
--          "left","right","back"}
5
6
craft={"","r","",
7-
craft={"top","front","top",
7+
       "","d","",
8-
       "left","down","left",
8+
       "","",""}
9-
       "top","front","top"}
9+
craftSide="l"
10-
craftSlot="right"
10+
slotItemCount=64
11
12-
function isSide(side)
12+
function isRecipe()
13
  for i=1,9 do
14-
    if(craft[i]==side)then
14+
    if(craft[i]~="")then
15
      if(turtle.getItemCount(numCraftToSlot(i))==0)then
16
        return false
17
      end
18
    end
19
  end
20
  return true
21
end
22-
  if(side=="front" or 
22+
23-
     side=="right" or 
23+
function isRotate()
24-
     side=="left")then
24+
  if(craftSide=="l" or
25
     craftSide=="r" or
26-
      turtle.select(slot)
26+
     craftSide=="b")then
27-
      turtle.suck()
27+
    return true
28
  end
29
  for i=1,9 do
30-
  if(side=="top")then
30+
    if(craft[i]=="l" or
31
       craft[i]=="r" or
32-
      turtle.select(slot)
32+
       craft[i]=="b")then
33-
      turtle.suckUp()
33+
34
    end
35
  end
36-
  if(side=="down")then
36+
37
end
38-
      turtle.select(slot)
38+
39-
      turtle.suckDown()    
39+
40
  if(side=="f" or 
41
     side=="r" or 
42
     side=="l")then
43
    while(turtle.getItemCount(slot)==0)do
44
      suck(slot,slotItemCount)
45-
  if(side=="left" and isSide(side))then
45+
46
  end
47
  if(side=="t")then
48-
  if(side=="right" and isSide(side))then
48+
49-
    turtle.turnRight()
49+
      suckUp(slot,slotItemCount)
50
    end
51
  end
52
  if(side=="d")then
53-
    if(craft[i]==side)then
53+
54-
      suck_(side,slot)
54+
      suckDown(slot,slotItemCount)   
55
    end
56
  end
57-
  if(side=="left" and isSide(side))then
57+
58-
    turtle.turnRight()
58+
59-
  end  
59+
60-
  if(side=="right" and isSide(side))then
60+
  local state=false
61
  for i=1,9 do
62-
  end  
62+
63
    if(craft[i]==side and turtle.getItemCount(slot)==0)then
64
      if(state==false)then
65-
function drop_(side)
65+
        if(side=="l")then
66-
  if(side=="left")then
66+
          turtle.turnLeft()
67
        end
68
        if(side=="r")then
69-
  if(side=="right")then
69+
          turtle.turnRight()
70-
    turtle.turnRight()
70+
        end
71
        state=true
72-
  if(side=="right" or
72+
      end
73-
     side=="left" or
73+
      suck_(side,slot) 
74-
     side=="front")then
74+
75-
     turtle.drop()
75+
76
  if(state==true)then
77-
  if(side=="down")then
77+
    if(side=="l")then
78-
    turtle.dropDown()
78+
      turtle.turnRight()
79
    end  
80-
  if(side=="top")then
80+
    if(side=="r")then
81-
    turtle.dropUp()
81+
      turtle.turnLeft()
82
    end
83-
  if(side=="left")then
83+
    state=false 
84-
    turtle.turnRight()
84+
85-
  end  
85+
86-
  if(side=="right")then
86+
87
function dropToChest(side)
88
  if(side=="r" or
89
     side=="l" or
90
     side=="f")then
91
    while(turtle.getItemCount(4)~=0)do
92-
  getItemChest("front")
92+
      turtle.drop()
93-
  getItemChest("top")
93+
94-
  getItemChest("down")    
94+
95-
  getItemChest("left") 
95+
  if(side=="d")then
96-
  getItemChest("right") 
96+
    while(turtle.getItemCount(4)~=0)do
97
      turtle.dropDown()
98-
  turtle.craft()
98+
99-
  drop_(craftSlot)
99+
100
  if(side=="t")then
101
    while(turtle.getItemCount(4)~=0)do
102
      turtle.dropUp()
103
    end
104
  end	
105
end
106
107
function craftDrop(side)
108
  if(side=="l")then
109
    turtle.turnLeft()
110
    while(isRecipe())do
111
      turtle.craft()
112
      dropToChest(side)
113
    end
114
    turtle.turnRight()    
115
  end
116
  if(side=="r")then
117
    turtle.turnRight() 
118
    while(isRecipe())do
119
      turtle.craft()
120
      dropToChest(side)
121
    end
122
    turtle.turnLeft()
123
  end
124
  if(side=="d" or
125
     side=="t" or
126
     side=="f")then
127
    while(isRecipe())do
128
      turtle.craft()
129
      dropToChest(side)
130
    end
131
  end
132
end
133
134
if(isRotate())then
135
  rotateToRed("back")
136
end
137
while(true)do
138
  getItemChest("f")
139
  getItemChest("t")
140
  getItemChest("d")    
141
  getItemChest("l") 
142
  getItemChest("r") 
143
  turtle.select(4)
144
  craftDrop(craftSide)
145
end