Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- width = 20
- height = 20
- width = width - 1
- -- Draw screen
- term.setCursorPos(1, 1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setTextColor(colors.lime)
- term.setBackgroundColor(colors.black)
- term.clearLine()
- print(" Turtle Farm v1.0 ")
- term.setCursorPos(1, 3)
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print("Round ")
- print()
- term.setTextColor(colors.lightGray)
- term.write("[ ] ")
- term.setTextColor(colors.black)
- print("Dumping inventory")
- term.setTextColor(colors.lightGray)
- term.write("[ ] ")
- term.setTextColor(colors.black)
- print("Refueling")
- term.setTextColor(colors.lightGray)
- term.write("[ ] ")
- term.setTextColor(colors.black)
- print("Getting seeds")
- term.setTextColor(colors.lightGray)
- term.write("[ ] ")
- term.setTextColor(colors.black)
- print("Checking blocks")
- term.setTextColor(colors.lightGray)
- term.write(" [ ] ")
- term.setTextColor(colors.black)
- print("Harvesting")
- term.setTextColor(colors.lightGray)
- term.write(" [ ] ")
- term.setTextColor(colors.black)
- print("Replanting")
- term.setTextColor(colors.lightGray)
- term.write("[ ] ")
- term.setTextColor(colors.black)
- print("Going home")
- round = 0
- while true do
- round = round + 1
- term.setTextColor(colors.black)
- term.setCursorPos(7, 3)
- term.write(round)
- term.setCursorPos(2, 5)
- term.write("*")
- turtle.turnRight()
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- term.setCursorPos(2, 5)
- term.write(" ")
- term.setCursorPos(2, 6)
- term.write("*")
- turtle.turnRight()
- turtle.select(1)
- term.setTextColor(colors.lightGray)
- while turtle.getFuelLevel() < (width+1)*(height+1)*2 do
- term.setCursorPos(15, 6)
- term.write(turtle.getFuelLevel().."/"..((width+1)*(height+1)*2).." ")
- turtle.suck(1)
- turtle.refuel(1)
- end
- term.setTextColor(colors.black)
- term.setCursorPos(15, 6)
- term.write(" ")
- term.setCursorPos(2, 6)
- term.write(" ")
- term.setCursorPos(2, 7)
- term.write("*")
- turtle.turnRight()
- turtle.suck(64)
- turtle.select(2)
- term.setCursorPos(2, 7)
- term.write(" ")
- turtle.turnRight()
- turtle.up()
- turtle.forward()
- for x=0,width do
- for y=0,height do
- term.setCursorPos(2, 8)
- term.write("*")
- term.setCursorPos(21, 8)
- term.setTextColor(colors.lightGray)
- term.write("["..x..","..y.."] ")
- term.setTextColor(colors.black)
- local success, data = turtle.inspectDown()
- local seeds
- seeds = false
- if success then
- if data.name == "minecraft:wheat" and data.metadata == 7 then
- term.setCursorPos(2, 8)
- term.write(" ")
- term.setCursorPos(6, 9)
- term.write("*")
- turtle.digDown()
- term.setCursorPos(6, 9)
- term.write(" ")
- seeds = true
- end
- else
- term.setCursorPos(2, 8)
- term.write(" ")
- term.setCursorPos(6, 9)
- term.write("*")
- turtle.digDown()
- term.setCursorPos(6, 9)
- term.write(" ")
- seeds = true
- end
- if seeds then
- term.setCursorPos(6, 10)
- term.write("*")
- if turtle.getItemCount(1) < 2 and turtle.getItemCount(1) ~= 0 then
- term.setTextColor(colors.lightGray)
- term.setCursorPos(20, 10)
- term.write("Searching for seeds")
- for i=2,16 do
- if turtle.getItemCount(i) > 0 then
- local data = turtle.getItemDetail(i)
- local original = turtle.getItemDetail(1)
- if data.name == original.name then
- turtle.select(i)
- turtle.transferTo(1)
- break
- end
- end
- end
- term.setCursorPos(20, 10)
- term.write(" ")
- term.setTextColor(colors.black)
- end
- turtle.select(1)
- turtle.placeDown()
- turtle.select(2)
- term.setCursorPos(6, 10)
- term.write(" ")
- end
- if (y < (height - 1)) then
- turtle.forward()
- end
- end
- if x ~= width then
- if (x % 2 == 1) then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- term.setCursorPos(21, 8)
- term.write(" ")
- term.setCursorPos(2, 8)
- term.write(" ")
- term.setCursorPos(2, 11)
- term.write("*")
- turtle.forward()
- if (width % 2 == 0) then
- turtle.turnLeft()
- turtle.turnLeft()
- local i = 1
- if (height % 2 == 0) then i = 0 end
- for x=0,height-i do turtle.forward() end
- turtle.turnLeft()
- else
- turtle.turnLeft()
- turtle.forward()
- end
- local i = 0
- if (width % 2 == 1) then i = 1 end
- for x=1,width-i do turtle.forward() end
- turtle.turnLeft()
- turtle.down()
- term.setCursorPos(2, 11)
- term.write(" ")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement