Advertisement
farsidejake

farm

Jun 10th, 2022
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("fuzzy")
  2.  
  3. fuzzy.getmapy()
  4. print("starting up figuring out where I am")
  5. if tonumber(fuzzy.map[1]) < 0 then
  6.   print("not at home position")
  7.   if tonumber(fuzzy.map[4]) > 1 then
  8.     while tonumber(fuzzy.map[4]) > 1 do
  9.       fuzzy.turnRight()
  10.       fuzzy.getmapy()
  11.     end
  12.   end
  13. end    
  14. if tonumber(fuzzy.map[1]) < 0 then
  15.   while tonumber(fuzzy.map[1]) < 0 do
  16.     fuzzy.forward()
  17.     fuzzy.getmapy()
  18.   end
  19. end
  20.  
  21. -- now to actually farm
  22. while true do
  23.   print("let's go get some potatoes.")
  24.   fuzzy.turnRight()
  25.   fuzzy.turnRight()
  26.   fuzzy.getmapy()
  27.  
  28.   while tonumber(fuzzy.map[1]) >= -6 do  
  29.     local sucsess, potato = turtle.inspectDown()
  30.     local loopCounter = 1
  31.     if sucsess then
  32.       print("maybe")
  33.       print("moving: ", loopCounter)
  34.       print("x coord: ", fuzzy.map[1])
  35.       loopCounter = loopCounter + 1
  36.       if potato.name == "minecraft:potatoes" then
  37.         print("potato")
  38.         if potato.metadata == 7 then
  39.           print("harvest")
  40.           turtle.digDown()
  41.           turtle.select(1)
  42.           turtle.placeDown()
  43.         end      
  44.        end
  45.        local sucsess, potato = turtle.inspectDown()
  46.       if sucsess then
  47.         if potato.name == "minecraft:potatoes" then
  48.           if potato.metadata == 7 then
  49.             print("reharvest")
  50.             turtle.digDown()
  51.             turtle.select(1)
  52.             turtle.placeDown()
  53.           end
  54.         end
  55.       end
  56.     end
  57.     fuzzy.forward()
  58.     fuzzy.getmapy()
  59.   end
  60.  
  61.   --at end of track
  62.   fuzzy.turnRight()
  63.   fuzzy.turnRight()
  64.   fuzzy.getmapy()
  65.   while tonumber(fuzzy.map[1]) < 0 do
  66.     fuzzy.forward()
  67.     fuzzy.getmapy()
  68.   end
  69.   local sucsess, chest = turtle.inspect()
  70.   if sucsess then
  71.     if chest.name == "IronChest:BlockIronChest" then
  72.       print("Dropping off items")
  73.       for i = 2, 14, 1 do
  74.         turtle.select(i)
  75.         turtle.drop()
  76.       end
  77.       turtle.select(1)
  78.     end  
  79.     fuzzy.getmapy()
  80.   end
  81.  
  82.   fuzzy.getmapy()
  83.   print("sleepy")
  84.   os.sleep(120)
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement