Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 0
- y = 0
- z = 0
- slot = 1
- facing = "north"
- print("Length = ?")
- l = tonumber(read())
- print("Width = ?")
- w = tonumber(read())
- function turn(direction)
- if direction == "north" then
- if facing == "west" then
- turtle.turnRight()
- end
- if facing == "south" then
- turtle.turnRight()
- turtle.turnRight()
- end
- if facing == "east" then
- turtle.turnLeft()
- end
- facing = "north"
- end
- if direction == "west" then
- if facing == "south" then
- turtle.turnRight()
- end
- if facing == "east" then
- turtle.turnRight()
- turtle.turnRight()
- end
- if facing == "north" then
- turtle.turnLeft()
- end
- facing = "west"
- end
- if direction == "south" then
- if facing == "east" then
- turtle.turnRight()
- end
- if facing == "north" then
- turtle.turnRight()
- turtle.turnRight()
- end
- if facing == "west" then
- turtle.turnLeft()
- end
- facing = "south"
- end
- if direction == "east" then
- if facing == "north" then
- turtle.turnRight()
- end
- if facing == "west" then
- turtle.turnRight()
- turtle.turnRight()
- end
- if facing == "south" then
- turtle.turnLeft()
- end
- facing = "east"
- end
- end
- function selectSlot()
- if turtle.getItemCount(slot) == 0 and slot < 16 then
- slot = slot + 1
- elseif turtle.getItemCount(slot) == 0 and slot == 16 then
- slot = 1
- end
- turtle.select(slot)
- end
- function pillar()
- repeat
- selectSlot()
- turtle.placeDown()
- sleep(0.1)
- success, data = turtle.inspectDown()
- until data.name == "minecraft:sand"
- end
- function row()
- turn("east")
- while x < w do
- pillar()
- if turtle.forward() then
- x = x + 1
- end
- end
- while x > 0 do
- if turtle.back() then
- x = x - 1
- end
- end
- end
- function digPillar()
- repeat
- turtle.digDown()
- if turtle.down() then
- z = z - 1
- end
- success, data = turtle.inspectDown()
- until data.name ~= "minecraft:sand"
- while z < 0 do
- if turtle.up() then
- z = z + 1
- end
- end
- end
- function digRow()
- turn("east")
- while x < w do
- digPillar()
- if turtle.forward() then
- x = x + 1
- end
- end
- while x > 0 do
- if turtle.back() then
- x = x - 1
- end
- end
- end
- function fullDig()
- row()
- turn("north")
- while y < l do
- if turtle.forward() then
- y = y + 1
- end
- row()
- turn("south")
- if turtle.forward() then
- y = y - 1
- end
- digRow()
- turn("north")
- if turtle.forward() then
- y = y + 1
- end
- end
- end
- fullDig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement