Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --requires CC 1.76 or higher (MC 1.8 or higher)
- local endit = function(code)
- local codes = {
- [1] = "Your ComputerCraft version is too low. You need CC1.76 or higher (for Minecraft 1.8)",
- [2] = fs.getName(shell.getRunningProgram()).." <program> ...",
- }
- print(codes[code or 2])
- error()
- end
- if _HOST then
- if tonumber(_HOST:sub(15,18)) < 1.76 then
- endit(1)
- end
- else
- endit(1)
- end
- if tonumber(os.version():sub(9)) < 1.7 then
- endit(1)
- end
- local getFile = function(filename,url)
- if fs.isReadOnly(filename) then
- return false, "access denied"
- end
- local prog = http.get(url)
- if not prog then
- return false, "could not connect"
- end
- prog = prog.readAll()
- local fyle = fs.open(filename,"w")
- fyle.write(prog)
- fyle.close()
- return true, fs.getSize(filename)
- end
- local apidir = fs.combine(shell.dir(),"blittle")
- if (not blittle) then
- if fs.exists(apidir) then
- os.loadAPI(apidir)
- else
- print("Downloading blittle...")
- local res = getFile(apidir,"http://pastebin.com/raw/ujchRSnU")
- if not res then
- error("...but couldn't!")
- else
- os.loadAPI(apidir)
- end
- end
- end
- local tArg = {...}
- local mon = blittle.createWindow()
- local oldTerm = term.redirect(mon)
- mon.setVisible(true)
- shell.run(unpack(tArg))
- mon.setVisible(false)
- term.redirect(oldTerm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement