public static MakeNormalFoliage ( |
||
w | ||
Pos | Vector3I | |
Height | int | |
return | void |
public static void MakeNormalFoliage( World w, Vector3I Pos, int Height )
{
int topy = Pos.Z + Height - 1;
int start = topy - 2;
int end = topy + 2;
for ( int y = start; y < end; y++ ) {
int rad;
if ( y > start + 1 ) {
rad = 1;
} else {
rad = 2;
}
for ( int xoff = -rad; xoff < rad + 1; xoff++ ) {
for ( int zoff = -rad; zoff < rad + 1; zoff++ ) {
if ( w.Map != null && w.IsLoaded ) {
if ( Rand.NextDouble() > .618 &&
Math.Abs( xoff ) == Math.Abs( zoff ) &&
Math.Abs( xoff ) == rad ) {
continue;
}
w.Map.QueueUpdate( new
BlockUpdate( null, ( short )( Pos.X + xoff ), ( short )( Pos.Y + zoff ), ( short )y, Block.Leaves ) );
}
}
}
}
}
private void MakeTrunks(short height, TreeType type) { for (short i = 0; i < height; ++i) { _map.QueueUpdate(new BlockUpdate(null, _x, _y, (short)(_z + i), Block.Log)); } if (TreeType.Normal == type) { TreeGeneration.MakeNormalFoliage(_world, new Vector3I(_x, _y, _z), height + 1); } else { TreeGeneration.MakePalmFoliage(_world, new Vector3I(_x, _y, _z), height); } }