Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turtle.up()
- turtle.forward()
- local rotateright = false
- local function turn_around()
- if rotateright then
- turtle.turnRight()
- if turtle.detect() then return 1 end
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- if turtle.detect() then return 1 end
- turtle.forward()
- turtle.turnLeft()
- end
- rotateright = not rotateright
- end
- while true do
- local is,data = turtle.inspectDown()
- local justrotated = false
- if is and data.name=="minecraft:nether_wart" then
- if data.state.age>=3 then
- turtle.digDown()
- local success,reason = turtle.placeDown()
- -- (reason == "Cannot place item here" or reason == "No items to place")
- if not success and reason ~= "Cannot place block here" then
- for i=1,16 do
- if turtle.getItemCount(i)>0 and turtle.getItemDetail(i).name=="minecraft:nether_wart" then
- turtle.select(i)
- turtle.placeDown()
- break
- end
- end
- end
- end
- end
- if turtle.detect() then
- if turn_around() then break end
- justrotated = true
- elseif not is then
- turtle.back()
- if turn_around() then break end
- justrotated = true
- else
- if not turtle.forward() then
- if turn_around() then break end
- justrotated = true
- end
- end
- if justrotated and not turtle.detectDown() then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment