Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- if not os.loadAPI("apis/lip")
- or not lip then
- error("Cant find World Interface",0)
- else
- wi = lip.WorldInterface
- end
- local x,y,z = gps.locate()
- x = math.floor(x)
- y = math.floor(y)
- z = math.floor(z)
- term.setCursorPos(1,1)
- term.clear()
- term.setCursorBlink(true)
- term.write("X=")
- x = tonumber(read(nil,{tonumber(x)}))
- sleep(.2)
- term.setCursorPos(1,2)
- term.write("Y=")
- y = tonumber(read(nil,{tonumber(y)}))
- sleep(.2)
- term.setCursorPos(1,3)
- term.write("Z=")
- z = tonumber(read(nil,{tonumber(z)}))
- sleep(.2)
- term.setCursorBlink(false)
- local function displayHelp()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.clear()
- print(string.format([[Controls:
- %s West (-x) [right]
- %s North (-z) [up]
- %s East (+x) [left]
- %s South (+z) [down]
- %s Down (-y) [pageDown]
- %s Up (+y) [pageUp]
- %s
- R Refresh
- H Help
- Q Quit]],
- string.char(27),
- string.char(24),
- string.char(26),
- string.char(25),
- string.char(31),
- string.char(30),
- string.rep(string.char(140),25)))
- sleep(.5)
- os.pullEvent("key")
- sleep(.2)
- end
- local function pos()
- term.setCursorPos(1,1)
- term.clearLine()
- term.write(string.format([[X:%s, Y:%s, Z:%s]],tostring(x),tostring(y),tostring(z)))
- term.setCursorPos(1,2)
- end
- local getDatatags = false
- while true do
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- pos()
- local o = getDatatags and wi.getBlockDatatags(x,y,z) or wi.getBlockInfos(x,y,z)
- textutils.pagedPrint(textutils.serialise(o))
- if getDatatags then
- print(string.rep(string.char(140),25))
- sleep(.5)
- os.pullEvent("key")
- sleep(.3)
- term.clear()
- pos()
- getDatatags = false
- end
- while true do
- sleep(.1)
- local e,p = os.pullEvent("key")
- --refresh
- if p==keys.r or p==keys.enter then
- break
- elseif p==keys.up then
- z = z-1
- pos()
- elseif p==keys.down then
- z = z+1
- pos()
- elseif p==keys.right then
- x = x+1
- pos()
- elseif p==keys.left then
- x = x-1
- pos()
- elseif p==keys.pageDown then
- y = math.max(1,y-1)
- pos()
- elseif p==keys.pageUp then
- y = y+1
- pos()
- elseif p==keys.numPadAdd then
- getDatatags = true
- break
- elseif p==keys.h then
- displayHelp()
- break
- elseif p==keys.q then
- sleep(.3)
- error("Terminated",0)
- return
- end
- end
- end
Add Comment
Please, Sign In to add comment