Advertisement
Lyandro

wheat_harvester

May 4th, 2024 (edited)
1,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | Gaming | 0 0
  1. -- Variaveis
  2. local isBlock, data
  3. local isWheat, wheat
  4.  
  5. -- Funções
  6. function drop()
  7.     wheat_seeds_info = turtle.getItemDetail(1)
  8.     for i = 2, 16, 1 do
  9.         turtle.select(i)
  10.         actual_slot = turtle.getItemDetail(i)
  11.         if (wheat_seeds_info.count < 64 and actual_slot ~= nil and actual_slot.name == "minecraft:wheat_seeds") then
  12.             turtle.transferTo(1, 64)
  13.         end
  14.         turtle.dropDown()
  15.     end
  16.     sleep(600)
  17. end
  18.  
  19. function inspect_wheat()
  20.     isWheat, wheat = turtle.inspect()
  21.  
  22.     if (wheat.state.age == 7) then
  23.         turtle.dig()
  24.         turtle.select(1)
  25.         turtle.place()
  26.     end
  27. end
  28.  
  29. function deepslate_harvester()
  30.     turtle.turnLeft()
  31.  
  32.     for i = 0, 7, 1 do
  33.         inspect_wheat()
  34.         turtle.turnLeft()
  35.         turtle.turnLeft()
  36.         inspect_wheat()
  37.         turtle.turnRight()
  38.  
  39.         if (i < 7) then
  40.             turtle.forward()
  41.             turtle.turnRight()
  42.         end
  43.  
  44.         isBlock, data = turtle.inspect()
  45.  
  46.         if (data.name == "minecraft:cobblestone") then
  47.             drop()
  48.         end
  49.  
  50.     end
  51. end
  52.  
  53. function glass_harvester()
  54.     turtle.turnRight()
  55.  
  56.     for i = 0, 7, 1 do
  57.         inspect_wheat()
  58.         turtle.turnRight()
  59.         turtle.turnRight()
  60.         inspect_wheat()
  61.         turtle.turnLeft()
  62.  
  63.         if (i < 7) then
  64.             turtle.forward()
  65.             turtle.turnLeft()
  66.         end
  67.  
  68.         isBlock, data = turtle.inspect()
  69.  
  70.         if (data.name == "minecraft:deepslate_bricks") then
  71.             drop()
  72.         end
  73.  
  74.     end
  75. end
  76.  
  77. -- Loop
  78. while true do
  79.     -- Verifica qual bloco a turtle está olhando
  80.     isBlock, data = turtle.inspect()
  81.  
  82.     -- Se estiver olhando stone, faça:
  83.     if (data.name == "minecraft:deepslate_bricks") then
  84.         deepslate_harvester()
  85.     end
  86.  
  87.     -- Se estiver olhando cobblestone, faça:
  88.     if (data.name == "minecraft:cobblestone") then
  89.         glass_harvester()
  90.     end
  91. end
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement