Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local WaitTime = 60
- local WentUp = 0
- -- Detect
- local function Detect()
- if turtle.detect() then
- print("Tree!")
- return true
- else
- print("Not Tree!")
- return false
- end
- end --Detect()
- -- ChopUp
- local function ChopUp(Count)
- if turtle.digUp() then
- if Count then
- WentUp = WentUp + 1
- print("Up: " .. WentUp)
- end
- return true
- else
- return false
- end
- end --ChopUp()
- -- ChopDown
- local function ChopDown(Count)
- if Count then
- if WentUp > 0 then
- turtle.digDown()
- WentUp = WentUp - 1
- print("Down: " .. WentUp)
- return true
- else
- return false
- end
- else
- turtle.digDown()
- return true
- end
- end --ChopDown()
- -- ChopForward
- local function ChopForward()
- if turtle.dig() then
- print("Forward")
- return true
- else
- return false
- end
- end -- ChopForward()
- -- Main Loop
- while true do
- local Detected = false
- Detected = Detect()
- if Detected then
- ChopForward()
- turtle.forward()
- --Clear Stump
- ChopDown(false)
- local StillWood
- StillWood = true
- while StillWood do
- StillWood = ChopUp(true)
- if StillWood then
- turtle.up()
- end
- end --StillWood (up)
- ChopForward()
- turtle.forward()
- StillWood = true
- while StillWood do
- StillWood = ChopDown(true)
- turtle.down()
- end --StillWood (down)
- -- Clear Stump
- ChopDown(false)
- -- WentUp = 0
- turtle.turnRight()
- ChopForward()
- turtle.forward()
- -- Clear Stump
- ChopDown(false)
- StillWood = true
- while StillWood do
- StillWood = ChopUp(true)
- if StillWood then
- turtle.up()
- end
- end
- turtle.turnRight()
- ChopForward()
- turtle.forward()
- StillWood = true
- while StillWood do
- StillWood = ChopDown(true)
- turtle.down()
- end
- -- Clear Stump
- ChopDown(false)
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.back()
- print("Done")
- end --Detected
- -- Refuel
- if turtle.getFuelLevel() < 10000 then
- for Slot=1,16 do
- local NumberOfItems = turtle.getItemCount(Slot)
- turtle.refuel(NumberOfItems)
- end --for
- end --if
- -- Store
- for Slot=1,16 do
- turtle.select(Slot)
- turtle.dropDown()
- end
- redstone.setOutput("bottom", true)
- sleep(10)
- redstone.setOutput("bottom", false)
- sleep(WaitTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment