package hu.akarnokd.theplanetcrafter;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class BuildMap {

    public static void main(String[] args) throws Exception {
        buildMapOf("barren");
        buildMapOf("lush");
    }

    static void buildMapOf(String mode) throws Exception {

        int step = 200;
        int nHorizontal = 6000 / step;
        int nVertical = 4000 / step;

        int w = 80;
        int h = 60;

        BufferedImage bimg = new BufferedImage(w * nHorizontal, h * nVertical, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = bimg.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);

        int outx = 0;
        for (int z = 4000; z >= -2000; z-= step) {

            int outy = 0;
            for (int x = 3000; x >= -1000; x -= step) {

                System.out.println(mode + " - " + z + " : " + x);

                BufferedImage image = ImageIO.read(new File("c:\\temp\\" + mode + "\\map_" + z + "_" + x + ".png"));

                g2.drawImage(image, outx - w / 2, outy - h / 2, outx + w / 2, outy + h / 2, 0, 0, image.getWidth(), image.getHeight(), null);

                outy += h;
            }

            outx += w;
        }

        ImageIO.write(bimg, "png", new File("c:\\temp\\" + mode + "\\map_" + mode + ".png"));
        System.out.println(mode + " Done");
    }
}

@@ -377,16 +377,119 @@
  = 200;%0A
+        int maxZ = 3000;%0A        int minZ = -1400;%0A        int maxX = 2400;%0A        int minX = -1000;%0A%0A
         
@@ -510,12 +510,21 @@
 l = 
-6000
+(maxZ - minZ)
  / s
@@ -552,20 +552,29 @@
 tical = 
-4000
+(maxX - minX)
  / step;
@@ -928,24 +928,23 @@
 z = 
-4000
+maxZ
 ; z %3E= 
--2000
+minZ
 ; z-
@@ -1009,24 +1009,23 @@
 x = 
-3000
+maxX
 ; x %3E= 
--1000
+minX
 ; x 
@@ -1044,32 +1044,34 @@
                 
+//
 System.out.print
@@ -1576,20 +1576,129 @@
 + %22 Done%22);%0A
+        System.out.printf(%22CenterX: %25d, CenterZ: %25d%25n%22, minX + (maxX - minX) / 2, minZ + (maxZ - minZ) / 2);%0A
     %7D%0A%7D%0A

Update TPC mapping