package io.wildernesstp.generator;

/**
 * MIT License
 * <p>
 * Copyright (c) 2019 Quintin VanBooven
 * <p>
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * <p>
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * <p>
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
public final class GeneratorOptions {

    public static final int MIN_WORLD_WIDTH = -30_000_000;
    public static final int MAX_WORLD_WIDTH = 30_000_000;
    public static final int DEFAULT_LIMIT = 10;

    private int minX, minZ;
    private int maxX, maxZ;
    private int limit;

    public GeneratorOptions(int minX, int minZ, int maxX, int maxZ, int limit) {
        this.setMinX(minX);
        this.setMinZ(minZ);
        this.setMaxX(maxX);
        this.setMaxZ(maxZ);
        this.setLimit(limit);
    }

    public GeneratorOptions() {
        this.minX = MIN_WORLD_WIDTH;
        this.maxX = MAX_WORLD_WIDTH;
        this.minZ = MIN_WORLD_WIDTH;
        this.maxZ = MAX_WORLD_WIDTH;
        this.limit = DEFAULT_LIMIT;
    }

    public void setMinX(int minX) {
        if (minX >= maxX || minX < MIN_WORLD_WIDTH) {
            minX = MIN_WORLD_WIDTH;
        }

        this.minX = minX;
    }

    public void setMinZ(int minZ) {
        if (minZ >= maxZ || minZ < MIN_WORLD_WIDTH) {
            minZ = MIN_WORLD_WIDTH;
        }

        this.minZ = minZ;
    }

    public void setMaxX(int maxX) {
        if (maxX <= minX || maxX > MAX_WORLD_WIDTH) {
            maxX = MAX_WORLD_WIDTH;
        }

        this.maxX = maxX;
    }

    public void setMaxZ(int maxZ) {
        if (maxZ <= minZ || maxZ > MAX_WORLD_WIDTH) {
            maxZ = MAX_WORLD_WIDTH;
        }

        this.maxZ = maxZ;
    }

    public void setLimit(int limit) {
        if (limit <= 0) {
            limit = DEFAULT_LIMIT;
        }

        this.limit = limit;
    }

    public int getMinX() {
        return minX;
    }

    public int getMinZ() {
        return minZ;
    }

    public int getMaxX() {
        return maxX;
    }

    public int getMaxZ() {
        return maxZ;
    }

    public int getLimit() {
        return limit;
    }
}

@@ -1334,32 +1334,84 @@
 H = 30_000_000;%0A
+    public static final int MAX_WORLD_HEIGHT = 255;%0A
     public stati
@@ -1464,16 +1464,22 @@
 nt minX,
+ minY,
  minZ;%0A 
@@ -1498,16 +1498,22 @@
 nt maxX,
+ maxY,
  maxZ;%0A 
@@ -1572,16 +1572,26 @@
 nt minX,
+ int minY,
  int min
@@ -1602,16 +1602,26 @@
 nt maxX,
+ int maxY,
  int max
@@ -1660,24 +1660,52 @@
 MinX(minX);%0A
+        this.setMinY(minY);%0A
         this
@@ -1744,24 +1744,52 @@
 MaxX(maxX);%0A
+        this.setMaxY(maxY);%0A
         this
@@ -2013,32 +2013,70 @@
 AX_WORLD_WIDTH;%0A
+        this.maxY = MAX_WORLD_HEIGHT;%0A
         this.lim
@@ -2262,32 +2262,178 @@
 nX = minX;%0A    %7D
+%0A    %0A    public void setMinY(int minY) %7B%0A        if (minY %3E= maxY %7C%7C minY %3C 0) %7B%0A            minY = 0;%0A        %7D%0A%0A        this.minY = minY;%0A    %7D
 %0A%0A    public voi
@@ -2748,32 +2748,208 @@
 xX = maxX;%0A    %7D
+%0A    %0A    public void setMaxY(int maxY) %7B%0A        if (maxY %3C= minY %7C%7C maxY %3E MAX_WORLD_HEIGHT) %7B%0A            maxY = MAX_WORLD_HEIGHT;%0A        %7D%0A%0A        this.maxY = maxY;%0A    %7D
 %0A%0A    public voi

Update GeneratorOptions.java