Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length = 61
- local width = 61
- local function refuel()
- if turtle.getFuelLevel() < 50 then
- local prev = turtle.getSelectedSlot()
- turtle.select(1)
- if not turtle.refuel(4) then
- print('Need more fuel')
- while not turtle.refuel(4) do
- sleep(3)
- end
- end
- turtle.select(prev)
- end
- end
- local function tryForwards()
- refuel()
- while not turtle.forward() do
- if turtle.detect() then
- turtle.dig()
- sleep(.5)
- while turtle.detect() do
- turtle.dig()
- sleep(.5)
- end
- elseif turtle.attack() then
- else
- sleep(1)
- end
- end
- end
- local function advance()
- if turtle.getSelectedSlot() == 16 then
- print('Need more materials')
- local empty = true
- while empty do
- for n=2, 16 do
- print (n)
- if turtle.getItemCount(n) > 0 then
- empty = false
- turtle.select(n)
- return
- end
- end
- sleep(3)
- end
- else
- turtle.select(turtle.getSelectedSlot() + 1)
- end
- end
- local function placeBlock()
- if not turtle.detectDown() then
- if not turtle.placeDown() or turtle.getItemCount() == 0 or turtle.getItemDetail().name ~= "minecraft:stone_slab" then
- while turtle.getItemCount() == 0 or turtle.getItemDetail().name ~= "minecraft:stone_slab" do
- advance()
- end
- end
- end
- end
- local function turnAround(i)
- turtle.placeDown()
- if i%2 == 1 then
- turtle.turnRight()
- tryForwards()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- turtle.select(2)
- for i = 1, length, 1 do
- for j = 1, width-1, 1 do
- refuel()
- placeBlock()
- tryForwards()
- end
- turnAround(i)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement