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