Advertisement
Kapiep

Lua CC Miner

Nov 24th, 2022 (edited)
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. function initiate()
  2.     term.clear()
  3.     turtle.select(1)
  4.     turtle.refuel(3)
  5.     textOutput("Slot 1: Coal", 1, 4, 0)
  6.     textOutput("Slot 2: Cobblestone", 1, 5, 0)
  7.     textOutput("Slot 3: Torches", 1, 6, 0)
  8.     textOutput("Slot 4: Chests", 1, 7, 0)
  9.     textOutput("Enjoy!", 1, 10, 0)
  10. end
  11.  
  12. function textOutput(output_message, x_screen_pos, z_screen_pos, clear_area)
  13.     term.setCursorPos(x_screen_pos, z_screen_pos)
  14.     if clear_area == 0 then
  15.         clear_area = string.len(output_message)
  16.     end
  17.     write(output_message .. string.rep(" ", (clear_area - string.len(output_message))))
  18. end
  19.  
  20. function CheckFuel()
  21.     if turtle.getFuelLevel() < 500 then
  22.         turtle.refuel(5)
  23.     end
  24. end
  25.  
  26. function customMiningScheme()
  27.     turtle.dig()
  28.     turtle.forward()
  29.     turtle.digUp()
  30.     turtle.up()
  31.     turtle.digUp()
  32.     turtle.down()
  33. end
  34.  
  35. function Hammer()
  36.     if turtle.detectDown() == false then
  37.         turtle.select(2)
  38.         turtle.placeDown()
  39.     end
  40.     customMiningScheme()
  41. end
  42.  
  43. function placeTorch()
  44.     turtle.turnRight()
  45.     turtle.turnRight()
  46.     turtle.select(4)
  47.     turtle.place()
  48.     turtle.turnRight()
  49.     turtle.turnRight()
  50. end
  51.  
  52. function excavation()
  53.     placeTorch()
  54.     i = 1
  55.     while (i < 10) do
  56.         Hammer()
  57.         i = i + 1
  58.     end
  59. end
  60.  
  61. function start()
  62.     initiate()
  63.     while true do
  64.         CheckFuel()
  65.         excavation()
  66.     end
  67. end
  68.  
  69. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement