Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile("denesik_lib.lua")
- --listSide={"front","top","down",
- -- "left","right","back"}
- -- 1 2 3 4 5
- ct={1,2,3,4,5}
- cd={6,7,8,9,10}
- craft={ct[1],ct[1],ct[1],
- ct[1],ct[1],ct[1],
- ct[1],ct[1],ct[1]}
- slotItemCount=64
- slotFuel=cd[5]
- function isRecipe()
- for i=1,9 do
- if(craft[i]~=0)then
- if(turtle.getItemCount(numCraftToSlot(i))==0)then
- return false
- end
- end
- end
- return true
- end
- function forward()
- for i=1,5 do
- turtle.forward()
- end
- end
- function _suckUp(n)
- for i=1,9 do
- slot=numCraftToSlot(i)
- if(craft[i]==n and turtle.getItemCount(slot)==0)then
- while(turtle.getItemCount(slot)==0)do
- suckUp(slot,slotItemCount)
- end
- end
- end
- end
- function _suckDown(n)
- for i=1,9 do
- slot=numCraftToSlot(i)
- if(craft[i]==n and turtle.getItemCount(slot)==0)then
- while(turtle.getItemCount(slot)==0)do
- suckDown(slot,slotItemCount)
- end
- end
- end
- end
- function refuel()
- if(turtle.getFuelLevel()<=20)then
- chest=slotFuel
- if(slotFuel>5)then
- chest=slotFuel-5
- end
- for i=1,chest-1 do
- turtle.back()
- end
- turtle.select(8)
- while(turtle.getFuelLevel()<=20)do
- if(slotFuel>5)then
- turtle.suckDown()
- else
- turtle.suckUp()
- end
- turtle.refuel()
- end
- forward()
- end
- end
- forward()
- while true do
- refuel()
- for i=1,5 do
- _suckUp(ct[i])
- _suckDown(cd[i])
- if(isRecipe())then
- break
- end
- turtle.back()
- end
- forward()
- turtle.select(4)
- while(isRecipe())do
- turtle.craft()
- while(turtle.getItemCount(4)~=0)do
- turtle.drop()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement