Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- geode scanner for turtles
- detectBlock = "tetra:block_geode"
- os.loadAPI("t")
- term.clear()
- term.setCursorPos(1,1)
- turtle.select(1)
- print("now scanning for geodes...")
- function isGeode(has_block,data)
- if has_block then
- if data.name == detectBlock then
- return true
- else
- return false
- end
- else
- return false
- end
- end
- function scanGeode()
- if isGeode(turtle.inspectUp()) then
- t.up(1)
- scanGeode()
- t.down(1)
- end
- if isGeode(turtle.inspect()) then
- t.forward(1)
- scanGeode()
- t.back(1)
- t.up(1)
- end
- if isGeode(turtle.inspectDown()) then
- t.down(1)
- scanGeode()
- t.up(1)
- end
- end
- while true do
- has_block, info = turtle.inspect()
- if has_block then
- if info.name == "minecraft:torch" then
- turtle.select(16)
- t.forward(1)
- scanGeode()
- t.forward(1)
- t.turnAround()
- t.place(16)
- t.turnAround()
- turtle.select(1)
- else
- if not returning then
- for i=1,5 do
- if not turtle.detectUp() then
- t.up()
- scanGeode()
- end
- end
- t.turnAround()
- print("returning..")
- returning = true
- else
- for i=1,5 do
- if not turtle.detectDown() then
- t.down()
- scanGeode()
- end
- end
- t.turnAround()
- print("Done!")
- break
- end
- end
- end
- t.forward(1)
- scanGeode()
- end
Advertisement
Add Comment
Please, Sign In to add comment