Advertisement
BigGamingGamers

Untitled

Nov 12th, 2020 (edited)
2,469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. -- TNT --
  2.  
  3. local SLOT_COUNT = 16
  4.  
  5. function move()
  6. while(turtle.detect()) do
  7. turtle.dig()
  8. end
  9. turtle.forward()
  10. end
  11.  
  12. function checkFuel()
  13. turtle.select(1)
  14.  
  15. if(turtle.getFuelLevel() < 50) then
  16. print("Attempting Refuel...")
  17. for slot = 1, SLOT_COUNT, 1 do
  18. turtle.select(slot)
  19. if(turtle.refuel(1)) then
  20. return true
  21. end
  22. end
  23.  
  24. return false
  25. else
  26. return true
  27. end
  28. end
  29.  
  30. function getItemIndex(itemName)
  31. for slot = 1, SLOT_COUNT, 1 do
  32. local item = turtle.getItemDetail(slot)
  33. if(item ~= nil) then
  34. if(item["name"] == itemName) then
  35. return slot
  36. end
  37. end
  38. end
  39. end
  40.  
  41.  
  42. checkFuel()
  43. turtle.digDown()
  44. turtle.select(getItemIndex("minecraft:tnt"))
  45. turtle.placeDown()
  46. move()
  47. turtle.digDown()
  48. turtle.select(getItemIndex("minecraft:redstone_block"))
  49. turtle.placeDown()
  50.  
  51. for i = 1, 10, 1 do
  52. move()
  53. end
  54.  
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement