Bonkie

Wheat/Seed Turtle

May 19th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. inventorycheckslot = 1
  2. bonemealslot = 2
  3. bonemeallowlimit = 10
  4. seedslot = 3
  5. seedlowlimit = 10
  6. dumpslotbegin = 4
  7. dumpslotend = 16
  8. runbeforeempy = 32
  9.  
  10. function resetPosition()
  11.   turtle.select(inventorycheckslot)
  12.   c = turtle.compare()
  13.   print("Resetting position.")
  14.   while c==false do
  15.     c = turtle.compare()
  16.     if (c==false) then
  17.       turtle.turnRight()
  18.       sleep(1)
  19.     end
  20.   end
  21.   sleep(1)
  22.   turtle.turnRight()
  23.   sleep(1)
  24.   turtle.turnRight()
  25.   sleep(1)
  26. end
  27.  
  28. function refill()
  29.   print("Refilling bonemeal.")
  30.   turtle.select(bonemealslot)
  31.   turtle.dropUp()
  32.   turtle.suckUp()
  33.  
  34.   if (turtle.getItemCount(seedslot) < seedslot) then
  35.     print("Refilling seeds.")
  36.     turtle.turnRight()
  37.     sleep(1)
  38.     turtle.turnRight()
  39.     sleep(1)
  40.     turtle.select(seedslot)
  41.     turtle.drop()
  42.     sleep(1)
  43.     turtle.suck()
  44.     sleep(1)
  45.     turtle.turnRight()
  46.     sleep(1)
  47.     turtle.turnRight()
  48.     sleep(1)
  49.   end
  50. end
  51.  
  52. function boneMeal()
  53.   if (turtle.getItemCount(bonemealslot) < bonemeallowlimit) then
  54.     refill()
  55.   end
  56.  
  57.   b = true
  58.   while b==true do
  59.     turtle.select(bonemealslot)
  60.     b = turtle.place()
  61.   end
  62.  
  63. end
  64.  
  65. function placeSeed ()
  66.   if (turtle.getItemCount(seedslot) < seedlowlimit) then
  67.     refill()
  68.   end
  69.  
  70.   turtle.select(seedslot)
  71.   turtle.place()  
  72. end
  73.  
  74. function emptySlots()
  75.   for i=dumpslotbegin,dumpslotend do
  76.     turtle.select(i)
  77.     turtle.dropUp()
  78.   end
  79. end
  80.  
  81.  
  82. resetPosition()
  83.  
  84. while true do
  85.   if(redstone.getInput("bottom")==true) then
  86.     for i=1,runbeforeempy do
  87.       print("Farming run: ".. i .." of ".. runbeforeempy)
  88.       turtle.dig()
  89.       sleep(1)
  90.       turtle.suck()
  91.       sleep(1)
  92.       placeSeed()
  93.       sleep(1)
  94.       boneMeal()
  95.       sleep(1)
  96.       turtle.dig()
  97.       sleep(1)
  98.       turtle.suck()
  99.       sleep(1)
  100.       turtle.suck()
  101.     end
  102.     emptySlots()
  103.   else
  104.     turtle.suck()
  105.     print("No Redstone signal")
  106.     print("Sleeping for 60 seconds")
  107.     sleep(30)
  108.     turtle.suck()
  109.     print("Sleeping for 30 seconds")
  110.     sleep(20)
  111.     turtle.suck()
  112.     print("Sleeping for 10 seconds")
  113.     sleep(10)
  114.     turtle.suck()
  115.     emptySlots()
  116.   end
  117. end
Advertisement
Add Comment
Please, Sign In to add comment