public static MinecraftMap readBinaryHexFile(File file, MainFrame frame) throws FileNotFoundException, IOException {
MinecraftMap map = new MinecraftMap();
FileInputStream fin = new FileInputStream(file.getAbsolutePath());
int len;
byte data[] = new byte[16];
int column = 0;
int row = 0;
// Read bytes until EOF is encountered.
do {
len = fin.read(data);
for (int z = 0; z < len; z++) {
int id = data[z] & 0xFF;
if (column >= MinecraftMap.WIDTH) {
column = 0;
row++;
} else if (column < MinecraftMap.WIDTH && row < MinecraftMap.WIDTH) {
if (frame.getByColorIndex(id) != null) {
Color color = frame.getByColorIndex(id).getColor();
map.addColor(row, column, color);
} else {
map.addColor(row, column, null);
}
column++;
}
} while (len != -1);
return map;
}
//MinecraftMap.WIDTH => 128