Guest User

tiller.lua

a guest
Jul 2nd, 2025
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. local monitor = peripheral.wrap("right")
  2.  
  3. function getCoarseDirtAmount()
  4.     local blockName = "minecraft:coarse_dirt"
  5.     local total = 0
  6.    
  7.     for slot=1, 16 do
  8.         local item = turtle.getItemDetail(slot)
  9.         if item and item.name == blockName then
  10.             total = total + item.count
  11.         end
  12.     end
  13.    
  14.     return total
  15. end
  16.  
  17. function doDig()
  18.     local foundCoarseDirt = false
  19.     local slot = 0
  20.     for i=2, 15 do
  21.         local b = turtle.getItemDetail(i)
  22.         if b and b.name == "minecraft:coarse_dirt" then
  23.             foundCoarseDirt = true
  24.             slot = i
  25.             break
  26.         end
  27.     end
  28.    
  29.     if foundCoarseDirt == false then
  30.         return false
  31.     end
  32.    
  33.     turtle.select(slot)
  34.     turtle.place()
  35.    
  36.     turtle.dig()
  37.    
  38.     turtle.select(16)
  39.     turtle.equipRight()
  40.     turtle.dig()
  41.     turtle.equipRight()
  42.    
  43.     turtle.select(1)
  44.     turtle.dropUp()
  45.    
  46.     return true
  47. end
  48.  
  49. local amount = getCoarseDirtAmount()
  50. local upToThen = 0
  51.  
  52. while doDig() do
  53.     upToThen = upToThen + 1
  54.     monitor.clear()
  55.     monitor.setCursorPos(1, 1)
  56.     monitor.setTextColor(colors.lime)
  57.     monitor.write("TILLER_d")
  58.    
  59.     monitor.setCursorPos(1, 2)
  60.     monitor.setTextColor(colors.white)
  61.     monitor.write("At")
  62.     monitor.setCursorPos(1, 3)
  63.     monitor.write(""..upToThen.."/"..amount)
  64. end
  65.  
  66. monitor.clear()
  67. monitor.setTextColor(colors.lime)
  68. monitor.setCursorPos(1, 1)
  69. monitor.write("--------")
  70. monitor.setCursorPos(1, 2)
  71. monitor.write("Tilling")
  72. monitor.setCursorPos(1, 3)
  73. monitor.write("complete")
  74. monitor.setCursorPos(1, 4)
  75.  
  76.  
Advertisement
Add Comment
Please, Sign In to add comment