SHARE
TWEET

Untitled

a guest Nov 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ME_ = component.me_controller
  2. IT_ = ME_.getItemsInNetwork
  3. CR_ = ME_.getCraftables
  4.  
  5. Q_=require("qlib")
  6.  
  7. local X = {}
  8.  
  9. function siftItems(s, v)
  10.   v = v or true
  11.   local t = IT_()
  12.   local r = {}
  13.   local ri, ti, e, l
  14.   ri, ti = 1, 1
  15.   while t[ti] ~= nil do
  16.     e = t[ti]
  17.     l = e.label
  18.     if string.find(string.lower(l), s) ~= nil then
  19.       r[ri] = {ri, ti, l, e.size}
  20.       ri = ri + 1
  21.     end
  22.     ti = ti + 1
  23.   end
  24.   if v then Q_.aprint(r) end
  25.   return r
  26. end
  27. X.siftItems = siftItems
  28.  
  29. function siftCraftables(s, v)
  30.   v = v or true
  31.   local t = CR_()
  32.   local r = {}
  33.   local ri, ti, e, l
  34.   ri, ti = 1, 1
  35.   while t[ti] ~= nil do
  36.     e = t[ti].getItemStack()
  37.     l = e.label
  38.     if string.find(string.lower(l), s) ~= nil then
  39.       r[ri] = {ri, ti, l, e.size}
  40.       ri = ri + 1
  41.     end
  42.     ti = ti + 1
  43.   end
  44.   if v then Q_.aprint(r) end
  45.   return r
  46. end
  47. X.siftCraftables = siftCraftables
  48.  
  49. return X
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top