daily pastebin goal
8%
SHARE
TWEET

cobblestonebot.lua

sanderronde Jan 10th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function is_facing_name(str)
  2.     local success, data = turtle.inspect()
  3.     if not success then
  4.         return false
  5.     end
  6.     if data.name == str then
  7.         return true
  8.     end
  9.     return false
  10. end
  11.  
  12. local function mine()
  13.     print("mining")
  14.     while not is_facing_name("minecraft:cobblestone") do
  15.         print("not facing it")
  16.         sleep(1)
  17.     end
  18.     turtle.dig()
  19. end
  20.  
  21. local function clear_inventory()
  22.     print("Clearing inventory")
  23.     for s = 1, 16 do
  24.         turtle.select(s)
  25.         if turtle.getItemCount() < 64 then
  26.             return
  27.         end
  28.     end
  29.     print("not not empty")
  30.  
  31.     turtle.turnRight()
  32.     for s = 1, 16 do
  33.         turtle.select(s)
  34.         if not turtle.drop(64) then
  35.             print("Dumping chest is full")
  36.             while not turtle.drop(64) do
  37.                 sleep(5)
  38.             end
  39.         end
  40.     end
  41.     turtle.turnLeft()
  42. end
  43.  
  44. local function start()
  45.     while true do
  46.         clear_inventory()
  47.         mine() 
  48.     end
  49. end
  50.  
  51. local function init()
  52.     start()
  53. end
  54.  
  55. init()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top