4ndertheker

FTB-Turtle: Treefarm ohne Bonemeal

May 2nd, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. x=0
  2.  
  3. local function start()
  4.     turtle.select(1)
  5.     if turtle.compareTo(16)==false then
  6.         print("Bitte sicherstellen, dass Saplings in Slot 1 und Vergleichssapling in Slot 16 liegen und [Enter] druecken.")
  7.         io.read()
  8.         return
  9.     end
  10.     if turtle.getItemCount(2)<1 then
  11.         print("Bitte mindestens einen Vergleichsbaumstamm in Slot 2 legen und [Enter] druecken.")
  12.         io.read()
  13.         return
  14.     end
  15. end
  16.  
  17. local function plant()
  18.     turtle.select(1)
  19.     if turtle.getItemCount(1)<=1 then
  20.         print("Bitte Saplings in Slot 1 nachfuellen.")
  21.         io.read()
  22.         return
  23.     end
  24.     turtle.place() 
  25. end
  26.  
  27. local function wait()
  28.     turtle.select(2)
  29.      if turtle.getItemCount(2)<1 then
  30.         print("Bitte mindestens einen Vergleichsbaumstamm in Slot 2 legen und [Enter] druecken.")
  31.     io.read()
  32.     return
  33.     end
  34.     while turtle.compare()==false do
  35.         sleep(2)
  36.     end
  37. end
  38.  
  39. local function tree()
  40.     turtle.select(2)
  41.     while turtle.compare()==true do
  42.         turtle.dig()
  43.         turtle.digUp()
  44.         turtle.up()
  45.     end
  46.     while turtle.detectDown()==false do
  47.         turtle.down()
  48.     end
  49.     x=x+1
  50.     term.clear()
  51.     term.setCursorPos(1, 1)
  52.     print("Es wurden bisher ", x, " Baeume gefaellt.")
  53. end
  54.  
  55. local function drop()
  56.     turtle.turnRight()
  57.     turtle.select(2)
  58.     if turtle.getItemCount(2)>1 then
  59.         turtle.drop(turtle.getItemCount(2)-1)
  60.     end
  61.  
  62.     for i=3, 15, 1 do
  63.         turtle.select(i)
  64.         turtle.drop()
  65.     end
  66.     turtle.turnLeft()
  67. end
  68.  
  69. --------------------------
  70.  
  71. start()
  72.  
  73. while true do
  74.     plant()
  75.     wait()
  76.     tree()
  77.     drop()
  78. end
Advertisement
Add Comment
Please, Sign In to add comment