Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function makeTree()
- if turtle.getItemCount(1)==0 then
- print("Not enough Saplings.")
- return
- end
- if turtle.getItemCount(2)==0 then
- print("Not enough BoneMeal.")
- return
- end
- turtle.select(1)
- turtle.place()
- sleep(1)
- turtle.select(2)
- turtle.place()
- sleep(1)
- end
- function fuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(16)
- turtle.refuel(1)
- print("Fuel less than 10, refueling.")
- sleep(2)
- return
- elseif turtle.getFuelLevel() == "unlimited" then
- print("This turtle does not use fuel to move")
- sleep(2)
- return
- end
- end
- function resetPos()
- print("Resetting position.")
- sleep(2)
- r=0
- while r==0 do
- fuel()
- turtle.down()
- if turtle.detectDown()==true then
- r=1
- end
- end
- turtle.back()
- end
- function cutTree()
- sleep(2)
- fuel()
- print("Cutting Tree.")
- sleep(2)
- turtle.dig()
- turtle.forward()
- y=1
- while y==1 do
- fuel()
- turtle.digUp()
- turtle.up()
- if turtle.detectUp()==false then
- y=0
- end
- end
- resetPos()
- end
- function checkMats()
- -- Checking saplings slot
- print("Checking for mats.")
- sleep(2)
- if turtle.getItemCount(1)==0 then
- print("Not enough Saplings.")
- s=1
- turtle.turnLeft()
- turtle.select(1)
- turtle.suck()
- turtle.turnRight()
- if turtle.getItemCount(1)>0 then
- s=0
- end
- end
- -- Checking bonemeal slot
- if turtle.getItemCount(2)==0 then
- print("Not enough bonemeal.")
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- turtle.suck()
- turtle.turnRight()
- turtle.turnRight()
- end
- -- Checking fuel slot
- if turtle.getItemCount(16)<=10 then
- print("Not enough Fuel.")
- turtle.turnRight()
- turtle.select(1)
- turtle.suck()
- turtle.turnLeft()
- end
- end
- function checkStop()
- if s==0 then
- shell.exit()
- end
- end
- function ConsolidateMats()
- turtle.turnLeft()
- print("Consolidating saplings.")
- for i=3,15 do
- turtle.select(i)
- if turtle.compareTo(1) then -- It's a sapling not in slot one
- turtle.drop() -- put it in the chest to our left
- end
- end
- turtle.turnRight()
- print("Sending all other mats to processing.")
- sleep(2)
- for i=3,15 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- while true do
- fuel()
- makeTree()
- checkMats()
- cutTree()
- ConsolidateMats()
- checkStop()
- end
Advertisement
Add Comment
Please, Sign In to add comment