Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DayNightCycle = 1200
- local steps = 0
- local rowsDone = 0
- local length = 14
- local width = 4
- local strokes = 3
- local seedsPlanted = 0
- local rowsMade = 0
- local timesBusy = 0
- function firstStartup()
- if turtle.getItemCount(1) < 1 then
- print("put deeds in slot 1!")
- repeat
- sleep (1.1)
- until turtle.getItemCount(1) > 1
- end
- if turtle.getItemCount(2) < 1 then
- print("put seeds in slot 2!")
- repeat
- sleep (1.1)
- until turtle.getItemCount(2) >= 1
- end
- end
- function harvest()
- local success, t = turtle.inspectDown()
- if success then
- if t.name == "minecraft:dirt" then
- turtle.digDown()
- end
- if t.metadata == 7 then
- if turtle.getItemCount(1) > 2 then
- turtle.select(1)
- turtle.digDown()
- turtle.placeDown()
- seedsPlanted = seedsPlanted + 1
- elseif turtle.getItemCount(2) > 2 then
- turtle.select(2)
- turtle.digDown()
- turtle.placeDown()
- seedsPlanted = seedsPlanted + 1
- else
- print("Need new seeds ...")
- turtle.select(1)
- turtle.digDown()
- end
- end
- else
- turtle.digDown()
- if turtle.getItemCount(2) > 2 then
- turtle.select(2)
- turtle.placeDown()
- seedsPlanted = seedsPlanted + 1
- elseif turtle.getItemCount(1) > 2 then
- turtle.select(1)
- turtle.placeDown()
- seedsPlanted = seedsPlanted + 1
- else
- print("Need new seeds ...")
- end
- end
- end
- function startFromChest()
- steps = 0
- if rowsDone == 0 then
- turtle.forward()
- turtle.down()
- turtle.down()
- elseif rowsDone == 1 then
- turtle.forward()
- turtle.down()
- turtle.down()
- turtle.turnRight()
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 5
- turtle.turnLeft()
- elseif rowsDone == 2 then
- turtle.forward()
- turtle.down()
- turtle.down()
- turtle.turnRight()
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 10
- turtle.turnLeft()
- end
- steps = 0
- oneRowHarvest()
- end
- function oneRowHarvest()
- steps = 0
- repeat
- harvest()
- turtle.forward()
- steps = steps + 1
- until steps == length
- steps = 0
- harvest()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- repeat
- harvest()
- turtle.forward()
- steps = steps + 1
- until steps == length
- steps = 0
- harvest()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- repeat
- harvest()
- turtle.forward()
- steps = steps + 1
- until steps == length
- steps = 0
- harvest()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- repeat
- harvest()
- turtle.forward()
- steps = steps + 1
- until steps == length
- harvest()
- steps = 0
- rowsDone = rowsDone + 1
- rowsMade = rowsMade + 1
- emptyInv()
- end
- -- empty inventory & seeds
- function emptyInv()
- turtle.turnRight()
- steps = 0
- if rowsDone == 1 then
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 4
- elseif rowsDone == 2 then
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 9
- elseif rowsDone == 3 then
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 14
- end
- steps = 0
- turtle.turnRight()
- turtle.up()
- turtle.up()
- turtle.back()
- for q=3,16 do
- turtle.select(q)
- turtle.dropDown()
- end
- if turtle.getItemCount(2) > 32 then
- print("empty seeds")
- turtle.turnRight()
- repeat
- turtle.forward()
- steps = steps + 1
- until steps == 12
- steps = 0
- for q=1,2 do
- print("empty now")
- turtle.select(q)
- repeat
- turtle.dropDown(1)
- until turtle.getItemCount(q) <= 5
- end
- repeat
- turtle.back()
- steps = steps + 1
- until steps == 12
- steps = 0
- turtle.turnLeft()
- end
- if rowsDone == 3 then
- rowsDone = 0
- timesBusy = timesBusy + 1
- sleepFunction()
- end
- end
- function sleepFunction()
- print("Going to sleep")
- local slept = 0
- repeat
- sleep(50)
- slept = slept + 50
- print("Slept: " .. slept)
- until slept > DayNightCycle
- print( "gotte work ")
- end
- firstStartup()
- while true do
- print("Times done = " .. timesBusy)
- print("Seeds planted = " .. seedsPlanted)
- print("Rows made = " .. rowsMade)
- startFromChest()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement