Guest User

Mana

a guest
Jul 14th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. rednet.open("right")
  2. -- c is the chest of mana beans
  3. local c = peripheral.wrap("bottom")
  4. -- a is the aspectylizer
  5. local a = peripheral.wrap("front")
  6. -- f is the furnace
  7. local f = peripheral.wrap("front")
  8. local redstoneDir = "back"
  9. --Added this incase you are pastebinning the code
  10. local beans = {}
  11.  
  12. function scanSlot(slot)
  13.     c.pushItem("up", slot,1)
  14.     turtle.drop()
  15.     data = a.getAspects()
  16.     beans[data] = slot
  17.     turtle.suck()
  18.     c.pullItemIntoSlot("up", 1, 1,slot)
  19. end  
  20.  
  21. function scanSlots()
  22.    redstone.setOutput(redstoneDir, true)
  23.    for i = 1, 55 do
  24.       if c.getStackInSlot(i) then
  25.          scanSlot(i)
  26.       end
  27.    end
  28.    redstone.setOutput(redstoneDir, false)
  29. end
  30.  
  31. function essentia(aspect, numAspect)
  32.    if not f.getStackInSlot(1) then
  33.       c.pushItemIntoSlot("up", beans[aspect], numAspect,1)
  34.       redstone.setOutput("left", true)
  35.       sleep(1)
  36.       redstone.setOutput("left", false)
  37.       sleep(3)
  38.       --f.pullItemIntoSlot("down", 1, numAspect,1)  
  39.    end
  40.    while f.getStackInSlot(1) do
  41.       print("Waiting for empty furnace....")
  42.       sleep(3)
  43.    end
  44. --   sleep(15)
  45. end
  46.  
  47. function awaitRednet()
  48.   local id, msg, dist = rednet.receive()
  49. --  term.write(msg)
  50.   local essData = {}
  51.   essData = textutils.unserialize(msg)
  52.   print(essData[1]..":"..essData[2])
  53.   essentia(essData[1], essData[2])
  54.   rednet.send(id, "Complete")
  55. end
  56.  
  57. scanSlots()
  58. while true do
  59.    awaitRednet()
  60. end
  61. --essentia("lucrum", 1)
Advertisement
Add Comment
Please, Sign In to add comment