Gorocker

CobbeCraft

Apr 25th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. local function craft()
  2. fill=0
  3.     for i=1,3 do
  4.         if turtle.getItemCount(i)>0 then
  5.             fill=fill+1
  6.         end
  7.     end
  8.     for i=5,7 do
  9.         if turtle.getItemCount(i)>0 then
  10.             fill=fill+1
  11.         end
  12.     end
  13.  
  14.     for i=9,11 do
  15.         if turtle.getItemCount(i)>0 then
  16.             fill=fill+1
  17.         end
  18.     end
  19.     print("fill= "..fill)
  20.     if fill==9 then
  21.         return  turtle.craft()
  22.     else
  23.         return false
  24.     end
  25. end
  26.  
  27. local function suckUp(amount)
  28.  
  29.     for i=1,3 do
  30.         turtle.select(i)
  31.         turtle.suckUp(amount)
  32.     end
  33.     for i=5,7 do
  34.         turtle.select(i)
  35.         turtle.suckUp(amount)
  36.     end
  37.  
  38.     for i=9,11 do
  39.         turtle.select(i)
  40.         turtle.suckUp(amount)
  41.     end
  42. end
  43. local function suck(amount)
  44.  
  45.     for i=1,3 do
  46.         turtle.select(i)
  47.         turtle.suck(amount)
  48.     end
  49.     for i=5,7 do
  50.         turtle.select(i)
  51.         turtle.suck(amount)
  52.     end
  53.  
  54.     for i=9,11 do
  55.         turtle.select(i)
  56.         turtle.suck(amount)
  57.     end
  58. end
  59. local function clear()
  60.     for i=1,16 do
  61.         turtle.select(i)
  62.         turtle.drop()
  63.     end
  64. end
  65. local function clearUp()
  66.     for i=1,16 do
  67.         turtle.select(i)
  68.         turtle.dropUp()
  69.     end
  70.     turtle.select(1)
  71. end
  72. mode=0
  73. amo=64
  74. while true do
  75.     while mode==0 do
  76.         print(amo)
  77.         suck(amo)
  78.         if  craft() then
  79.             turtle.dropUp()
  80.         else
  81.             if amo==1 then
  82.                 mode=1
  83.                 amo=64
  84.             else
  85.             amo=amo/2
  86.             end
  87.         clear()
  88.         end
  89.     end
  90.     while mode==1 do
  91.         print(amo)
  92.         suckUp(amo)
  93.         if craft() then
  94.             turtle.dropUp()
  95.         else
  96.             if amo==1 then
  97.                 mode=0
  98.                 amo=64
  99.             else
  100.             amo=amo/2
  101.             end
  102.         clearUp()
  103.         end
  104.     end
  105. end
Advertisement
Add Comment
Please, Sign In to add comment