Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function checkFuel()
- if turtle.getFuelLevel() < 1 then
- turtle.select(2)
- turtle.refuel(1)
- end
- end
- -- Move Functions
- local function Up()
- checkFuel()
- turtle.up()
- end
- local function Down()
- checkFuel()
- turtle.down()
- end
- local function Forward()
- checkFuel()
- if turtle.forward() then
- return true
- end
- end
- local function Back()
- checkFuel()
- turtle.back()
- end
- local function Right()
- turtle.turnRight()
- end
- local function Left()
- turtle.turnLeft()
- end
- local function Turn()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function Start()
- turtle.dig()
- Forward()
- end
- local function FellUp()
- up = 0
- while turtle.detectUp() do
- turtle.dig()
- turtle.digUp()
- Up()
- up = up + 1
- end
- end
- local function Move()
- turtle.dig()
- Right()
- turtle.dig()
- Forward()
- Left()
- end
- local function FellDown()
- while up > 0 do
- turtle.dig()
- turtle.digDown()
- Down()
- up = up - 1
- end
- turtle.dig()
- end
- local function Place()
- turtle.select(1)
- turtle.placeDown()
- end
- local function Plant()
- Up()
- Place()
- Forward()
- Place()
- Left()
- Forward()
- Place()
- Left()
- Forward()
- Place()
- Forward()
- Down()
- end
- local function GetSap()
- NeedSap = 64 - turtle.getItemCount(1) -- How many
- Left()
- turtle.select(1)
- turtle.suck(NeedSap)
- end
- local function Drop()
- Turn()
- for i = 3,16 do
- turtle.select(i)
- turtle.drop()
- end
- Drop2 = turtle.getItemCount(2) - 5 -- Keeps 5 wood as fuel
- if Drop2 < 0 then
- Drop2 = 0
- end
- turtle.select(2)
- turtle.drop(Drop2)
- Right()
- end
- local function CheckTree()
- turtle.select(1)
- while turtle.compare() do
- sleep(0.5)
- end
- end
- local function CheckSap()
- if turtle.getItemCount(1) < 5 then
- print "Not enough saplings"
- while turtle.getItemCount(1) < 5 do
- sleep(0.5)
- end
- print "\nResuming"
- end
- end
- while true do
- CheckSap()
- CheckTree() -- Freezes the program until a tree is detected
- Start()
- FellUp()
- Move()
- FellDown()
- Plant()
- GetSap()
- Drop()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement