AdditionalPylons

wart.lua

Jun 13th, 2026 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. turtle.up()
  2. turtle.forward()
  3. local rotateright = false
  4. local function turn_around()
  5.     if rotateright then
  6.         turtle.turnRight()
  7.         if turtle.detect() then return 1 end
  8.         turtle.forward()
  9.         turtle.turnRight()
  10.     else
  11.         turtle.turnLeft()
  12.         if turtle.detect() then return 1 end
  13.         turtle.forward()
  14.         turtle.turnLeft()
  15.     end
  16.     rotateright = not rotateright
  17. end
  18. while true do
  19.     local is,data = turtle.inspectDown()
  20.     local justrotated = false
  21.     if is and data.name=="minecraft:nether_wart" then
  22.         if data.state.age>=3 then
  23.             turtle.digDown()
  24.             local success,reason = turtle.placeDown()
  25.             -- (reason == "Cannot place item here" or reason == "No items to place")
  26.             if not success and reason ~= "Cannot place block here" then
  27.                 for i=1,16 do
  28.                     if turtle.getItemCount(i)>0 and turtle.getItemDetail(i).name=="minecraft:nether_wart" then
  29.                         turtle.select(i)
  30.                         turtle.placeDown()
  31.                         break
  32.                     end
  33.                 end
  34.             end
  35.         end
  36.     end
  37.     if turtle.detect() then
  38.         if turn_around() then break end
  39.         justrotated = true
  40.     elseif not is then
  41.         turtle.back()
  42.         if turn_around() then break end
  43.         justrotated = true
  44.     else
  45.         if not turtle.forward() then
  46.             if turn_around() then break end
  47.             justrotated = true
  48.         end
  49.     end
  50.     if justrotated and not turtle.detectDown() then
  51.         break
  52.     end
  53. end
  54.  
Advertisement
Add Comment
Please, Sign In to add comment