BioPrince

Turtle world eater NO ENDERCHEST

Mar 12th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- pastebin get FFpY2V5c worldeater
  2.    
  3. i = 0
  4. block = "false"
  5. data = "false"
  6. height = 0
  7. ---------------------
  8. function bottom() --bottom out to find y level
  9.   height = 0
  10.   while true do
  11.     block,data = turtle.digDown()
  12.       if data == "Unbreakable block detected" then
  13.         break
  14.       end
  15.     while turtle.dig() do
  16.     end
  17.     height = height + 1
  18.     turtle.down()
  19.   end
  20. end
  21. -----------------------
  22. function empty() -- place soryn chest and empty. this function is run after clear()
  23.   while turtle.dig() do
  24.     sleep(.2)
  25.   end
  26.   while turtle.digUp() do
  27.     sleep(.2)
  28.   end
  29.   turtle.turnRight()
  30.   turtle.turnRight()
  31.   while turtle.dig() do
  32.     sleep(.3)
  33.   end
  34.   turtle.select(16)
  35.   turtle.place()
  36.   for i = 1, 14 do
  37.     turtle.select(i)
  38.     turtle.drop()
  39.   end
  40.   turtle.turnRight()
  41.   turtle.turnRight()
  42.   turtle.select(1)
  43.   while turtle.dig() do
  44.     sleep(.2)
  45.   end
  46.   turtle.forward()
  47.   while turtle.dig() do
  48.     sleep(.2)
  49.   end
  50.   turtle.forward()
  51. end
  52.  
  53. -----------------------
  54. function turtleRefuel()
  55.   if turtle.getFuelLevel() < 5000 then
  56.   for i=1,14 do
  57.     turtle.select(i)
  58.     turtle.refuel()
  59.     turtle.select(1)
  60.   end
  61.   end
  62. end
  63. -----------------------
  64. function lowFuel() -- checks for low fuel and waits if at top of loop
  65.   if turtle.getFuelLevel() < 200 then
  66.   turtle.select(15)
  67.   turtle.refuel(turtle.getItemCount(15)-1)
  68.   turtle.select(1)
  69.   print("WARNING: Low Fuel")
  70.   if yLevel > height then
  71.     print("Waiting for fuel")
  72.     os.pullEvent("turtle_inventory")
  73.   end
  74.   end
  75. end
  76. ---------------------
  77. function self()
  78.   turtleRefuel()
  79.   lowFuel()
  80.   lowFuel()
  81.   turtle.getFuelLevel()
  82. end
  83. --------------------
  84. function minerUp() -- bottom to top mining
  85.   for i=1,height do
  86.   while turtle.digUp() do
  87.     sleep(.2)
  88.   end
  89.   while turtle.dig() do
  90.     sleep(.2)
  91.   end
  92.   turtle.up()
  93.   end
  94. end
  95. -------------------
  96. function inventory() -- check for fuel and enderchest
  97.   print("fuel in slot 15")
  98.   print("64x chests in slot 16")
  99.   turtle.dig() --just in case it is placed before a restart
  100.   while turtle.getItemCount(16) == 0 do
  101.     os.pullEvent("turtle_inventory")
  102.   end
  103. end
  104. --------------------
  105. -- Main function
  106. -- start with going to bedrock
  107.  
  108. inventory()
  109. -- the turtle miner is now ready
  110.  
  111. while turtle.getItemCount(16) > 1 do
  112. bottom()
  113. self()-- fuel check
  114. empty()-- place chest, empty, "leave" chest, move into postion
  115.   print("Mining Up")
  116. minerUp()
  117. self()-- fuel check
  118. empty()-- place chest, empty, "leave" chest, move into postion
  119.   print("Mining Down")
  120. end
Advertisement
Add Comment
Please, Sign In to add comment