Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local width, height = term.getSize()
- local function update(text)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 9)
- term.clearLine()
- term.setCursorPos(math.floor(width/2 - string.len(text)/2), 9)
- write(text)
- end
- local function bar(ratio)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lime)
- term.setCursorPos(1, 11)
- for i = 1, width do
- if (i/width < ratio) then
- write("]")
- else
- write(" ")
- end
- end
- end
- local function download(path)
- update("Downloading " .. path .. "...")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 13)
- term.clearLine()
- term.setCursorPos(1, 14)
- term.clearLine()
- term.setCursorPos(1, 15)
- term.clearLine()
- term.setCursorPos(1, 16)
- term.clearLine()
- term.setCursorPos(1, 17)
- term.clearLine()
- term.setCursorPos(1, 13)
- print("Accessing https://raw.githubusercontent.com/Xella37/CC-Minecraft/master/"..path)
- local rawData = http.get("https://raw.githubusercontent.com/Xella37/CC-Minecraft/master/"..path)
- local data = rawData.readAll()
- local file = fs.open(path, "w")
- file.write(data)
- file.close()
- end
- function install()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- term.clear()
- local str = "CC:Minecraft Installer"
- term.setCursorPos(math.floor(width/2 - #str / 2), 2)
- write(str)
- local total = 21
- update("Installing...")
- bar(0)
- download("Minecraft.lua")
- bar(1/total)
- download("Pine3D-minified.lua")
- bar(2/total)
- download("betterblittle.lua")
- bar(3/total)
- download("blittle")
- bar(4/total)
- download("noise.lua")
- bar(5/total)
- download("hotbar.nfp")
- bar(6/total)
- download("hotbarb.nfp")
- bar(7/total)
- download("logo.nfp")
- bar(8/total)
- download("hotbarb.nfp")
- bar(9/total)
- download("worldGradient.nfp")
- bar(10/total)
- download("controls.txt")
- bar(11/total)
- download("README.md")
- bar(12/total)
- download("LICENSE")
- bar(13/total)
- update("Creating models folder...")
- fs.makeDir("models")
- bar(14/total)
- download("models/dirt")
- bar(15/total)
- download("models/grass")
- bar(16/total)
- download("models/leaves")
- bar(17/total)
- download("models/sand")
- bar(18/total)
- download("models/stone")
- bar(19/total)
- download("models/water")
- bar(20/total)
- download("models/wood")
- bar(21/total)
- update("Installation finished!")
- sleep(1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- write("Finished installation!\nPress any key to close...")
- os.pullEventRaw()
- term.clear()
- term.setCursorPos(1, 1)
- end
- install()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement