Advertisement
Goy288

EndCrystalDestroyer

Jun 23rd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. function getFrontBlock()
  2.     local blockExists, blockData = turtle.inspect()
  3.     return blockData.name
  4. end
  5.  
  6. function removeObstacle()
  7.     if turtle.detectUp() then
  8.         turtle.digUp()
  9.     end
  10. end
  11.  
  12. function reverseSteps( x, y )
  13.     for i = 1, x, 1 do
  14.        turtle.back()
  15.     end
  16.     for i = 1, y, 1 do
  17.         turtle.down()
  18.     end
  19. end
  20.  
  21. function displayError()
  22.     print("Make sure to place the turtle where it is touching and facing the center of the obsidian pillar's side.")
  23. end
  24.  
  25. local countY = 0
  26. local block = getFrontBlock()
  27. while block == "minecraft:obsidian" do
  28.     removeObstacle()
  29.     turtle.up()
  30.     countY = countY + 1
  31.     block = getFrontBlock()
  32. end
  33.  
  34. if block == "minecraft:iron_bars" then
  35.     turtle.dig()
  36. end
  37.  
  38. countX = 0
  39. block = getFrontBlock()
  40. while block == nil and countX < 10 do
  41.     turtle.forward()
  42.     countX = countX + 1
  43.     block = getFrontBlock()
  44. end
  45.  
  46. if countX < 10 and block == "minecraft:bedrock" then
  47.     turtle.attackUp()
  48. else
  49.     displayError()
  50. end
  51.  
  52. reverseSteps( countX, countY )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement