    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class WorldGenTaiga1 extends WorldGenerator
    006    {
    007        public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    008        {
    009            int var6 = par2Random.nextInt(5) + 7;
    010            int var7 = var6 - par2Random.nextInt(2) - 3;
    011            int var8 = var6 - var7;
    012            int var9 = 1 + par2Random.nextInt(var8 + 1);
    013            boolean var10 = true;
    014
    015            if (par4 >= 1 && par4 + var6 + 1 <= 128)
    016            {
    017                int var11;
    018                int var13;
    019                int var14;
    020                int var15;
    021                int var18;
    022
    023                for (var11 = par4; var11 <= par4 + 1 + var6 && var10; ++var11)
    024                {
    025                    boolean var12 = true;
    026
    027                    if (var11 - par4 < var7)
    028                    {
    029                        var18 = 0;
    030                    }
    031                    else
    032                    {
    033                        var18 = var9;
    034                    }
    035
    036                    for (var13 = par3 - var18; var13 <= par3 + var18 && var10; ++var13)
    037                    {
    038                        for (var14 = par5 - var18; var14 <= par5 + var18 && var10; ++var14)
    039                        {
    040                            if (var11 >= 0 && var11 < 128)
    041                            {
    042                                var15 = par1World.getBlockId(var13, var11, var14);
    043
    044                                Block block = Block.blocksList[var15];
    045
    046                                if (var15 != 0 && (block == null || !block.isLeaves(par1World, var13, var11, var14)))
    047                                {
    048                                    var10 = false;
    049                                }
    050                            }
    051                            else
    052                            {
    053                                var10 = false;
    054                            }
    055                        }
    056                    }
    057                }
    058
    059                if (!var10)
    060                {
    061                    return false;
    062                }
    063                else
    064                {
    065                    var11 = par1World.getBlockId(par3, par4 - 1, par5);
    066
    067                    if ((var11 == Block.grass.blockID || var11 == Block.dirt.blockID) && par4 < 128 - var6 - 1)
    068                    {
    069                        this.setBlock(par1World, par3, par4 - 1, par5, Block.dirt.blockID);
    070                        var18 = 0;
    071
    072                        for (var13 = par4 + var6; var13 >= par4 + var7; --var13)
    073                        {
    074                            for (var14 = par3 - var18; var14 <= par3 + var18; ++var14)
    075                            {
    076                                var15 = var14 - par3;
    077
    078                                for (int var16 = par5 - var18; var16 <= par5 + var18; ++var16)
    079                                {
    080                                    int var17 = var16 - par5;
    081
    082                                    Block block = Block.blocksList[par1World.getBlockId(var14, var13, var16)];
    083
    084                                    if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) &&
    085                                        (block == null || block.canBeReplacedByLeaves(par1World, var14, var13, var16)))
    086                                    {
    087                                        this.setBlockAndMetadata(par1World, var14, var13, var16, Block.leaves.blockID, 1);
    088                                    }
    089                                }
    090                            }
    091
    092                            if (var18 >= 1 && var13 == par4 + var7 + 1)
    093                            {
    094                                --var18;
    095                            }
    096                            else if (var18 < var9)
    097                            {
    098                                ++var18;
    099                            }
    100                        }
    101
    102                        for (var13 = 0; var13 < var6 - 1; ++var13)
    103                        {
    104                            var14 = par1World.getBlockId(par3, par4 + var13, par5);
    105
    106                            Block block = Block.blocksList[var14];
    107
    108                            if (var14 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var13, par5))
    109                            {
    110                                this.setBlockAndMetadata(par1World, par3, par4 + var13, par5, Block.wood.blockID, 1);
    111                            }
    112                        }
    113
    114                        return true;
    115                    }
    116                    else
    117                    {
    118                        return false;
    119                    }
    120                }
    121            }
    122            else
    123            {
    124                return false;
    125            }
    126        }
    127    }