SHARE
    TWEET
    hoodedperson

    cook.lua

    Apr 22nd, 2025 (edited)
    337
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Lua 1.73 KB | None | 0 0
    1. local whereWall = nil
    2. local curWall = nil
    3. local blockToWall = {
    4. ["minecraft:stripped_oak_log"]=0,
    5. ["minecraft:oak_log"]=1,
    6. ["minecraft:bricks"]=2,
    7. }
    8. while whereWall == nil or curWall == nil do
    9. local s,b = turtle.inspect()
    10. if b.name == "minecraft:stripped_oak_log" or b.name == "minecraft:oak_log" or b.name == "minecraft:bricks" then
    11. whereWall = 0
    12. curWall = blockToWall[b.name]
    13. break
    14. else
    15. turtle.turnLeft()
    16. end
    17. end
    18. print("Found wall: ", curWall)
    19. function turnLeft()
    20. turtle.turnLeft()
    21. whereWall = (whereWall - 1) % 4
    22. end
    23. function turnRight()
    24. turtle.turnRight()
    25. whereWall = (whereWall + 1) % 4
    26. end
    27. function forward()
    28. if whereWall % 2 == 0 then
    29. return false, "may not escape 2d working area or run into wall"
    30. end
    31. local s,r = turtle.forward()
    32. if not s then
    33. return false, r
    34. end
    35. if whereWall == 1 then
    36. curWall = (curWall + 1) % 3
    37. return true
    38. elseif whereWall == 3 then
    39. curWall = (curWall - 1) % 3
    40. return true
    41. end
    42. end
    43. function goWall(wall)
    44. if curWall ~= wall then
    45. dist = wall - curWall
    46. if dist > 0 and whereWall ~= 1 then
    47. while whereWall ~= 1 do
    48. if whereWall > 1 then
    49. turnLeft()
    50. else
    51. turnRight()
    52. end
    53. end
    54. elseif dist < 0 and whereWall ~= 3 then
    55. while whereWall ~= 3 do
    56. if whereWall < 1 then
    57. turnLeft()
    58. else
    59. turnRight()
    60. end
    61. end
    62. end
    63. dist = math.abs(dist)
    64. for i=1,dist do
    65. forward()
    66. end
    67. end
    68. end
    69. function cabinet()
    70. goWall(2)
    71. end
    72. cabinet()
    73. while true do
    74. local success, block = turtle.inspectDown()
    75. addItemDown("farmersdelight:tomato_sauce",64)
    76. 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 によって変換されたページ (->オリジナル) /