Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- local depth = 0
- local xPos,zPos = 0,0
- local xDir,zDir = 0,1
- local goTo
- local count = 0
- local function turnLeft()
- turtle.turnLeft()
- xDir, zDir = -zDir, xDir
- end
- local function turnRight()
- turtle.turnRight()
- xDir, zDir = zDir, -xDir
- end
- function goTo( x, y, z, xd, zd )
- while depth > y do
- if turtle.up() then
- depth = depth - 1
- else
- turtle.digUp()
- end
- end
- if xPos > x then
- while xDir ~= -1 do
- turnLeft()
- end
- while xPos > x do
- if turtle.forward() then
- xPos = xPos - 1
- else
- turtle.dig()
- end
- end
- elseif xPos < x then
- while xDir ~= 1 do
- turnLeft()
- end
- while xPos < x do
- if turtle.forward() then
- xPos = xPos + 1
- else
- turtle.dig()
- end
- end
- end
- if zPos > z then
- while zDir ~= -1 do
- turnLeft()
- end
- while zPos > z do
- if turtle.forward() then
- zPos = zPos - 1
- else
- turtle.dig()
- end
- end
- elseif zPos < z then
- while zDir ~= 1 do
- turnLeft()
- end
- while zPos < z do
- if turtle.forward() then
- zPos = zPos + 1
- else
- turtle.dig()
- end
- end
- end
- while depth < y do
- if turtle.down() then
- depth = depth + 1
- else
- turtle.digDown()
- end
- end
- if zd ~= xd then
- while zDir ~= zd or xDir ~= xd do
- turnRight()
- end
- end
- end
- -- start --
- turtle.select(1)
- goTo(1, 1, 0, 0, -1)
- local scanning = true
- while scanning do
- local success, data = turtle.inspect()
- if success and data.name == "minecraft:hopper" then
- count = count + 1
- goTo(1, (1 + count), 0, 0, -1)
- else
- scanning = false
- end
- end
- goTo(0, 0, 0, 0, -1)
- turtle.dig()
- goTo(0, 0, -1, 0, -1)
- turnLeft() turtle.dig() turnRight()
- goTo(0, 0, -2, 1, 0)
- for i=1, count do
- goTo(0, i, -2, 1, 0)
- turtle.dig() turtle.digDown()
- end
- goTo(1, count, -2, -1, 0)
- goTo(1, count, -1, -1, 0)
- goTo(1, 0, -1, -1, 0)
- goTo(0, 0, 0, 0, 1)
- print("Packed!")
- if #tArgs > 0 then
- if tArgs[1] == "go" then
- local n = 0
- local arrived = false
- while not arrived do
- if turtle.forward() then
- n = n + 1
- if n == 16 then
- arrived = true
- end
- else
- turtle.dig()
- end
- end
- shell.run("setup exf")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement