Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function checkFuel()
- if turtle.getFuelLevel() < 1 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- --
- local function Wood()
- if turtle.getItemCount(1) > 0 then
- print "Need wood in Slot 1!"
- while turtle.getItemCount(1) > 0 do
- sleep(0)
- end
- end
- end
- local function Saplings()
- print "Make sure Saplings are in Slot 16"
- sleep(1)
- Saplings = tonumber(turtle.getItemCount(16))
- if Saplings > 3 then
- print "Something is in Slot 16.\nLet's hope that are saplings ;)"
- else
- print "Need at least 4 saplings in Slot 16"
- while Saplings < 4 do
- Saplings = tonumber(turtle.getItemCount(16))
- sleep(0)
- end
- end
- end
- --
- local function Ask()
- term.clear()
- term.setCursorPos(1,1)
- sleep(1)
- print "Enable Bonemeal? [y/n]"
- bm = read()
- end
- --
- local function CheckInput()
- if bm == "y" or bm == "yes" or bm == "n" or bm == "no" then
- print("Input '" .. bm .. "'accepted")
- else
- error("Invalid Input! Ending program...",0)
- end
- end
- --
- local function ConvertInput()
- if bm == "y" or bm == "yes" then
- bm = true
- toDrop = 14
- elseif bm == "n" or bm == "no" then
- bm = false
- toDrop = 15
- end
- bm1 = tostring(bm)
- print("bm = " .. bm1)
- print("Drop =" .. toDrop)
- end
- --
- local function Start()
- turtle.dig()
- checkFuel()
- turtle.forward()
- end
- --
- local function FellUp()
- up = 0
- while turtle.detectUp() do
- turtle.digUp()
- turtle.dig()
- checkFuel()
- turtle.up()
- up = up + 1
- end
- end
- --
- local function Move()
- turtle.dig()
- checkFuel()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- --
- local function FellDown()
- while up > 0 do
- turtle.dig()
- turtle.digDown()
- checkFuel()
- turtle.down()
- up = up - 1
- end
- end
- --
- local function Plant() --That's a mess. Sorry :)
- turtle.dig()
- checkFuel()
- turtle.up()
- turtle.select(16)
- turtle.placeDown()
- checkFuel()
- turtle.forward()
- turtle.select(16)
- turtle.placeDown()
- turtle.turnLeft()
- checkFuel()
- turtle.forward()
- turtle.select(16)
- turtle.placeDown()
- turtle.turnLeft()
- checkFuel()
- turtle.forward()
- turtle.select(16)
- turtle.placeDown()
- checkFuel()
- turtle.forward()
- checkFuel()
- turtle.turnRight()
- turtle.down()
- turtle.turnRight()
- end
- --
- local function GetDrop()
- print(toDrop)
- if not toDrop == 14 and not toDrop == 15 then
- DropInvalid = 1
- while DropInvalid == 1 do
- print "Something went wrong. Unable to drop."
- print "Drop everything? [y/n]"
- DropAll = read()
- if DropAll == y or DropAll == yes then
- for i = 1,16 do
- turtle.select(i)
- turtle.drop()
- end
- DropInvalid = 0
- elseif DropAll == n or DropAll == no then
- print "Returning to start.\nPlease empty the inventory."
- turtle.turnRight()
- DropInvaild = 0
- else
- print "Invalid Input! Reloading"
- term.clear()
- term.setCursorPos(1,1)
- sleep(1)
- DropInvalid = 1 --Still 1
- end
- end
- end
- end
- --
- local function Drop()
- for i = 2,toDrop do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- --
- local function MovetoChest()
- move = 10
- checkFuel()
- while move > 0 do
- checkFuel()
- turtle.forward()
- move = move - 1
- end
- end
- --
- local function CheckRes()
- if bm == true then
- bmCount = turtle.getItemCount(15)
- end
- SaplingCount = turtle.getItemCount(16)
- print(bmCount)
- print(SaplingCount)
- end
- --
- local function Decide()
- if bmCount < 2 and bm == true then
- NeedBonemeal = 1
- else
- NeedBonemeal = 0
- end
- if SaplingCount < 4 then
- NeedSaplings = 1
- else
- NeedSaplings = 0
- end
- end
- --
- local function CheckTree()
- turtle.select(1)
- if turtle.compare() then
- return true
- else
- return false
- end
- end
- --Begin
- While true do
- Wood()
- end
- While CheckTree() do
- Saplings()
- Start()
- FellUp()
- Move()
- FellDown()
- Plant()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement