Guest User

lavaElevator

a guest
Dec 6th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. function findStartingPosition()
  2.   print("Running findStartingPosition...")
  3.   repeat
  4.     if turtle.detectDown() == false then
  5.       turtle.down()
  6.     end
  7.   until turtle.detectDown() == true
  8.   repeat
  9.     if turtle.detectDown() == true then
  10.       turtle.forward()
  11.     end
  12.     isBlockFront, whatBlockFront = turtle.inspect()
  13.   until whatBlockFront.name == "minecraft:chest"
  14. end
  15.  
  16. function goToLava()
  17.   print("Running Go To Lava...")
  18.   repeat
  19.     turtle.down()
  20.     isBlockDown, whatBlockDown = turtle.inspectDown()
  21.   until whatBlockDown.name == "minecraft:log"
  22.   repeat
  23.     turtle.forward()
  24.     isBlockFront, whatBlockFront = turtle.inspect()
  25.   until whatBlockFront.name == "minecraft:chest"
  26. end
  27.  
  28.  
  29. function goToSurface()
  30.   print("Running goToSurface...")
  31.     repeat
  32.     turtle.back()
  33.     isBlockDown, whatBlockDown = turtle.inspectDown()
  34.   until whatBlockDown.name == "minecraft:log"
  35.   repeat
  36.     turtle.up()
  37.     isBlockFront, whatBlockFront = turtle.inspect()
  38.   until whatBlockFront.name == "minecraft:chest"
  39. end
  40.  
  41. function pickupLavaBuckets()
  42.   print("Running pickupLavaBuckets...")
  43.   repeat
  44.     os.sleep(2)
  45.     full = 1
  46.     for i = 1,16 do
  47.       turtle.select(i)
  48.       turtle.suck()
  49.       if turtle.getItemCount() < 1 then
  50.         full = 0
  51.       end
  52.     end
  53.   until full == 1
  54. end
  55.  
  56. function dropLavaBuckets()
  57.   print("Running dropLavaBuckets...")
  58.   repeat
  59.     isBlockFront, whatBlockFront = turtle.inspect()
  60.     print("No Chest Found")
  61.     os.sleep(1)
  62.   until whatBlockFront.name == "minecraft:chest"
  63.   repeat
  64.     empty = 1
  65.     print("Empty = 1")
  66.     for i = 1,16 do
  67.       turtle.select(i)
  68.       if turtle.getItemCount() > 0 then
  69.         slotInfo = turtle.getItemDetail()
  70.         if (slotInfo.name == "minecraft:lava_bucket") or (slotInfo.name == "minecraft:bucket") then
  71.           turtle.drop()
  72.           empty = 0
  73.           print("empty = 0")
  74.         end
  75.       end
  76.     end
  77.   until empty == 1
  78. end
  79.  
  80.  
  81. while 0==0 do
  82.   findStartingPosition()
  83.   pickupLavaBuckets()
  84.   goToSurface()
  85.   dropLavaBuckets()
  86.   goToLava()
  87. end
Advertisement
Add Comment
Please, Sign In to add comment