Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length = tonumber(arg[1])
- local width = tonumber(arg[2])
- local height = tonumber(arg[3])
- local stepCounter = 0
- local unwantedItems = {}
- unwantedItems["minecraft:cobblestone"] = true
- unwantedItems["minecraft:granite"] = true
- unwantedItems["minecraft:andesite"] = true
- function dropStuff()
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemDetail() ~= nil then
- if unwantedItems[turtle.getItemDetail().name] then
- turtle.drop()
- end
- end
- end
- turtle.select(1)
- end
- function move()
- turtle.dig()
- if turtle.getFuelLevel() <= 10 then
- turtle.refuel(1)
- end
- while turtle.forward() == false do
- turtle.dig()
- end
- stepCounter = stepCounter + 1
- if stepCounter >= 64 then
- dropStuff()
- stepCounter = 0
- end
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function returnToStart()
- if length % 2 == 0 then
- -- Turtle is on start side
- if height % 2 == 0 then
- -- Turtle is far left
- -- Turtle is facing outwards
- for i = 1, height-1 do
- turtle.up()
- end
- move()
- turnAround()
- else
- -- Turtle is far right
- -- Turtle is facing outwards
- for i = 1, height-1 do
- turtle.up()
- end
- turtle.turnRight()
- for i = 1, length-1 do
- move()
- end
- turtle.turnLeft()
- move()
- turnAround()
- end
- else
- if height % 2 == 0 then
- -- Turtle is on start side and far left
- -- Turtle is facing outwards
- for i = 1, height-1 do
- turtle.up()
- end
- move()
- turnAround()
- else
- -- Turtle is on far side and far right
- -- Turtle is facing outwards
- for i = 1, height-1 do
- turtle.up()
- end
- turnAround()
- for i = 1, width-1 do
- move()
- end
- turtle.turnRight()
- for i = 1, length-1 do
- move()
- end
- turtle.turnLeft()
- move()
- turnAround()
- end
- end
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getItemDetail() ~= nil then
- turtle.dropDown()
- end
- end
- turtle.select(1)
- end
- move()
- for i = 1, height do
- for j = 1, length do
- for k = 1, width-1 do
- move()
- end
- if j == length then
- break;
- end
- if length % 2 == 0 then
- if i % 2 == 1 then
- if j % 2 == 1 then
- turtle.turnRight()
- move()
- turtle.turnRight()
- else
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- end
- else
- if j % 2 == 1 then
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- else
- turtle.turnRight()
- move()
- turtle.turnRight()
- end
- end
- else
- if j % 2 == 1 then
- turtle.turnRight()
- move()
- turtle.turnRight()
- else
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- end
- end
- end
- if i == height then
- break;
- end
- turtle.digDown()
- turtle.down()
- turnAround()
- end
- returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement