Advertisement
DuckStrom

Computercraft Infusion Stand Controller

Apr 30th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. -- direction of "right click" item inserter relative to chest
  2. iR = "east"
  3. -- direction of "entity" item inserter relative to chest
  4. iE = "west"
  5.  
  6. no_item = 0
  7. LOL_REIKA = "pcall: Reika.ChromatiCraft.Base.ItemChromaBasic.obfuscate(Lnet/minecraft/item/ItemStack;)Z"
  8. c = peripheral.find("tile_extrautils_chestmini_name")
  9.  
  10. function pushItemCount(p, dir, from_slot, count, to_slot)
  11.   remaining = count
  12.   while true do
  13.     remaining = remaining - p.pushItem(dir, from_slot, math.min(remaining,64), to_slot)
  14.     if remaining <= 0 then
  15.       break
  16.     else
  17.       sleep(0.25)
  18.     end
  19.   end
  20. end
  21.  
  22. sleep(55) -- delay in case crafting is already going
  23. while true do
  24.   no_item = 0
  25.   f, item = pcall(c.getStackInSlot, 1)
  26.  
  27.   if f == false and item == LOL_REIKA then
  28.     print("[" .. textutils.formatTime(os.time(), true) .. "] Found item stack, crafting a stack of iridescent shards...")
  29.     pushItemCount(c, iR, 1, 1, 1)
  30.     pushItemCount(c, iE, 1, 63, 1)
  31.     sleep(55)
  32.   else
  33.     no_item = math.min(no_item + 1, 10)
  34.   end
  35.  
  36.   sleep(no_item > 0 and math.min(math.pow(2,no_item),64) or 0)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement