if (this.blockDataValuesArray == null)
{
this.initializeSmallByteArray(world.getSeed());
}
LocalMaterialData biomeSurfaceBlock = biomeConfig.surfaceBlock;
LocalMaterialData biomeGroundBlock = biomeConfig.groundBlock;
// The following line prevents grass growing on dirt, but still allows
// the user to change the ground block to something else without us
// changing the block data
int biomeGroundBlockData = biomeGroundBlock.isMaterial(DefaultMaterial.DIRT) ? 1 : 0;
// Check for river water
boolean foundWater = false;
int highestBlockY = world.getHighestBlockYAt(x, z) - 1;
if (highestBlockY <= biomeConfig.riverWaterLevel)
{
foundWater = true;
}
// Bryce spike calculations
double bryceHeight = 0.0D;
if (this.isBryceMesa && !foundWater)
{
if (this.noiseGenBryce1 == null || this.noiseGenBryce2 == null)
{
Random newRandom = new Random(world.getSeed());
this.noiseGenBryce1 = new NoiseGeneratorNewOctaves(newRandom, 4);
this.noiseGenBryce2 = new NoiseGeneratorNewOctaves(newRandom, 1);
}
double bryceNoiseValue = Math.min(Math.abs(noise), this.noiseGenBryce1.a(x * 0.25D, z * 0.25D));
if (bryceNoiseValue > 0.0D)
{
double d3 = 0.001953125D;
double d4 = Math.abs(this.noiseGenBryce2.a(x * d3, z * d3));
bryceHeight = bryceNoiseValue * bryceNoiseValue * 2.5D;
double d5 = Math.ceil(d4 * 50.0D) + 14.0D;
if (bryceHeight > d5)
{
bryceHeight = d5;
}
bryceHeight += 64.0D;
}
}
int waterLevel = biomeConfig.waterLevelMax;
LocalMaterialData currentGroundBlock = whiteStainedClay;
int noisePlusRandomFactor = (int) (noise / 3.0D + 3.0D + random.nextDouble() * 0.25D);
boolean cosNoiseIsLargerThanZero = MathHelper.cos((float) (noise / 3.0D * Math.PI)) > 0.0D;
int j1 = -1;
boolean belowSand = false;
int maxHeight = world.getSolidHeight(x, z) - 1;
int minHeight = Math.min(maxHeight - 6, waterLevel - 4);
// Max height needs to be increased for the bryce spikes
if (this.isBryceMesa && !foundWater)
{
maxHeight = Math.max((int) bryceHeight, maxHeight);
}
for (int y = maxHeight; y >= minHeight; y--)
{
LocalMaterialData blockAtPosition = world.getMaterial(x, y, z);
if (!blockAtPosition.isSolid() && y < bryceHeight)
{
// Lie about the current block to generate the Bryce spikes
blockAtPosition = TerrainControl.toLocalMaterialData(DefaultMaterial.STONE, 0);
}
if (blockAtPosition.isAir())
{
j1 = -1;
} else if (blockAtPosition.isSolid())
{
byte blockData;
if (j1 == -1)
{