Advertisement
lhenders

ChunkPlacer

Apr 21st, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. --slot 1 reserved for fuel.
  2. --slot 2 reserved for torches
  3. --slot 3-16 reserved for cobblestone
  4. -- Designed chunk placement in FTB Infinity Skyblocks
  5. -- TESTING
  6. currentSlot = 1
  7. rowCount = 1
  8. run=1
  9.  
  10. function Refuel()
  11. print("Current Fuel Level: " .. turtle.getFuelLevel())
  12. if turtle.getFuelLevel() < 200 then
  13. turtle.select(1)
  14. while turtle.getItemCount(1) > 0 and turtle.getFuelLevel() < 200 do
  15. turtle.refuel(1)
  16. end
  17. if turtle.getFuelLevel() < 200 then
  18. print("Need Fuel! Place fuel in slot 1, 10 minimum")
  19. run=0
  20. else
  21. print("Refueled, new level" .. turtle.getFuelLevel())
  22. end
  23. end
  24. end
  25.  
  26. function Supplies()
  27. sumCount=0
  28. for i = 3, 16 do
  29. sumCount=sumCount+turtle.getItemCount(i)
  30. end
  31. if sumCount>=256 then
  32. print("New Supplies Level: " .. sumCount)
  33. else
  34. print("Need supplied to place in slot 3 through 16!")
  35. run=0
  36. end
  37. end
  38.  
  39. function Torches()
  40. if turtle.getItemCount(2)>=16 then
  41. print("Torch Level: " .. turtle.getItemCount(2))
  42. else
  43. print("Need torches placed in slot 2!")
  44. run=0
  45. end
  46.  
  47. end
  48.  
  49. function gridSupplies()
  50. Refuel()
  51. Supplies()
  52. Torches()
  53. end
  54.  
  55. function place()
  56. Supplies()
  57. if run==0 then return 0 end
  58. for i = 3, 16 do
  59. if turtle.getItemCount(i)>0 then
  60. turtle.select(i)
  61. break
  62. end
  63. end
  64. turtle.placeDown()
  65. end
  66. function placeChunk()
  67. gridSupplies()
  68. if run == 0 then return 0 end
  69.  
  70. for c=0,15 do
  71. for r=0,15 do
  72. if run==0 then return 0 end
  73. if r==0 then
  74. turtle.forward()
  75. if not (c%2==0) then
  76. turtle.forward()
  77. end
  78. end
  79.  
  80. place()
  81. if r%4==0 and c%4==0 then
  82. --needs a torch
  83. turtle.up()
  84. turtle.select(2)
  85. turtle.placeDown()
  86. turtle.forward()
  87. turtle.down()
  88. else
  89. turtle.forward()
  90. end
  91. end
  92. if c%2==0 then
  93. turtle.forward()
  94. turtle.turnRight()
  95. turtle.forward()
  96. turtle.turnRight()
  97. else
  98. -- turtle.forward()
  99. turtle.turnLeft()
  100. turtle.forward()
  101. turtle.turnLeft()
  102. end
  103. end
  104. run=run-1
  105. end
  106.  
  107. run=2
  108. while run > 0 do
  109. placeChunk()
  110. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement