package Hexel.generation.terrainGenerator.originalPlateGenerator;
import java.util.Random;
import Hexel.blocks.types.Block;
import Hexel.blocks.types.BlockEmpty;
import Hexel.blocks.types.BlockSeed;
import Hexel.blocks.types.BlockStone;
import Hexel.generation.terrainGenerator.TerrainMap;
import Hexel.generation.terrainGenerator.originalPlateGenerator.heightMap.HexBlockHeightMaps;
import Hexel.math.Vector2i;
import Hexel.util.Cleanup;
public class OldTerrainMap implements TerrainMap {
private HexBlockHeightMaps hbhms;
// private static final int SCALE = 2;
//
// private static final BlockEmpty emptyBlock = new BlockEmpty();
// private static final BlockGrass grassBlock = new BlockGrass();
// private static final BlockStone stoneBlock = new BlockStone();
// private static final BlockWood woodBlock = new BlockWood();
// private static final BlockGlass glassBlock = new BlockGlass();
public OldTerrainMap(Cleanup cleanup) {
this.hbhms = new HexBlockHeightMaps(cleanup);
}
public int getHeightMapAt(int x, int y, Vector2i tmp){ return 0; }
@Override
public Block getBlock(int x, int y, int z, Vector2i tmp) {
int height = this.hbhms.getBlockHeight(x, y, tmp);
if (z < height)
return BlockStone.Make(BlockStone.MAX_HEALTH);
else if (z == height){
int hash = 3;
hash = 97 * hash + x;
hash = 97 * hash + y;
hash = 97 * hash + z;
Random random = new Random(hash);
if (random.nextDouble() < .01) {
return BlockSeed.Make(5, BlockSeed.MAX_HEALTH);
}
else {
return BlockEmpty.Make(0);
}
}
else {
return BlockEmpty.Make(0);
}
}
}