robathome

MC wall_dropper

Nov 4th, 2025
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. -- stair_or_turn_stone_bricks.lua
  2. -- Loop:
  3. -- - If no block ahead: place STONE BRICKS below, move forward, continue.
  4. -- - If block ahead: place STONE BRICKS below, move up, if block ahead then turn 180°, place STONE BRICKS, continue; else stop.
  5.  
  6. local function selectStoneBricks()
  7. for s = 1, 16 do
  8. local d = turtle.getItemDetail(s)
  9. if d and (d.name == "minecraft:stone_bricks" or (d.displayName and d.displayName:lower() == "stone bricks")) then
  10. turtle.select(s)
  11. return true
  12. end
  13. end
  14. return false
  15. end
  16.  
  17. local function placeStoneBricksDown()
  18. if not selectStoneBricks() then
  19. print("Out of stone bricks. Stopping.")
  20. return false
  21. end
  22. if not turtle.placeDown() then
  23. -- If a block is already below, that is fine.
  24. if not turtle.detectDown() then
  25. print("Failed to place stone bricks below. Stopping.")
  26. return false
  27. end
  28. end
  29. return true
  30. end
  31.  
  32. while true do
  33. if not turtle.detect() then
  34. -- No block ahead: drop bricks below, step forward
  35. if not placeStoneBricksDown() then break end
  36. if not turtle.forward() then
  37. print("Blocked while moving forward. Stopping.")
  38. break
  39. end
  40. else
  41. -- Block ahead: drop bricks below, go up
  42. if not placeStoneBricksDown() then break end
  43. if not turtle.up() then
  44. print("Blocked above. Stopping.")
  45. break
  46. end
  47. if turtle.detect() then
  48. -- Block ahead after moving up: turn around, drop bricks, continue
  49. turtle.turnLeft(); turtle.turnLeft()
  50. if not placeStoneBricksDown() then break end
  51. -- continue loop
  52. else
  53. -- No block ahead after moving up: end
  54. print("Open path found after climbing. Stopping.")
  55. break
  56. end
  57. end
  58. end
  59.  
  60. print("Done.")
  61.  
Advertisement
Add Comment
Please, Sign In to add comment