Added other materials

This commit is contained in:
2020-04-05 19:33:48 -06:00
parent 3101d508e0
commit 3dc79bb77d
5 changed files with 20 additions and 5 deletions

View File

@@ -19,9 +19,15 @@ public class BlockMaterials {
materials.put("grass",new Block("grass",true,false,true,true,true));
materials.put("wood",new Block("wood",false,true,true,true,false));
materials.put("water",new Block("water",true,false,false,false,false));
materials.put("stone",new Block("stone",true,false,false,false,false));
materials.put("snow",new Block("snow",true,false,false,false,false));
materials.put("sand",new Block("sand",true,false,false,false,false));
textures.put("grass", new Texture("core/assets/grass.png"));
textures.put("wood", new Texture("core/assets/wood.png"));
textures.put("water", new Texture("core/assets/water.png"));
textures.put("stone", new Texture("core/assets/stone.png"));
textures.put("snow", new Texture("core/assets/snow.png"));
textures.put("sand", new Texture("core/assets/sand.png"));
}
}

View File

@@ -26,14 +26,23 @@ public class Chunks {
}
public Block getTerrain(int i, int j) {
OpenSimplexNoise openSimplexNoise = new OpenSimplexNoise(seed);
double terrainType = openSimplexNoise.eval(i*0.01,j*0.01);
if(terrainType < 0.3) {
return BlockMaterials.materials.get("grass");
double terrainType = openSimplexNoise.eval(i*0.001,j*0.001);
if(terrainType < 0){
return BlockMaterials.materials.get("water");
}
else if(terrainType < 0.05 && terrainType > 0){
return BlockMaterials.materials.get("sand");
}
else if (terrainType > 0.7){
return BlockMaterials.materials.get("snow");
}
else if (terrainType > 0.5){
return BlockMaterials.materials.get("stone");
}
else {
return BlockMaterials.materials.get("water");
return BlockMaterials.materials.get("grass");
}
}