Guest User

craft

a guest
Nov 13th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. dofile("denesik_lib.lua")
  2. rotateToRed("back")
  3.  
  4. --listSide={"front","top","down",
  5. --          "left","right","back"}
  6.  
  7. craft={"top","front","top",
  8.        "left","down","left",
  9.        "top","front","top"}
  10. craftSlot="right"
  11.  
  12. function isSide(side)
  13.   for i=1,9 do
  14.     if(craft[i]==side)then
  15.       return true
  16.     end
  17.   end
  18.   return false
  19. end
  20.  
  21. function suck_(side,slot)
  22.   if(side=="front" or
  23.      side=="right" or
  24.      side=="left")then
  25.     while(turtle.getItemCount(slot)==0)do
  26.       turtle.select(slot)
  27.       turtle.suck()
  28.     end
  29.   end
  30.   if(side=="top")then
  31.     while(turtle.getItemCount(slot)==0)do
  32.       turtle.select(slot)
  33.       turtle.suckUp()
  34.     end
  35.   end
  36.   if(side=="down")then
  37.     while(turtle.getItemCount(slot)==0)do
  38.       turtle.select(slot)
  39.       turtle.suckDown()    
  40.     end
  41.   end
  42. end
  43.  
  44. function getItemChest(side)
  45.   if(side=="left" and isSide(side))then
  46.     turtle.turnLeft()
  47.   end
  48.   if(side=="right" and isSide(side))then
  49.     turtle.turnRight()
  50.   end
  51.   for i=1,9 do
  52.     slot = numCraftToSlot(i)
  53.     if(craft[i]==side)then
  54.       suck_(side,slot)
  55.     end
  56.   end
  57.   if(side=="left" and isSide(side))then
  58.     turtle.turnRight()
  59.   end  
  60.   if(side=="right" and isSide(side))then
  61.     turtle.turnLeft()
  62.   end  
  63. end
  64.  
  65. function drop_(side)
  66.   if(side=="left")then
  67.     turtle.turnLeft()
  68.   end
  69.   if(side=="right")then
  70.     turtle.turnRight()
  71.   end
  72.   if(side=="right" or
  73.      side=="left" or
  74.      side=="front")then
  75.      turtle.drop()
  76.   end
  77.   if(side=="down")then
  78.     turtle.dropDown()
  79.   end
  80.   if(side=="top")then
  81.     turtle.dropUp()
  82.   end
  83.   if(side=="left")then
  84.     turtle.turnRight()
  85.   end  
  86.   if(side=="right")then
  87.     turtle.turnLeft()
  88.   end
  89. end
  90.  
  91. while(true)do
  92.   getItemChest("front")
  93.   getItemChest("top")
  94.   getItemChest("down")    
  95.   getItemChest("left")
  96.   getItemChest("right")
  97.   turtle.select(4)
  98.   turtle.craft()
  99.   drop_(craftSlot)
  100. end
Advertisement
Add Comment
Please, Sign In to add comment