Add y-level specific snow, more mountain biomes in default config.

This commit is contained in:
dfsek
2020-10-10 01:22:00 -07:00
parent 4e8ff7ffbb
commit aa378b40ec
8 changed files with 162 additions and 93 deletions

View File

@@ -102,18 +102,23 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
private void prepareBlockPart(BlockData down, BlockData orig, ChunkData chunk, Vector block, Map<Material, Palette<BlockData>> slabs, Map<Material, Palette<BlockData>> stairs, double thresh) {
double _11 = getInterpolatedNoise(block.getBlockX(), block.getBlockY() - 0.4, block.getBlockZ());
if(_11 > thresh) {
double _01 = getInterpolatedNoise(block.getBlockX() - 0.5, block.getBlockY(), block.getBlockZ());
double _10 = getInterpolatedNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() - 0.5);
double _12 = getInterpolatedNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() + 0.5);
double _21 = getInterpolatedNoise(block.getBlockX() + 0.5, block.getBlockY(), block.getBlockZ());
if(stairs != null) {
Palette<BlockData> stairPalette = stairs.get(down.getMaterial());
if(stairPalette != null) {
BlockData stair = stairPalette.get(0, block.getBlockX(), block.getBlockZ());
Stairs finalStair = getStair(new double[] {_01, _10, _12, _21}, (Stairs) stair, thresh);
if(finalStair != null) {
if(orig.matches(DataUtil.WATER)) finalStair.setWaterlogged(true);
chunk.setBlock(block.getBlockX(), block.getBlockY(), block.getBlockZ(), finalStair);
Stairs stairNew = (Stairs) stair.clone();
if(getInterpolatedNoise(block.getBlockX() - 0.5, block.getBlockY(), block.getBlockZ()) > thresh) {
stairNew.setFacing(BlockFace.WEST);
} else if(getInterpolatedNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() - 0.5) > thresh) {
stairNew.setFacing(BlockFace.NORTH);
} else if(getInterpolatedNoise(block.getBlockX(), block.getBlockY(), block.getBlockZ() + 0.5) > thresh) {
stairNew.setFacing(BlockFace.SOUTH);
} else if(getInterpolatedNoise(block.getBlockX() + 0.5, block.getBlockY(), block.getBlockZ()) > thresh) {
stairNew.setFacing(BlockFace.EAST);
} else stairNew = null;
if(stairNew != null) {
if(orig.matches(DataUtil.WATER)) stairNew.setWaterlogged(true);
chunk.setBlock(block.getBlockX(), block.getBlockY(), block.getBlockZ(), stairNew);
return;
}
}
@@ -126,21 +131,6 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
}
}
private static Stairs getStair(double[] vals, Stairs stair, double thresh) {
if(vals.length != 4) throw new IllegalArgumentException();
Stairs stairNew = (Stairs) stair.clone();
if(vals[0] > thresh) {
stairNew.setFacing(BlockFace.WEST);
} else if(vals[1] > thresh) {
stairNew.setFacing(BlockFace.NORTH);
} else if(vals[2] > thresh) {
stairNew.setFacing(BlockFace.SOUTH);
} else if(vals[3] > thresh) {
stairNew.setFacing(BlockFace.EAST);
} else return null;
return stairNew;
}
private void load(World w) {
try {
popMan.loadBlocks(w);