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