Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://pastebin.com/pXKpsQpt
- function harvest()
- print ("Harvesting..")
- turtle.dig()
- turtle.suck()
- end
- function inspect()
- local success,i =turtle.inspect()
- if success then
- if (i.name=="minecraft:melon_block" or i.name=="minecraft:pumpkin") then
- print("Plant detected.")
- harvest()
- end
- 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 transfer()
- for i=1,16 do
- local t = turtle.select(i)
- local m = turtle.getItemDetail()
- if m then
- local f = m.name
- print (f)
- if (f=="minecraft:pumpkin" or f=="minecraft:melon") then
- turtle.dropDown()
- print ("Storing plants...")
- 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