alesandreo

lumberjack.lua

Aug 11th, 2021 (edited)
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. -- https://pastebin.com/1Mvs8GEx
  2. require 'lib.ale.ale'
  3.  
  4. Lumberjack = Miner:new()
  5.  
  6. Lumberjack.__index = Lumberjack
  7. Lumberjack.plantables = BlockList:new()
  8.  
  9. Lumberjack.plantables:addBlock('minecraft:oak_sapling')
  10. Lumberjack.whitelist:addTag('minecraft:logs')
  11. Lumberjack.blacklist:addTag('forge:sapling')
  12.  
  13. function Lumberjack:plant()
  14.     local slot = self.inventory:findInBlockList(self.plantables)
  15.     if not slot then print("Didn't find a plantable.") return false end
  16.     slot:select()
  17.     return turtle.place()
  18. end
  19.  
  20. L = Lumberjack:new()
  21. while (true) do
  22.     if not turtle.detect() then
  23.         print("Planting")
  24.         if not L:plant() then
  25.             print("Planting failed")
  26.             break
  27.         end
  28.     end
  29.     print("Checking block")
  30.     if L:checkBlock() then
  31.         print("Mining block")
  32.         L:mineBlock()
  33.     end
  34.     os.sleep(10)
  35.     print("Looping")
  36. end
Add Comment
Please, Sign In to add comment