Skip to content

Instantly share code, notes, and snippets.

@brianmadden
Created January 29, 2011 04:03
Show Gist options
  • Save brianmadden/801505 to your computer and use it in GitHub Desktop.
Save brianmadden/801505 to your computer and use it in GitHub Desktop.
Haskell Script to update my minecraft map render
import System.Directory
import System.IO
import IO
import GHC.IO.Handle
import System.Process
import Text.Printf
main = do
-- Change directory to the mc_mapping dir
setCurrentDirectory "/home/untwisted/projects/mc_mapping/"
-- Run the rsync process
-- rsync -irz cooleo@fuelsyourcyb.org:minecraft/minecraft_b/bin/world/ world/ | tee chunks2.out
rsync_out <- readProcess "rsync" ["-rvz",
"/home/cooleo/minecraft/minecraft_beta/world",
"/home/untwisted/projects/mc_mapping/"] []
-- Write chunks to file so only they are updated
let rsync_out' = lines rsync_out
writeFile "chunks.out" $ clean rsync_out'
-- call pigmap
pigmap_out <- readProcess "/home/untwisted/projects/minecraft/pigmap/pigmap"
["-i", "/home/untwisted/projects/mc_mapping/world/",
"-o", "/home/untwisted/projects/mc_mapping/tiles/",
"-g", "/home/untwisted/projects/mc_mapping/",
"-c", "/home/untwisted/projects/mc_mapping/chunks.out",
"-h", "3", "-x"] []
printf "MAP UPDATED"
where clean =
unlines . tail . init . init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment