Advertisement
HarvDad

obsidian

Jun 6th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. -- obsidian
  2. -- Generate obsidian blocks from redstone dust
  3. -- Version: Rev 0.1
  4.  
  5. message1 = "Place redstone dust in slot 1"
  6. message2 = "Place bucket of lava in slot 6"
  7. usage = "obsidian (No arguments)"
  8.  
  9. args = {...}
  10. nArgs = #args
  11.  
  12. function forward(nBlocks)
  13. for i=1,nBlocks do
  14. turtle.forward()
  15. end
  16. end
  17.  
  18. function back(nBlocks)
  19. for i=1,nBlocks do
  20. turtle.back()
  21. end
  22. end
  23.  
  24. function placeRedstone()
  25. back(3)
  26. turtle.select(1)
  27. for i=1,7 do
  28. turtle.placeDown()
  29. forward(1)
  30. end
  31. back(3)
  32. end
  33.  
  34. function mineObsidian()
  35. back(3)
  36. turtle.select(5)
  37. for i=1,3 do
  38. turtle.digDown()
  39. forward(1)
  40. end
  41. forward(1)
  42. for i=1,3 do
  43. turtle.digDown()
  44. forward(1)
  45. end
  46. back(3)
  47. end
  48.  
  49. function employLava()
  50. turtle.up()
  51. turtle.select(16)
  52. turtle.placeDown()
  53. sleep(8)
  54. turtle.placeDown()
  55. sleep(3)
  56. turtle.down()
  57. end
  58.  
  59. function offloadObsidian()
  60. turtle.up()
  61. turtle.turnLeft()
  62. if turtle.detect() then
  63. turtle.select(5)
  64. turtle.drop()
  65. end
  66. turtle.down()
  67. turtle.turnRight()
  68. end
  69.  
  70. if nArgs > 0 then
  71. print(message1)
  72. print(message2)
  73. print(usage)
  74. end
  75.  
  76. while true do
  77. if turtle.getItemCount(1) < 6 then
  78. break
  79. end
  80. placeRedstone()
  81. employLava()
  82. mineObsidian()
  83. offloadObsidian()
  84. end
  85.  
  86. print("Redstone count is below 6.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement