This is the code:
local w,h = term.getSize()
local direction = "left"
local bonemeal = "Bonemeal<slot 3>: "..turtle.getItemCount(3)
local sapling = "Sapling: "..turtle.getItemCount(2)
local wood = "Wood: "..turtle.getItemCount(1)
local function Left()
turtle.turnLeft()
end
local function Right()
turtle.turnRight()
end
local function harvest()
for i = 1, 4 do
turtle.forward()
end
Left()
turtle.select(3)
for i = 1, 8 do
turtle.place()
end
turtle.select(1)
for i = 1, 6 do
turtle.dig()
turtle.digUp()
turtle.up()
end
for i = 1, 6 do
turtle.down()
end
turtle.select(2)
turtle.place()
Left()
for i = 1, 4 do
turtle.forward()
end
for i = 1, 2 do
Left()
end
end
local function checkBoneMeal()
if turtle.getItemCount(3) < 32 and turtle.getItemCount(3) > 20then
for i = 4, 11 do
turtle.select(i)
turtle.transferTo(i - 1, 32)
end
elseif turtle.getItemCount(3) <= 20 then
turtle.up()
Right()
turtle.forward()
for i = 3, 11 do
turtle.select(i)
turtle.suck()
end
Left()
Left()
turtle.forward()
Right()
turtle.down()
end
turtle.select(1)
end
local function checkWood()
if turtle.getItemCount(1) > 30 then
Right()
Right()
turtle.select(1)
turtle.drop(64)
turtle.select(12)
turtle.drop(64)
Right()
Right()
end
end
local function checkSap()
if turtle.getItemCount(2) < 32 then
Right()
turtle.forward()
turtle.suck()
Left()
Left()
turtle.forward()
Right()
end
end
local function allProcess()
checkBoneMeal()
checkSap()
harvest()
end
local function main()
rednet.open("right")
while true do
local wood = "Wood: "..turtle.getItemCount(1)
local bonemeal = "Bonemeal<slot 3>: "..turtle.getItemCount(3)
local sapling = "Sapling: "..turtle.getItemCount(2)
local fuelLevel = "Fuel Level: "..turtle.getFuelLevel()
term.clear()
term.setCursorPos(1,1)
print(wood)
print(bonemeal)
print(sapling)
print(fuelLevel)
senderID, message = rednet.receive()
if message == "on" then
allProcess()
end
end
end
main()