May 30

MineCraft Turtle Code – Tree Harvester!

Well few months ago I talked about playing MineCraft and how I have been playing with the turtles within the game from the fun mod ComputerCraft. Well I am back today to show you something that I created and will be expanded on when time permits to allow for Automatic tree harvesting of any tree type in the game. Right now all the code does is allow for 4×4 trees IE Fir and Redwood. The code has changed from the first bit I created back in march to allow for the harvesting of Redwood trees and not just Fir trees.

Have fun with this code feel free to expand on this but do keep the comments within it as they are and just add-on to it. Please check back here for updates to this code and look at the git hub site on the left menu bar for the newest code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--[[
 
  Automated Tree Logger v0.4
  Created: 1/6/2013 22:10 PST
  Updated: 5/30/2013 09:00 PST
  Created By: Proopai
  Description: This program is used to automatically chop down fir trees.  It is the first step in a fully automated Wood Farming Farm.
	       This will be expanded out to allow the Turtle to dump the logs into a sorting chest and then refill fuel, bonemeal, and saplings
	       as needed.
 
  Future Features
  ---------------------------
   - Wireless Control
   - Refuling and Fuel checks
   - Item Sorting
   - Automatic Planting
   - Automatic Tree Growth
   - Ability to cut Different Tree Types
 
  2/25/2013 Update
  ---------------------------
  Placed so that if you put a chest to the left of the turtle it will drop everything off from Slot 2 on.  This might
    in the future to allow for the ability of adding saplings and bone meal to allow for automated planting and
    tree creation.  Currently the only problem is when you have to many leaves in the sky the tree will not plant.
    This currently works for all trees with 4 section bases.  I will be making a automated tree harvester for single
    trunk trees.
 
  5/30/2013 Update
  ---------------------------
  With changing of the compareUp() to detectUp() it will allow the ability to cut down any 4x4 tree.  The next update
   will have the addition of refueling and fuel level check.  Along with Redstone signaling to allow for remote monitoring
   of the turtle with a computer and redstone network.
 
--]]
 
e = 0
 
while e <= 9 do
  turtle.forward()
  e = e + 1
end
 
turtle.dig()
turtle.forward()
turtle.select(2)
turtle.turnLeft()
 
i = 0
 
while turtle.detectUp() do
  turtle.digUp()
  turtle.dig()
  turtle.up()
  i = i + 1
end
 
turtle.dig()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnLeft()
 
while i >=1 do
  turtle.dig()
  turtle.digDown()
  turtle.down()
  turtle.dig()
  i = i - 1
end
 
turtle.turnLeft()
turtle.forward(10)
turtle.turnLeft()
 
d = 0
 
while d <= 16 do
  turtle.drop(d)
end
 
turtle.turnLeft