Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to cut down a tree
- function cutTree()
- turtle.dig() -- Dig the block in front
- turtle.forward() -- Move forward
- while turtle.detectUp() do
- turtle.digUp() -- Dig the block above if it exists
- turtle.up() -- Move up
- end
- while not turtle.detectDown() do
- turtle.down() -- Move down until reaching the ground
- end
- turtle.back() -- Move back to the starting position
- end
- -- Function to plant an oak sapling
- function plantSapling()
- turtle.select(1) -- Select the slot with oak saplings
- turtle.place() -- Place the sapling on the ground
- end
- -- Main program
- turtle.select(1) -- Select the slot with oak saplings (assuming it's in slot 1)
- while true do
- -- Check if there's a tree in front
- while turtle.detect() do
- cutTree() -- Cut down the tree
- end
- -- Plant a sapling and wait for it to grow
- plantSapling() -- Plant an oak sapling
- print("Waiting for the sapling to grow...")
- os.sleep(600) -- Wait for 10 minutes (adjust as needed)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement