Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function moveForward()
- for i = 1,6,1 do
- turtle.forward()
- end
- end
- local function checkFuel()
- if turtle.getFuelLevel() < 96 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function getCoal()
- turtle.select(1)
- while turtle.getItemCount(1) < 16 do
- os.sleep(3)
- turtle.drop()
- turtle.suck()
- end
- end
- local function getSaplings()
- turtle.select(2)
- while turtle.getItemCount(2) < 16 do
- os.sleep(3)
- turtle.drop()
- turtle.suck()
- end
- end
- local function getBonemeal()
- turtle.select(3)
- while turtle.getItemCount(3) < 4 do
- os.sleep(3)
- turtle.dropUp()
- turtle.suckUp()
- end
- end
- local function storeWood()
- chestfull = true
- while chestfull == true do
- for i=4,16,1 do
- if turtle.getItemCount(i) > 1 then
- turtle.select(i)
- items = turtle.getItemCount(i) - 1
- chestfull = turtle.drop(items)
- end
- end
- chestfull = not chestfull
- if chestfull == true and turtle.detectUp() == false then
- turtle.up()
- end
- if chestfull == true and turtle.detectUp() == true then
- print("Wood! Wood everywhere!!!")
- print("Try to add more vertical chests or take wood out of them.")
- if turtle.detectDown() == false then
- turtle.down()
- end
- os.shutdown()
- end
- end
- if turtle.detectDown() == false then
- turtle.down()
- end
- end
- local function plantTree()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.select(2)
- turtle.place()
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.select(3)
- turtle.place()
- end
- local function getMaterials()
- turtle.turnRight()
- turtle.turnRight()
- moveForward()
- turtle.turnLeft()
- getSaplings()
- getBonemeal()
- turtle.turnRight()
- turtle.forward()
- turtle.select(4)
- items = turtle.getItemCount(4) - 1
- turtle.dropDown(items)
- storeWood()
- turtle.turnRight()
- getCoal()
- if redstone.getInput("back") == true then
- turtle.turnRight()
- moveForward()
- turtle.forward()
- else
- print("Shutdown by redstone signal!")
- os.shutdown()
- end
- end
- local function cutWood()
- local height = 0
- turtle.select(2)
- turtle.dig()
- turtle.forward()
- turtle.dig()
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- turtle.dig()
- height = height + 1
- end
- checkFuel()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- turtle.dig()
- while height > 0 do
- turtle.digDown()
- turtle.down()
- turtle.dig()
- height = height - 1
- end
- turtle.back()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- if redstone.getInput("back") == true then
- getCoal()
- checkFuel()
- if turtle.getItemCount(4) > 1 then
- turtle.turnLeft()
- storeWood()
- turtle.turnRight()
- end
- if turtle.getItemCount(2) < 16 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- getSaplings()
- turtle.turnRight()
- if turtle.getItemCount(3) < 4 then
- getBonemeal()
- end
- turtle.forward()
- turtle.turnRight()
- end
- turtle.turnRight()
- turtle.forward()
- moveForward()
- while true do
- checkFuel()
- local needMaterials = false
- if turtle.getItemCount(1) < 4 or turtle.getItemCount(2) < 4 then
- needMaterials = true
- end
- if turtle.getItemCount(3) == 0 or turtle.getItemCount(14) > 1 then
- needMaterials = true
- end
- if needMaterials == true then
- getMaterials()
- end
- plantTree()
- checkFuel()
- cutWood()
- end
- else
- print("No redstone signal, no wood!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement