Created
August 4, 2015 02:07
-
-
Save smbarbour/ca37702f35ba232a24b2 to your computer and use it in GitHub Desktop.
Convert MapWriter block color file for use with AnvilMapper
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
#!/usr/bin/perl | |
use strict; | |
open(IN, "<", $ARGV[0]); | |
my @fields; | |
while(<IN>) { | |
@fields = split(' ', $_); | |
if ($fields[1] ne '*') { | |
if ($fields[0] eq 'biome') { | |
$fields[1] = unpack("H2",(pack "c", $fields[1])); | |
} elsif ($fields[0] eq 'blocktype' || $fields[0] eq 'block') { | |
$fields[1] = substr((reverse unpack("h4",(pack "i", $fields[1]))),1,3); | |
} | |
} | |
print join(' ', @fields) . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment