SHARE
    TWEET
    hoodedperson

    mine.lua

    Apr 16th, 2025
    40
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    1. avgItemPerBreak = 3
    2. state = "walking"
    3. checksUntilRedo = 0
    4. function checkFull()
    5. full = false
    6. if checksUntilRedo <= 0 then
    7. minItemsLeft = math.huge
    8. for i=1,16,1 do
    9. turtle.select(i)
    10. spaceLeft = turtle.getItemSpace()
    11. full = full or spaceLeft < 5
    12. if spaceLeft < minItemsLeft then
    13. minItemsLeft = spaceLeft
    14. end
    15. end
    16. checksUntilRedo = math.floor(minItemsLeft/avgItemPerBreak)
    17. print(string.format("Checked if full\nmin remaining items: %d\nrecheck in %d requests", minItemsLeft, checksUntilRedo))
    18. else
    19. checksUntilRedo = checksUntilRedo-1
    20. print(string.format("check in %d check requests", checksUntilRedo))
    21. end
    22. return full
    23. end
    24. while true do
    25. if state == "walking" then
    26. turtle.forward()
    27. end
    28. local exists, block = turtle.inspectDown()
    29. if not exists then block = {} end
    30. if block.name == "minecraft:red_wool" then
    31. state="depo"
    32. for i=1,16,1 do
    33. turtle.select(i)
    34. turtle.drop()
    35. end
    36. turtle.turnLeft()
    37. turtle.turnLeft()
    38. state = "walking"
    39. elseif block.name=="create:polished_cut_veridium" then
    40. state = "mining"
    41. turtle.dig()
    42. full = checkFull()
    43. if full then
    44. turtle.turnLeft()
    45. turtle.turnLeft()
    46. state="walking"
    47. end
    48. end
    49. end
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /