craniumkid22

chestScanner

Sep 6th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. --table of frequencies that have had items
  2. local hotlist = { }
  3.  
  4. --return a color based on a number 0 - 15
  5. local function returnCol(key)
  6.     return 2 ^ (key - 1)
  7. end
  8.  
  9. for _,name in pairs(peripheral.getNames()) do
  10.     if peripheral.getType(name) == "ender_chest" then
  11.         chest = peripheral.wrap(name)
  12.         for i = 1, #hotlist do
  13.             chest.setFrequency(hotlist[i][1], hotlist[i][2], hotlist[i][3])
  14.             if #chest.getAllStacks() < 0 then
  15.                 local hit = {first, middle, last}
  16.                 table.insert(hotlist, hit)
  17.                 for i = 1, 16 do
  18.                     chest.pushItem("up", i, 64)
  19.                 end
  20.             end
  21.         end
  22.         for first = 0, 16 do
  23.             for middle = 0, 16 do
  24.                 for last = 0, 16 do
  25.                     chest.setFrequency(returnCol(first), returnCol(middle), returnCol(last))
  26.                     if #chest.getAllStacks() < 0 then
  27.                         local hit = {first, middle, last}
  28.                         table.insert(hotlist, hit)
  29.                         for i = 1, 16 do
  30.                             chest.pushItem("up", i, 64)
  31.                         end
  32.                     end
  33.                 end
  34.             end
  35.         end
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment