AdventurousMR

Turtle Melon Farmer 1.0

Jul 19th, 2022 (edited)
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. -- Turtle Melon Farmer -- -- AdventurousMR --
  2.  
  3. local bin = peripheral.wrap("Bottom")
  4.  
  5. function limeWool()
  6.     turtle.turnLeft()
  7.     turtle.forward()
  8.     turtle.turnLeft()
  9. end
  10.  
  11. function redWool()
  12.     turtle.turnRight()
  13.     turtle.forward()
  14.     turtle.turnRight()
  15. end
  16.  
  17. function lightBlueWool()
  18.     turtle.turnRight()
  19.     turtle.turnRight()
  20.     for i=1,16 do
  21.         turtle.select(i)
  22.         local item = turtle.getItemDetail()
  23.         if item ~= nil and item.name == "minecraft:melon_slice" then
  24.             turtle.dropDown()
  25.         end
  26.     end
  27.     station()
  28. end
  29.  
  30. function orangeWool()
  31.     turtle.turnLeft()
  32.     while true do
  33.         local I_success, I_data = turtle.inspect()
  34.         if I_success and I_data.name == "minecraft:orange_wool" then
  35.             orangeWool()
  36.         elseif I_success and I_data.name == "minecraft:light_blue_wool" then
  37.             lightBlueWool()
  38.             break
  39.         else
  40.             turtle.forward()
  41.         end
  42.     end
  43. end
  44.  
  45. function run()
  46.     local ID_success, ID_data = turtle.inspectDown()
  47.     local I_success, I_data = turtle.inspect()
  48.  
  49.     if ID_success and ID_data.name == "minecraft:melon" then
  50.         turtle.digDown()
  51.         run()
  52.     elseif I_success and I_data.name == "minecraft:red_wool" then
  53.         redWool()
  54.         run()
  55.     elseif I_success and I_data.name == "minecraft:lime_wool" then
  56.         limeWool()
  57.         run()
  58.     elseif I_success and I_data.name == "minecraft:light_blue_wool" then
  59.         lightBlueWool()
  60.     elseif I_success and I_data.name == "minecraft:orange_wool" then
  61.         orangeWool()
  62.     elseif ID_success == false or ID_success and ID_data.name ~= "minecraft:melon" then
  63.         turtle.forward()
  64.         run()
  65.     end
  66. end
  67.  
  68. function station()
  69.     while true do
  70.         if bin.getStored().count < 50 then
  71.             run()
  72.             break
  73.         end
  74.     end
  75. end
  76.  
  77. station()
Add Comment
Please, Sign In to add comment