Implement additional cave config

This commit is contained in:
dfsek
2020-09-25 02:04:55 -07:00
parent f983bf06fa
commit f727e9d297
9 changed files with 106 additions and 24 deletions

View File

@@ -35,9 +35,15 @@ public class CavePopulator extends BlockPopulator {
if(e.getValue().equals(CarvingData.CarvingType.CENTER) && c.isReplaceableInner(m)) {
if(c.getShiftedBlocks().containsKey(b.getType())) shiftCandidate.put(b.getLocation(), b.getType());
b.setBlockData(c.getPaletteInner(v.getBlockY()).get(random), false);
} else if(c.isReplaceableOuter(m)){
} else if(e.getValue().equals(CarvingData.CarvingType.WALL) && c.isReplaceableOuter(m)){
if(c.getShiftedBlocks().containsKey(b.getType())) shiftCandidate.put(b.getLocation(), b.getType());
b.setBlockData(c.getPaletteOuter(v.getBlockY()).get(random), false);
} else if(e.getValue().equals(CarvingData.CarvingType.TOP) && c.isReplaceableTop(m)){
if(c.getShiftedBlocks().containsKey(b.getType())) shiftCandidate.put(b.getLocation(), b.getType());
b.setBlockData(c.getPaletteTop(v.getBlockY()).get(random), false);
} else if(e.getValue().equals(CarvingData.CarvingType.BOTTOM) && c.isReplaceableBottom(m)){
if(c.getShiftedBlocks().containsKey(b.getType())) shiftCandidate.put(b.getLocation(), b.getType());
b.setBlockData(c.getPaletteBottom(v.getBlockY()).get(random), false);
}
if(c.getUpdateBlocks().contains(m)) {
updateNeeded.add(b);

View File

@@ -25,7 +25,7 @@ public class TreePopulator extends GaeaBlockPopulator {
Biome b = TerraBiomeGrid.fromWorld(world).getBiome(origin);
if(((UserDefinedDecorator) b.getDecorator()).getTreeChance() < random.nextInt(100)) return;
int numTrees = 0;
for(int i = 0; i < 10; i++) {
for(int i = 0; i < 48; i++) {
int y = WorldUtil.getHighestValidSpawnAt(chunk, x, z);
if(y <= 0) continue;
origin = chunk.getBlock(x, y, z).getLocation().add(0, 1, 0);
@@ -34,7 +34,7 @@ public class TreePopulator extends GaeaBlockPopulator {
try {
b.getDecorator().getTrees().get(random).plant(origin, random, false, Terra.getInstance());
} catch(NullPointerException ignored) {}
if(numTrees >= b.getDecorator().getTreeDensity()) return;
if(numTrees >= b.getDecorator().getTreeDensity()) break;
x = random.nextInt(16); // Decrease chances of chunk-crossing trees
z = random.nextInt(16);
}