Advertisement
RasmusStagsted

FarmBuilding

Jun 21st, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. os.loadAPI("move")
  2. os.loadAPI("inv")
  3. os.loadAPI("build")
  4.  
  5. args = {...}
  6.  
  7. dirtSlot = 1
  8. glowstoneSlot = 2
  9. lilypadSlot = 3
  10. waterSlot = 4
  11.  
  12. dirtChestSlot = 13
  13. glowstoneChestSlot = 14
  14. lilypadChestSlot = 15
  15. bucketChestSlot = 16
  16.  
  17. function buildFarm(x, z)
  18.     for i = 1, 9 * x, 1 do
  19.         for j = 1, 9 * z - 1, 1 do
  20.             if (i % 9 == 5 and j % 9 == 5) then
  21.                 build.fromSlotDown(waterSlot, bucketChestSlot, true)
  22.                 inv.export(waterSlot, bucketChestSlot)
  23.                 move.up(1)
  24.                 build.fromSlotDown(lilypadSlot, lilypadChestSlot)
  25.                 build.fromSlotUp(glowstoneSlot, glowstoneChestSlot)
  26.                 move.forward(1)
  27.                 move.down(1)
  28.             else
  29.                 build.fromSlotDown(dirtSlot, dirtChestSlot)
  30.                 if (i % 3 == 2 and j % 3 == 2) then
  31.                     move.up(1)
  32.                     build.fromSlotUp(glowstoneSlot, glowstoneChestSlot)
  33.                     move.down(1)
  34.                 end
  35.                 move.forward(1)
  36.             end
  37.         end
  38.         build.fromSlotDown(dirtSlot, dirtChestSlot)
  39.         if (i % 2 == 0) then
  40.             move.left(1)
  41.             move.forward(1)
  42.             move.left(1)
  43.         else
  44.             move.right(1)
  45.             move.forward(1)
  46.             move.right(1)
  47.         end
  48.     end
  49. end
  50.  
  51. buildFarm(args[1], args[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement