DustyHands

mobilefurnace

Dec 29th, 2020 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. --Mining turtle carries around a furnace and makes its own charcoal
  2.  
  3. logs = turtle.getItemCount(1) --Place logs in first slot
  4. planks = turtle.getItemCount(2) --Place planks/fuel in second slot
  5.  
  6. function insertWood() --Turtle at top of furnace, puts wood and fuel in and moves down
  7.     turtle.select(1)
  8.     turtle.dropDown()
  9.     for i=1,2 do
  10.         turtle.turnRight()
  11.     end
  12.     turtle.forward()
  13.     for i=1,2 do
  14.         turtle.down()
  15.         turtle.turnLeft()
  16.     end
  17.     turtle.forward()
  18.     turtle.select(2)
  19.     turtle.dropUp()
  20. end
  21.  
  22. function returnHome() --Turtle returns to top of furnace
  23.     turtle.forward()
  24.     for i=1,2 do
  25.         turtle.up()
  26.         turtle.turnLeft()
  27.     end
  28.     turtle.forward()
  29.     for i=1,2 do
  30.         turtle.turnLeft()
  31.     end
  32. end
  33.  
  34. function placeFurnace() --Places furnace from slot 4, make sure it has 2
  35.     turtle.up()
  36.     if turtle.detect() then
  37.         turtle.back()
  38.         turtle.back()
  39.     end
  40.     turtle.select(4)
  41.     turtle.place()
  42.     turtle.up()
  43.     turtle.forward()
  44.     turtle.turnLeft()
  45.     turtle.turnLeft()
  46. end
  47.  
  48. function mineFurnace() --Mines the furnace from the top
  49.     turtle.select(4)
  50.     if turtle.compareDown() then
  51.         turtle.digDown()
  52.     end
  53.     while not turtle.detectDown() do
  54.         turtle.down()
  55.     end
  56. end
  57.  
  58. --Main code
  59.  
  60. placeFurnace()
  61. print(logs.." logs. "..planks.." planks.")
  62. insertWood()
  63. sleep(logs * 10 + 15) --Sleeps long enough for the wood to become charcoal
  64. turtle.suckUp()
  65. turtle.transferTo(16)
  66. returnHome()
  67. mineFurnace()
Advertisement
Add Comment
Please, Sign In to add comment