SHOW:
|
|
- or go back to the newest paste.
| 1 | block, typ = turtle.inspect() | |
| 2 | ||
| 3 | -- Cut down the tree | |
| 4 | function rodung() | |
| 5 | turtle.dig() | |
| 6 | turtle.forward() | |
| 7 | while turtle.detectUp() do | |
| 8 | turtle.digUp() | |
| 9 | turtle.up() | |
| 10 | end | |
| 11 | while not turtle.detectDown() do | |
| 12 | turtle.down() | |
| 13 | end | |
| 14 | turtle.back() | |
| 15 | end | |
| 16 | ||
| 17 | --planting the sapling | |
| 18 | function pflanzen() | |
| 19 | turtle.select(16) | |
| 20 | turtle.place() | |
| 21 | turtle.select(1) | |
| 22 | end | |
| 23 | -- Warning to put saps in Slot 16 | |
| 24 | function hinweis() | |
| 25 | print("Bitte Setzlinge in Slot 16")
| |
| 26 | end | |
| 27 | ||
| 28 | hinweis() | |
| 29 | while true do | |
| 30 | -- compares the block in front with "minecraft:log" | |
| 31 | if block == true then | |
| 32 | for k,v in pairs(typ) do | |
| 33 | -- if so, do cut the tree and plant again | |
| 34 | if v == "minecraft:log" then | |
| 35 | print("Baumstamm gewachsen")
| |
| 36 | rodung() | |
| 37 | pflanzen() | |
| 38 | else | |
| 39 | -- print "no tree" and wait | |
| 40 | print("Noch kein Baum")
| |
| 41 | os.sleep(10) | |
| 42 | end | |
| 43 | end | |
| 44 | end | |
| 45 | --wait again then clear screen | |
| 46 | os.sleep(10) | |
| 47 | term.clear() | |
| 48 | term.setCursorPos(1, 1) | |
| 49 | end |