Advertisement
Wassaa

new package

Nov 26th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.86 KB | None | 0 0
  1. p = peripheral.wrap("bottom")
  2. turtle.select(16)
  3. ready = {}
  4. turtleDir = ("Up")
  5. quantity = 0
  6. p.condenseItems()
  7.  
  8. function getStacks()
  9.     print("getStacks")
  10.     for i=1, p.getInventorySize() do
  11.         if p.getStackInSlot(i) ~= nil then
  12.             print("not nil")
  13.             quantity = p.getStackInSlot(i).qty
  14.             name = p.getStackInSlot(i)["display_name"]
  15.             print(name)
  16.             if name == "Cobblestone" then
  17.                 if quantity == 64 then
  18.                     print("qty 64")
  19.                     table.insert(ready, i)
  20.                     count = table.getn(ready)
  21.                     print(count)
  22.                     if count == 9 then
  23.                         doCrafting()
  24.                         print("Crafting Stack")
  25.                         p.condenseItems()
  26.                         ready = {}
  27.                         getStacks()
  28.                         break
  29.                     end
  30.                 end
  31.             end
  32.         else
  33.             print ("is nil")
  34.         end
  35.     end
  36. end
  37.  
  38. function getStacksXX()
  39.     p.condenseItems()
  40.     for i=1, p.getInventorySize() do
  41.         if p.getStackInSlot(i) ~= nil then
  42.             quantity = p.getStackInSlot(i).qty
  43.             name = p.getStackInSlot(i)["display_name"]
  44.             print(name)
  45.             if name ~= "Cobblestone" then
  46.                 if quantity >= 63 then
  47.                     doCraftingXX(i, quantity)
  48.                     print("Crafting Few")
  49.                 end
  50.             else
  51.             print("is Cobble")
  52.             end
  53.         end
  54.     end
  55. end
  56.  
  57. function doCrafting()
  58.    
  59.     --craftNr = math.floor(n / 9)
  60.     --craftNr = math.floor(n / 4)
  61.     p.pushItemIntoSlot(turtleDir,ready[1],64, 1)
  62.     p.pushItemIntoSlot(turtleDir,ready[2],64, 2)
  63.     p.pushItemIntoSlot(turtleDir,ready[3],64, 3)
  64.     p.pushItemIntoSlot(turtleDir,ready[4],64, 5)
  65.     p.pushItemIntoSlot(turtleDir,ready[5],64, 6)
  66.     p.pushItemIntoSlot(turtleDir,ready[6],64, 7)
  67.     p.pushItemIntoSlot(turtleDir,ready[7],64, 9)
  68.     p.pushItemIntoSlot(turtleDir,ready[8],64, 10)
  69.     p.pushItemIntoSlot(turtleDir,ready[9],64, 11)
  70.     turtle.craft()
  71.     turtle.dropDown()
  72.     print("crafting")
  73. end
  74.  
  75. function doCraftingXX(slot, n)
  76.     craftNr = math.floor(n / 9)
  77.     --craftNr = math.floor(n / 4)
  78.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
  79.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
  80.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
  81.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
  82.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
  83.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
  84.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
  85.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
  86.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
  87.     turtle.craft()
  88.     turtle.dropDown()
  89. end
  90.  
  91. while true do
  92.     ready = {}
  93.     getStacks()
  94.     getStacksXX()
  95.     p.condenseItems()
  96.     --print("waiting 1")
  97.     --os.sleep(0)
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement