Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Farming Turtle V1.0
- By: Sayomie555
- Slot 1 = Saplings
- Slot 2 = Bonemeal
- Slot 3 = 1 Log
- Slot 4-16 = logs
- Chest Right = Bonemeal
- Chest Left = Logs
- --]]
- local fuel = 0
- local tree = 0
- local logs = 0
- local invlogs = 0
- local saplings = 0
- local bonemealinv = 0
- local invslot = 0
- function display()
- term.clear()
- term.setCursorPos(1,1)
- print("-------------------------------------")
- print("-----------Forestry-Turtle-----------")
- print("-------------------------------------")
- print("Number Of Trees Logged: "..tree)
- print("Number Of Logs Obtained: "..logs)
- print("-------------------------------------")
- print("Saplings In Inv: "..saplings)
- print("Bonemeal In Inv: "..bonemealinv)
- print("Log In Inv: "..invlogs)
- print("Current Fuel Level: "..fuel)
- print("-------------------------------------")
- print("Curent Mode: Active")
- end
- function fuel()
- fuel = turtle.getFuelLevel()
- if fuel < 100 then
- while fuel < 5000 do
- fuel = turtle.getFuelLevel()
- display()
- term.setCursorPos(12,1)
- print("Current Mode: Refueling Mode")
- sleep(5)
- end
- end
- end
- function chop()
- turtle.select(3)
- if turtle.compare() == true then
- turtle.dig()
- logs = logs + 1
- display()
- turtle.forward()
- while turtle.compareUp() == true do
- turtle.digUp()
- logs = logs + 1
- display()
- end
- while turtle.detectDown() == false do
- turtle.down()
- end
- tree = tree + 1
- turtle.back()
- end
- end
- function invcheck()
- saplings = turtle.getItemCount(1)
- bonemealinv = turtle.getItemCount(2)
- display()
- end
- function refuelbonemeal()
- if turtle.getItemCount(2) < 2 then
- turtle.turnRight()
- turtle.suck()
- end
- invslot = 3
- local slotamount = 0
- while invslot < 16 do
- invslot = invslot + 1
- turtle.select(invslot)
- if turtle.compareTo(2) == true then
- if turtle.getItemCount(2) > 63 then
- turtle.drop()
- end
- if turtle.getItemCount(2) < 63 then
- local transfer = 0
- slotamount = turtle.getItemCount(invslot)
- transfer = 64 - turtle.getItemCount(2)
- if transfter > slotamount then
- transfer = slotamount
- end
- turtle.transferTo(2, transfer)
- end
- if turtle.getItemCount(invslot) > 0 then
- turtle.drop()
- end
- end
- end
- turtle.turnLeft()
- end
- function refuelsapling()
- if turtle.getItemCount(1) < 2 then
- turtle.turnRight()
- turtle.turnRight()
- turtle.suck()
- end
- invslot = 3
- local slotamount = 0
- while invslot < 16 do
- invslot = invslot + 1
- turtle.select(invslot)
- if turtle.compareTo(1) == then
- if turtle.getItemCount(1) > 63 then
- turtle.drop()
- end
- if turtle.getItemCount(1) < 63 then
- local transfer = 0
- slotamount = turtle.getItemCount(invslot)
- transfer = 64 - turtle.getItemCount(1)
- if transfter > slotamount then
- transfer = slotamount
- end
- turtle.transferTo(1, transfer)
- end
- if turtle.getItemCount(invslot) > 0 then
- turtle.drop()
- end
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- function replant()
- turtle.select(1)
- if turtle.detect() == true then
- turtle.place()
- end
- end
- function bonemeal()
- turtle.select(1)
- while turtle.compare() == true do
- turtle.select(2)
- turtle.place()
- sleep(0.1)
- end
- end
- function standby()
- while redstone.getInput("up",true) do
- display()
- term.setCursorPos(12,1)
- print("Current Mode: Stand By")
- sleep(5)
- end
- end
- function dropoff()
- invslot = 3
- if turtle.getItemCount(16) > 0 then
- turtle.turnLeft()
- while invslot < 16 do
- invslot = invslot + 1
- if turtle.compareTo(3) == true then
- turtle.select(invslot)
- turtle.drop()
- sleep(0.1)
- end
- end
- turtle.turnRight()
- end
- end
- while true do
- display()
- fuel()
- invcheck()
- refuelbonemeal()
- refuelsapling()
- replant()
- bonemeal()
- chop()
- dropoff()
- end
Advertisement
Add Comment
Please, Sign In to add comment