Advertisement
Grexxity

Turtle test

May 23rd, 2023 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. -- Set the number of blocks to mine
  2. local numBlocks = 5
  3.  
  4. -- Loop to mine in a straight line
  5. for i = 1, numBlocks do
  6.     -- Check if the turtle has enough fuel to move forward
  7.     if turtle.getFuelLevel() > 1 then
  8.         print("Out of fuel!")
  9.         break
  10.     end
  11.  
  12.     -- Dig the block in front of the turtle
  13.     turtle.dig()
  14.  
  15.     -- Move the turtle forward
  16.     if not turtle.forward() then
  17.         print("Blocked in front!")
  18.         break
  19.     end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement