Skip to content

Instantly share code, notes, and snippets.

@smbarbour
Created August 4, 2015 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smbarbour/ca37702f35ba232a24b2 to your computer and use it in GitHub Desktop.
Save smbarbour/ca37702f35ba232a24b2 to your computer and use it in GitHub Desktop.
Convert MapWriter block color file for use with AnvilMapper
#!/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