Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Fuel in slot1")
- print("Cobblestone in slot 2+ (as much as needed)")
- print("bridge length:")
- local blength = 1
- local step = 0
- local cobSlot = 2
- blength=tonumber(read())
- print("tunnel height(1):")
- theight=tonumber(read())
- function invCheck(cobSlot)
- if turtle.getItemCount(cobSlot) < 5 then
- print("no cobblestone, searching")
- cobSlot = invSelect()
- end
- return cobSlot
- end
- function heightCheck(theight)
- if theight == "" then
- theight = 1
- end
- return theight
- end
- function invSelect()
- local cobSlot = -1
- for i=1,16 do
- if turtle.getItemDetail(i) ~= nil then
- if (turtle.getItemDetail(i).name == "minecraft:cobblestone" and turtle.getItemCount(i) > 5) then
- print("cobblestone found in slot".. i )
- cobSlot = i
- --i = 16
- break
- end
- end
- end
- return cobSlot
- end
- function tmf()
- -- turtle move forward
- while turtle.forward() == false do
- turtle.dig()
- turtle.attack()
- end
- end
- function tpf()
- --turtle place forward
- --turtle.select(2)
- turtle.place()
- end
- function tpd()
- --turtle place down
- --turtle.select(2)
- turtle.placeDown()
- end
- function tmu()
- turtle.digUp()
- turtle.up()
- end
- function fuelCheck()
- if turtle.getFuelLevel() < 80 then
- if turtle.getItemCount(1) >=1 then
- turtle.select(1)
- turtle.refuel(1)
- else
- print("low on fuel")
- os.shutdown()
- end
- end
- end
- function row(cobSlot)
- cobSlot = invCheck(cobSlot)
- print("using items from Slot".. cobSlot)
- turtle.select(cobSlot)
- tpd()
- turtle.turnLeft()
- tmf()
- tpd()
- tpf()
- turtle.turnRight()
- turtle.turnRight()
- tmf()
- tmf()
- tpf()
- tpd()
- turtle.turnLeft()
- turtle.turnLeft()
- tmf()
- turtle.turnRight()
- end
- function rowup(cobslot)
- turtle.turnLeft()
- turtle.dig()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.turnLeft()
- end
- function goback(step)
- turtle.turnRight()
- turtle.turnRight()
- while step > 0 do
- fuelCheck()
- tmf()
- step = step - 1
- end
- end
- function highRow(theight)
- -- höhenkram
- rowheight = theight
- while rowheight > 1 do
- tmu()
- rowup()
- rowheight = rowheight -1
- end
- while rowheight < theight do
- turtle.down()
- rowheight = rowheight +1
- end
- end
- theight = heightCheck(theight)
- while step < blength do
- fuelCheck()
- tmf()
- row(cobSlot)
- highRow(theight)
- step = step + 1
- end
- goback(blength)
Advertisement
Add Comment
Please, Sign In to add comment