SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function harvest()
  2.     print ("Harvesting..")
  3.     turtle.dig()
  4.     turtle.suck()
  5.     plant()
  6. end
  7.  
  8.  
  9. function inspect()
  10.     local success,i =turtle.inspect()
  11.     if success then
  12.         local f = textutils.serialise(i.state.age)
  13.         if f=="2" then
  14.             print("Fully grown cocoa detected.")
  15.             harvest()
  16.         end
  17.     elseif not success then
  18.         plant()
  19.     end
  20. end
  21.  
  22. function turn()
  23.     turtle.turnLeft()
  24. end
  25.  
  26. function fuel()
  27.     local t = turtle.getFuelLevel()
  28.     if t<50 then
  29.         print("Fuel less then 50.Please insert fuel to resume")
  30.         while turtle.getFuelLevel()<50 do
  31.         for i=1,16 do
  32.             turtle.select(i)
  33.             turtle.refuel()
  34.         end
  35.         end
  36.     end
  37.     print("Current fuel:".. t)
  38. end
  39.  
  40. function plant()
  41.  for i=1,16 do
  42.     local s = turtle.select(i)
  43.     local c = turtle.getItemDetail()
  44.     if c then
  45.         local g =c.name
  46.         if g=="minecraft:wheat_seeds" then
  47.             print("Planting new seed..")
  48.             turtle.place()
  49.         end        
  50.     end
  51.  end
  52. end
  53.  
  54. function transfer()
  55.     for i=1,16 do
  56.         local t = turtle.select(i)
  57.         local k = turtle.getItemCount()
  58.         local m = turtle.getItemDetail()
  59.         if m then
  60.             local f = m.name
  61.             if f=="minecraft:wheat" then
  62.                 if k>4 then
  63.                     turtle.dropDown(k-4)
  64.                     print ("Storing ".. k-4 .." cocoa beans")
  65.                 end
  66.             end
  67.         end
  68.     end        
  69. end    
  70.  
  71. while true do
  72.     fuel()
  73.     for i=1,4 do
  74.         inspect()
  75.         turn()
  76.     end
  77.     transfer()
  78.     os.sleep(60)
  79. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top