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 maxZ = 3000;
        int minZ = -1400;
        int maxX = 2400;
        int minX = -1000;

        int nHorizontal = (maxZ - minZ) / step;
        int nVertical = (maxX - minX) / 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 = maxZ; z >= minZ; z-= step) {

            int outy = 0;
            for (int x = maxX; x >= minX; 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");
        System.out.printf("CenterX: %d, CenterZ: %d%n", minX + (maxX - minX) / 2, minZ + (maxZ - minZ) / 2);
    }
}

@@ -48,17 +48,58 @@
 ava.awt.
-*
+Graphics2D;%0Aimport java.awt.RenderingHints
 ;%0Aimport
@@ -149,16 +149,64 @@
 io.File;
+%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Aimport
@@ -376,24 +376,65 @@
 ush%22);%0A    %7D
+%0A    %0A    record Coords(int x, int z) %7B %7D
 %0A%0A    static
@@ -502,17 +502,17 @@
  step = 
-2
+1
 00;%0A    
@@ -608,16 +608,43 @@
 = -1000;
+%0A        int defaultY = 50;
 %0A%0A      
@@ -752,9 +752,9 @@
 w = 
-8
+4
 0;%0A 
@@ -772,11 +772,202 @@
 h = 
-6
+3
 0;
+%0A        Map%3CCoords, Integer%3E heightMap = new HashMap%3C%3E();%0A        // customize which height to pick from the map photos%0A        %0A        // --------------------------------------------------
 %0A%0A  
@@ -1066,17 +1066,16 @@
 YPE_INT_
-A
 RGB);%0A  
@@ -1399,18 +1399,16 @@
         
-//
 System.o
@@ -1448,16 +1448,92 @@
  %22 + x);
+%0A                int y = heightMap.getOrDefault(new Coords(x, z), defaultY);
 %0A%0A      
@@ -1632,16 +1632,26 @@
 _%22 + x +
+ %22_%22 + y +
  %22.png%22)
@@ -1650,24 +1650,128 @@
  %22.png%22));%0A%0A
+                int iw = image.getWidth();%0A                int ih = image.getHeight();%0A                %0A
             
@@ -1854,49 +1854,46 @@
  2, 
-0, 0, image.getWidth(), image.getHeight()
+iw / 4, ih / 4, iw * 3 / 4, ih * 3 / 4
 , nu

Use smaller tiles