Last active
September 16, 2022 15:08
-
-
Save spilth/37d78fa07e17fd43bb18989542e939e2 to your computer and use it in GitHub Desktop.
Unmined Automation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :build do | |
# Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted | |
puts "Building..." | |
worlds_directory = 'C:\Users\polym\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds\\' | |
newest_world = Dir.entries(worlds_directory).select{|x| x != '.' && x != '..'}.sort_by { |x| File.mtime(worlds_directory + '\\' + x) }.reverse.first | |
puts newest_world | |
world = "C:\\Users\\polym\\AppData\\Local\\Packages\\Microsoft.MinecraftUWP_8wekyb3d8bbwe\\LocalState\\games\\com.mojang\\minecraftWorlds\\#{newest_world}" | |
puts world | |
Dir.mkdir("output") unless Dir.exist?("output") | |
Dir.mkdir("output/overworld") unless Dir.exist?("output/overworld") | |
Dir.mkdir("output/ancient-cities") unless Dir.exist?("output/ancient-cities") | |
Dir.mkdir("output/nether") unless Dir.exist?("output/nether") | |
FileUtils.copy_file("source/index.html", "output/index.html") | |
system("unmined-cli/unmined-cli.exe web render --force --world=#{world} --zoomout 1 --zoomin 3 --shadows true --dimension overworld --output=output/overworld") | |
system("unmined-cli/unmined-cli.exe web render --force --world=#{world} --zoomout 1 --zoomin 3 --shadows true --dimension overworld --output=output/ancient-cities --topY=-43") | |
system("unmined-cli/unmined-cli.exe web render --force --world=#{world} --zoomout 1 --zoomin 3 --shadows true --dimension nether --output=output/nether --topY=61") | |
end | |
task :deploy do | |
puts "Deploying..." | |
system("netlify deploy --dir output --prod") | |
end | |
task default: [:build, :deploy] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment