Untitled
unknown
plain_text
a year ago
2.4 kB
5
Indexable
-- Define the function to refuel the turtle function refuelExcludingOakSaplings() for i = 1, 16 do turtle.select(i) local itemDetail = turtle.getItemDetail() if itemDetail and itemDetail.name ~= "minecraft:oak_sapling" then turtle.refuel() end end end -- Define the function to drop all items except oak saplings function dropAllExceptOakSaplings() for i = 1, 16 do turtle.select(i) local itemDetail = turtle.getItemDetail() if itemDetail and itemDetail.name ~= "minecraft:oak_sapling" then turtle.dropDown() end end end -- Main loop while true do if not turtle.detect() then turtle.forward() else local success, data = turtle.inspect() if success then if data.name == "minecraft:cobbled_deepslate" then refuelExcludingOakSaplings() turtle.turnLeft() turtle.turnLeft() dropAllExceptOakSaplings() elseif data.name == "minecraft:oak_log" then turtle.dig() turtle.forward() if turtle.detectDown() then turtle.digDown() end -- Place oak sapling from inventory local saplingPlaced = false for i = 1, 16 do turtle.select(i) local itemDetail = turtle.getItemDetail() if itemDetail and itemDetail.name == "minecraft:oak_sapling" then turtle.placeDown() saplingPlaced = true break end end if not saplingPlaced then print("No oak saplings available to place.") end -- Mine upwards if there's an oak block above while turtle.detectUp() do turtle.digUp() turtle.up() end -- Go down until can't go further while not turtle.detectDown() do turtle.down() end else turtle.dig() turtle.forward() end end end end
Editor is loading...
Leave a Comment