Prevented villages from spawning in the Jade Cliffs and Highland

This commit is contained in:
Adubbz 2016-01-03 21:53:43 +11:00
parent ac6107b148
commit 8d2976992a
3 changed files with 45 additions and 0 deletions

View file

@ -35,6 +35,8 @@ public class BiomeGenHighland extends BOPBiome
this.setColor(0x7CAD66);
this.setTemperatureRainfall(0.5F, 0.8F);
this.canGenerateVillages = false;
this.addWeight(BOPClimates.COOL_TEMPERATE, 7);
// other plants

View file

@ -40,6 +40,8 @@ public class BiomeGenJadeCliffs extends BOPBiome
this.skyColor = 0xB7CCAD;
this.setTemperatureRainfall(0.8F, 0.9F);
this.canGenerateVillages = false;
this.addWeight(BOPClimates.WET_TEMPERATE, 3);
this.addGenerator("limestone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(26).splotchSize(25).replace(Blocks.stone).with(BOPBlocks.stone.getDefaultState().withProperty(BlockBOPStone.VARIANT, BlockBOPStone.StoneType.LIMESTONE)).create());

View file

@ -271,4 +271,45 @@ public class WorldChunkManagerBOP extends WorldChunkManager
return new GenLayer[] {riverMixFinal, biomesFinal, riverMixFinal};
}
@Override
public boolean areBiomesViable(int x, int z, int radius, List<BiomeGenBase> allowedBiomes)
{
IntCache.resetIntCache();
int minX = x - (radius >> 2);
int minY = z - (radius >> 2);
int maxX = x + (radius >> 2);
int maxY = z + (radius >> 2);
int areaWidth = maxX - minX + 1; //Find difference between the min and the max X. Add 1 as the result cannot be 0
int areaHeight = maxY - minY + 1; //Find difference between the min and the max Y. Add 1 as the result cannot be 0
int[] biomeIds = this.genBiomes.getInts(minX, minY, areaWidth, areaHeight); //Create an array of the biome ids within the desired area
try
{
//Ensure entire area contains only desired biomes
for (int index = 0; index < areaWidth * areaHeight; ++index)
{
BiomeGenBase biomegenbase = BiomeGenBase.getBiome(biomeIds[index]);
if (!allowedBiomes.contains(biomegenbase))
{
return false; //Stop checking, we have found an undesirable biome
}
}
return true;
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
crashreportcategory.addCrashSection("Layer", this.genBiomes.toString());
crashreportcategory.addCrashSection("x", Integer.valueOf(x));
crashreportcategory.addCrashSection("z", Integer.valueOf(z));
crashreportcategory.addCrashSection("radius", Integer.valueOf(radius));
crashreportcategory.addCrashSection("allowed", allowedBiomes);
throw new ReportedException(crashreport);
}
}
}