Advertisement
VaMinion

block_compressor

Nov 21st, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. -- Compression program.
  2. -- Fills 3x3 grid with items and crafts.
  3. -- Intended for crafting of things like compressed cobblestone, redstone blocks, etc.
  4.  
  5. -- Algorithm:
  6. -- While able to pull stacks from above inventory:
  7.  while turtle.suckUp() do
  8.     turtle.select(16)
  9.     -- Distribute stack across 3x3 grid.
  10.         stackSize = turtle.getItemCount(16)
  11.         distSize = (stackSize-(stackSize % 9)) / 9
  12.         if stackSize >= 9 then
  13.             turtle.transferTo(1, distSize)
  14.             turtle.transferTo(2, distSize)
  15.             turtle.transferTo(3, distSize)
  16.             turtle.transferTo(5, distSize)
  17.             turtle.transferTo(6, distSize)
  18.             turtle.transferTo(7, distSize)
  19.             turtle.transferTo(9, distSize)
  20.             turtle.transferTo(10, distSize)
  21.             turtle.transferTo(11, distSize)
  22.         end
  23.         turtle.select(16)
  24.         turtle.drop()
  25.     turtle.craft()
  26.     -- Place contents of slot 16 into inventory in front of turtle.
  27.     turtle.drop()
  28.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement