View difference between Paste ID: DNCzMYC1 and CkauUM2q
SHOW: | | - or go back to the newest paste.
1-
local numSapling = 0
1+
local digDepth = 32
2-
local saplingSlot = 15
2+
local digWidth = 7
3
local torchSpacing = 4
4-
local success, tree = turtle.inspect()
4+
local currentDepth = torchSpacing - 1
5
local digHeight = 12
6
local chestSlot = 14
7
local torchSlot = 15
8-
	if turtle.getFuelLevel() < 80 then
8+
9
10-
		turtle.refuel(1)
10+
11
function checkFuel()
12
	if turtle.getFuelLevel() < 120 then
13
		turtle.select(fuelSlot)
14
		turtle.refuel(2)
15-
function plantSapling()
15+
16-
	turtle.select(saplingSlot)
16+
17
end
18
19
function checkInv()
20
  if turtle.getItemCount(11) > 0 then
21-
function dance()
21+
    goAround()
22-
	turtle.turnLeft()
22+
    turtle.select(chestSlot)
23-
	turtle.turnRight()
23+
    while turtle.place() == false do
24-
	turtle.turnLeft()
24+
      turtle.dig()
25-
	turtle.turnRight()
25+
      turtle.attack()
26-
	turtle.turnLeft()
26+
    end
27-
	turtle.turnRight()
27+
    for i = 1, 13 do
28
      turtle.select(i)
29
      turtle.drop()
30-
function checkTree()
30+
    end
31-
	while tree.name == "minecraft:birch_sapling" do
31+
    goAround()
32-
		turtle.turnLeft()
32+
    turtle.select(1)
33-
	  success, tree = turtle.inspect()
33+
  end
34
end
35-
	cutTree()
35+
36
function placeTorch()
37
	turtle.select(torchSlot)
38-
function cutTree()
38+
  goAround()
39-
	turtle.dig()
39+
40-
	turtle.forward()
40+
  goAround()
41-
	while turtle.inspectUp() == true do
41+
42-
		turtle.digUp()
42+
43-
		turtle.up()
43+
44
function goForward(times)
45-
	while turtle.inspectDown() == false do
45+
  for i = 1, times do
46-
		turtle.down()
46+
    while turtle.forward() == false do
47
      turtle.attack()
48-
	turtle.back()
48+
      turtle.dig()
49-
	plantSapling()
49+
    end
50-
	success, tree = turtle.inspect()
50+
51
    if i == 4 and currentDepth == torchSpacing then
52
      placeTorch()
53-
function countSaplings()
53+
      currentDepth = 0
54-
	numSapling = turtle.getItemCount(saplingSlot)
54+
    end
55
56
  end
57
end
58-
	countSaplings()
58+
59-
	for i = 1, numSapling do
59+
function goAround()
60
  for i = 1, 2 do
61-
		checkTree()
61+
    turtle.turnLeft()
62
  end
63
end
64
65
function goUp()
66
  while turtle.up() == false do
67
    turtle.attackUp()
68
    turtle.digUp()
69
  end
70
end
71
72
function goDown(times)
73
  for i = 1, times do
74
    while turtle.down() == false do
75
      turtle.attackDown()
76
      turtle.digDown()
77
    end
78
  end
79
end
80
81
function digMine()
82
83
  local currentHeight = 1
84
  goForward(1)
85
  currentDepth = currentDepth + 1
86
  turtle.turnLeft()
87
88
  for i = 1, digHeight do
89
    goForward(digWidth -1)
90
    goAround()
91
    if currentHeight ~= digHeight then
92
      goUp()
93
      currentHeight = currentHeight + 1
94
    end
95
  end
96
97
  goDown(currentHeight -1)
98
  turtle.turnRight()
99
100
end
101
102
103
104
function turtleStart()
105
	for i = 1, digDepth do
106
		checkFuel()
107
    checkInv()
108
    digMine()
109
	end
110
end
111
112
turtleStart()