Advertisement
ChicagoFire3

Spruce2x2 Enhanced

Jun 9th, 2025 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | Gaming | 0 0
  1. require "GenUtil"
  2.  
  3. function Continue(h)
  4.   if (h = -1) and turtle.detectUp() then
  5.     return true
  6.   if h > 0 then
  7.     return true
  8.   return false
  9. end
  10.  
  11. function CutUp(h)
  12.   local count = 0
  13.   while Continue(h) do
  14.     turtle.digUp()
  15.     turtle.Up()
  16.     count = count +1
  17.     h = h-1
  18.   end
  19.   return count
  20. end
  21.  
  22. function CutDown(h)
  23.   h = h-1
  24.   while h > 0 do
  25.     turtle.digDown()
  26.     turtle.down()
  27.     h = h-1
  28.   end
  29.   turtle.digDown()
  30. end
  31.  
  32. function CutSpruce()
  33.   turtle.dig()
  34.   turtle.forward()
  35.  
  36.   local h = CutUp(-1)
  37.   turtle.dig()
  38.   turtle.forward()
  39.   CutDown(h)
  40.   turtle.turnRight()
  41.   turtle.dig()
  42.   turtle.forward()
  43.   turtle.digDown()
  44.   CutUp(h)
  45.   turtle.turnRight()
  46.   turtle.dig()
  47.   turtle.forward()
  48.   CutDown(h)
  49. end
  50.  
  51. function Replant()
  52.   turtle.turnRight()
  53.   turtle.turnRight()
  54.   turtle.select(2)
  55.   turtle.placeDown()
  56.   turtle.forward()
  57.   turtle.placeDown()
  58.   turtle.turnLeft()
  59.   turtle.forward()
  60.   turtle.placeDown()
  61.   turtle.turnLeft()
  62.   turtle.forward()
  63.   turtle.down()
  64.   turtle.forward()
  65.   EmptyForwardReport(3)
  66.   turtle.turnRight()
  67.   turtle.turnRight()
  68.   turtle.place()
  69.   turtle.select(1)
  70. end
  71.  
  72. while true do
  73.   local FoundBlock, BlockType = turtle.inspect()
  74.   if FoundBlock then
  75.     if BlockType['name'] == 'minecraft:spruce_log' then
  76.       ReFuel(true)
  77.       CutSpruce()
  78.       Replant()
  79.     end
  80.   end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement