Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function consolidate()
- local i = 3
- while (i < 16) do
- i = i + 1
- turtle.select(i)
- if (turtle.compareTo(1)) then
- turtle.transferTo(1)
- end
- if (turtle.compareTo(2)) then
- turtle.transferTo(2)
- end
- if (turtle.compareTo(3)) then
- turtle.transferTo(3)
- end
- end
- end
- local function checkItem(slot, count)
- if (turtle.getItemCount(slot) > count) then
- return true
- end
- return false
- end
- local function checkFuel()
- return checkItem(1, 1)
- end
- local function checkSaplings()
- return checkItem(2, 1)
- end
- local function checkBonemeal()
- return checkItem(3, 1)
- end
- local function refillBonemeal()
- if (verifyPos()) then
- turtle.turnRight()
- turtle.suck()
- turtle.turnLeft()
- end
- end
- local function refillSaplings()
- if (verifyPos()) then
- turtle.turnRight()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- local function refillCoal()
- if (verifyPos()) then
- turtle.turnLeft()
- turtle.suck()
- turtle.turnRight()
- end
- end
- local function plantSaplings()
- turtle.select(2)
- turtle.place()
- end
- local function growTree()
- turtle.select(4)
- while (turtle.compare() == false) do
- if (checkBonemeal() == false) then
- break
- end
- turtle.select(3)
- turtle.place()
- turtle.select(4)
- end
- end
- while (turtle.getFuelLevel() > 100) do
- consolidate()
- if (checkFuel() == false) then
- refillCoal()
- consolidate()
- if (checkFuel() == false) then
- break
- end
- end
- if (checkSaplings() == false) then
- refillSaplings()
- consolidate()
- if (checkSaplings() == false) then
- break
- end
- end
- if (checkBonemeal() == false) then
- refillBonemeal()
- consolidate()
- if (checkBonemeal() == false) then
- break
- end
- end
- plantSaplings()
- growTree()
- if (turtle.getFuelLevel() < 100) then
- turtle.select(1)
- turtle.refuel(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement