Advertisement
HappySunChild

LoopPlace.lua

Oct 2nd, 2022 (edited)
973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. local function getItem()
  2.     if not (turtle.getItemCount() > 0) then
  3.         for i = 1, 16 do
  4.             if turtle.getItemCount(i) > 0 then
  5.                 turtle.select(i)
  6.                 turtle.transferTo(1)
  7.                 turtle.select(1)
  8.                 return true
  9.             end
  10.         end
  11.     end
  12.  
  13.     return false
  14. end
  15.  
  16. while (true) do
  17.     turtle.place()
  18.  
  19.     if not (turtle.getItemCount() > 0) then
  20.         local found = getItem()
  21.        
  22.         if not found then
  23.            break
  24.         end
  25.     end
  26. end
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement