Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("bottom")
- turtle.select(16)
- ready = {}
- turtleDir = ("Up")
- quantity = 0
- p.condenseItems()
- function getStacks()
- print("getStacks")
- for i=1, p.getInventorySize() do
- if p.getStackInSlot(i) ~= nil then
- print("not nil")
- quantity = p.getStackInSlot(i).qty
- name = p.getStackInSlot(i)["display_name"]
- print(name)
- if name == "Cobblestone" then
- if quantity == 64 then
- print("qty 64")
- table.insert(ready, i)
- count = table.getn(ready)
- print(count)
- if count == 9 then
- doCrafting()
- print("Crafting Stack")
- p.condenseItems()
- ready = {}
- getStacks()
- break
- end
- end
- end
- else
- print ("is nil")
- end
- end
- end
- function getStacksXX()
- p.condenseItems()
- for i=1, p.getInventorySize() do
- if p.getStackInSlot(i) ~= nil then
- quantity = p.getStackInSlot(i).qty
- name = p.getStackInSlot(i)["display_name"]
- print(name)
- if name ~= "Cobblestone" then
- if quantity >= 63 then
- doCraftingXX(i, quantity)
- print("Crafting Few")
- end
- else
- print("is Cobble")
- end
- end
- end
- end
- function doCrafting()
- --craftNr = math.floor(n / 9)
- --craftNr = math.floor(n / 4)
- p.pushItemIntoSlot(turtleDir,ready[1],64, 1)
- p.pushItemIntoSlot(turtleDir,ready[2],64, 2)
- p.pushItemIntoSlot(turtleDir,ready[3],64, 3)
- p.pushItemIntoSlot(turtleDir,ready[4],64, 5)
- p.pushItemIntoSlot(turtleDir,ready[5],64, 6)
- p.pushItemIntoSlot(turtleDir,ready[6],64, 7)
- p.pushItemIntoSlot(turtleDir,ready[7],64, 9)
- p.pushItemIntoSlot(turtleDir,ready[8],64, 10)
- p.pushItemIntoSlot(turtleDir,ready[9],64, 11)
- turtle.craft()
- turtle.dropDown()
- print("crafting")
- end
- function doCraftingXX(slot, n)
- craftNr = math.floor(n / 9)
- --craftNr = math.floor(n / 4)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
- p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
- turtle.craft()
- turtle.dropDown()
- end
- while true do
- ready = {}
- getStacks()
- getStacksXX()
- p.condenseItems()
- --print("waiting 1")
- --os.sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement