mitgobla

dustCrafting

Oct 7th, 2023 (edited)
1,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | Source Code | 0 0
  1. -- Setup by facing a glass block
  2. -- Turn until facing the glass block
  3.  
  4. function turnToGlass()
  5.     success, data = turtle.inspect()
  6.     if success then
  7.         while data.name ~= "minecraft:glass" do
  8.             turtle.turnRight()
  9.             success, data = turtle.inspect()
  10.         end
  11.     end
  12. end
  13.  
  14. turnToGlass()
  15.  
  16. -- We are now facing the glass block
  17.  
  18. function getNewHammer()
  19.     turnToGlass()
  20.     turtle.select(1)
  21.     turtle.turnLeft()
  22.     -- wait until we have a hammer
  23.     while turtle.getItemCount(1) == 0 do
  24.         turtle.suck()
  25.         sleep(1)
  26.     end
  27.     turtle.turnRight()
  28. end
  29.  
  30. while true do
  31.     -- First check if we have a copper hammer
  32.     if turtle.getItemCount(1) == 0 then
  33.         getNewHammer()
  34.     end
  35.  
  36.     -- Now grab ores from the barrel. These are behind the turtle
  37.     turtle.turnLeft()
  38.     turtle.turnLeft()
  39.     turtle.select(2)
  40.     turtle.suck()
  41.  
  42.     -- Now craft the ores into dust
  43.     turtle.craft()
  44.  
  45.     -- Now put dust in the barrel, which is to the right of the glass block
  46.     turtle.turnLeft()
  47.  
  48.     for i = 2, 16 do
  49.         turtle.select(i)
  50.         turtle.drop()
  51.     end
  52.  
  53.     turnToGlass()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment