Advertisement
tbrixey

Minecraft Turtle Inferium Farm Script

Jan 19th, 2021 (edited)
1,595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.10 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. if #args ~= 2 then
  4.   print( "Requires length of lines and total lines to farm." )
  5.   error()
  6. end
  7.  
  8. data = turtle.getItemDetail()
  9. fuelLevel = turtle.getFuelLevel()
  10. reprocessorSuccess, reprocessorData = turtle.inspectDown()
  11.  
  12. if (not data) and (not reprocessorSuccess) then
  13.   print( "Requires seeds in current slot" )
  14.   error()
  15. end
  16.  
  17. if data then
  18.   if data.name ~= "mysticalagriculture:inferium_seeds" then
  19.     print( "Requires inferium seeds in current slot" )
  20.     error()
  21.   end
  22. end
  23.  
  24. if reprocessorData then
  25.   if reprocessorData.name ~= "mysticalagriculture:inferium_reprocessor" then
  26.     print( "Requires inferium reprocessor below start point" )
  27.     error()
  28.   end
  29. end
  30.  
  31. if fuelLevel == 0 then
  32.   print("Out of fuel!")
  33.   error()
  34. end
  35.  
  36. print("Here we go!")
  37.  
  38. local lengthOfLines = tonumber(args[1])
  39. local totalPairs = tonumber(args[2])
  40.  
  41. lengthOfLines = lengthOfLines + 1
  42.  
  43. local function checkIfGrown()
  44.   success, data = turtle.inspectDown()
  45.   if success then
  46.     if data.name ~= "mysticalagriculture:inferium_crop" then
  47.       print( "Can't find inferium")
  48.       error()
  49.     end
  50.     if data.state.age == 7 then
  51.       return true
  52.     else
  53.       return false
  54.     end
  55.   end
  56. end
  57.  
  58. local function forwardLoop(loopAmount)
  59.   for i=1,loopAmount do
  60.     grown = checkIfGrown()
  61.     if grown == true then
  62.       turtle.digDown()
  63.       turtle.placeDown()
  64.     end
  65.     if i ~= loopAmount then
  66.       turtle.forward()
  67.     end
  68.   end
  69. end
  70.  
  71. for x=1,25 do
  72.   turtle.forward()
  73.   for i=1,totalPairs do
  74.     forwardLoop(lengthOfLines)
  75.     turtle.turnLeft()
  76.     turtle.forward()
  77.     turtle.forward()
  78.     turtle.turnLeft()
  79.     forwardLoop(lengthOfLines)
  80.     turtle.turnRight()
  81.     turtle.forward()
  82.     turtle.forward()
  83.     turtle.turnRight()
  84.   end
  85.  
  86.   turtle.turnRight()
  87.  
  88.   local goBack = totalPairs * 4
  89.  
  90.   for i=1,goBack do
  91.     turtle.forward()
  92.   end
  93.  
  94.   turtle.turnRight()
  95.   turtle.forward()
  96.   turtle.turnLeft()
  97.   turtle.turnLeft()
  98.  
  99.   local curSeeds = turtle.getItemCount() - 1
  100.  
  101.   if curSeeds ~= 0 then
  102.     turtle.dropDown(curSeeds)
  103.   end
  104.  
  105.   os.sleep(240)
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement