Advertisement
mathiaas

ftbPlatformer

Jan 10th, 2020 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. args = { ... }
  2.  
  3. function declareBlock()
  4.     block = turtle.getItemDetail(1)
  5.     turtle.select(1)
  6. end
  7.  
  8. function organize()
  9.     local j = 16
  10.     while j > 1 do
  11.         if (turtle.getItemCount(1) == 64) then
  12.             break
  13.         end
  14.         if  turtle.getItemDetail(j) then
  15.             local data = turtle.getItemDetail(j)
  16.             if data.name == block.name then
  17.                 turtle.select(j)
  18.                 turtle.transferTo(1)
  19.             end
  20.         end
  21.  
  22.         j = j - 1
  23.     end
  24.  
  25.     turtle.select(1)
  26. end
  27.  
  28. function path(input)
  29.     x = tonumber(input)
  30.     y = tonumber(input)
  31.  
  32.     for i = 1,x do
  33.         for j=1,y do
  34.             count = turtle.getItemCount(1)
  35.             if  count <= 1 then
  36.                 organize()
  37.             end
  38.             if turtle.placeDown() then end
  39.             if (j ~= y) then
  40.                 turtle.forward()
  41.             end
  42.         end
  43.         turn(i)
  44.     end
  45. end
  46.  
  47. function turn(direction)
  48.   if (direction % 2 == 0) then
  49.     turtle.turnRight()
  50.     turtle.back()
  51.     turtle.turnRight()
  52.   else
  53.     turtle.turnLeft()
  54.     turtle.back()
  55.     turtle.turnLeft()
  56.   end
  57. end
  58.  
  59. declareBlock()
  60. path(args[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement