// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.builtin.hytalegenerator.framework.math;

public class RegionGrid
{
    private int regionSizeX;
    private int regionSizeZ;
    
    public RegionGrid(final int regionSizeX, final int regionSizeZ) {
        this.regionSizeX = regionSizeX;
        this.regionSizeZ = regionSizeZ;
    }
    
    public int regionMinX(final int chunkX) {
        if (chunkX >= 0) {
            return chunkX / this.regionSizeX * this.regionSizeX;
        }
        return (chunkX - (this.regionSizeZ - 1)) / this.regionSizeX * this.regionSizeX;
    }
    
    public int regionMinZ(final int chunkZ) {
        if (chunkZ >= 0) {
            return chunkZ / this.regionSizeZ * this.regionSizeZ;
        }
        return (chunkZ - (this.regionSizeX - 1)) / this.regionSizeZ * this.regionSizeZ;
    }
    
    public int regionMaxX(final int chunkX) {
        return this.regionMinX(chunkX) + this.regionSizeX;
    }
    
    public int regionMaxZ(final int chunkZ) {
        return this.regionMinZ(chunkZ) + this.regionSizeZ;
    }
}
