package electrosphere.game.server.terrain.manager;

import electrosphere.game.server.terrain.models.TerrainModification;
import electrosphere.game.server.terrain.models.TerrainModification;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author amaterasu
 */
public class ServerTerrainChunk {
    int worldX, worldY;
    List<TerrainModification> modifications = new LinkedList();
    float[][] heightMap;
    float[][] macroValues;
    long[][] randomizer;

    public ServerTerrainChunk(int worldX, int worldY, float[][] heightMap, float[][] macroValues, long[][] randomizer) {
        this.worldX = worldX;
        this.worldY = worldY;
        this.heightMap = heightMap;
        this.macroValues = macroValues;
        this.randomizer = randomizer;
    }
    
    public static ServerTerrainChunk getArenaChunk(int width, int x, int y){
        float[][] macroValues = new float[5][5];
        long[][] randomizer = new long[5][5];
        float[][] heightmap = new float[width + 1][width + 1];
        ServerTerrainChunk rVal = new ServerTerrainChunk(x, y, heightmap, macroValues, randomizer);
        rVal.addModification(new TerrainModification(x, y, 3, 3, 5));
        return rVal;
    }

    public int getWorldX() {
        return worldX;
    }

    public int getWorldY() {
        return worldY;
    }

    public List<TerrainModification> getModifications() {
        return modifications;
    }

    public float[][] getHeightMap() {
        return heightMap;
    }

    public float[][] getMacroValues() {
        return macroValues;
    }

    public long[][] getRandomizer() {
        return randomizer;
    }
    
    public void addModification(TerrainModification modification){
        modifications.add(modification);
    }
    
    
}
