Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function harvest()
- print ("Harvesting..")
- turtle.dig()
- turtle.suck()
- plant()
- end
- function inspect()
- local success,i =turtle.inspect()
- if success then
- local f = textutils.serialise(i.state.age)
- if f=="3" then
- print("Fully grown beetroot detected.")
- harvest()
- end
- elseif not success then
- plant()
- end
- end
- function turn()
- turtle.turnLeft()
- end
- function fuel()
- local t = turtle.getFuelLevel()
- if t<50 then
- print("Fuel less then 50.Please insert fuel to resume")
- while turtle.getFuelLevel()<50 do
- for i=1,16 do
- turtle.select(i)
- turtle.refuel()
- end
- end
- end
- print("Current fuel:".. t)
- end
- function plant()
- for i=1,16 do
- local s = turtle.select(i)
- local c = turtle.getItemDetail()
- if c then
- local g =c.name
- if g=="minecraft:beetroot_seeds" then
- print("Planting new seed..")
- turtle.place()
- end
- end
- end
- end
- function transfer()
- for i=1,16 do
- local t = turtle.select(i)
- local k = turtle.getItemCount()
- local m = turtle.getItemDetail()
- if m then
- local f = m.name
- print (f)
- if (f=="minecraft:beetroot" or f=="minecraft:beetroot_seeds") then
- if k>4 then
- turtle.dropDown(k-4)
- print ("Storing ".. k-4 .." cocoa beans")
- end
- end
- end
- end
- end
- while true do
- fuel()
- for i=1,4 do
- inspect()
- turn()
- end
- transfer()
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement