コード例 #1
0
 protected BiomeGenBase(int par1)
 {
     TopBlock                   = (byte)Block.Grass.BlockID;
     FillerBlock                = (byte)Block.Dirt.BlockID;
     Field_6502_q               = 0x4ee031;
     MinHeight                  = 0.1F;
     MaxHeight                  = 0.3F;
     Temperature                = 0.5F;
     Rainfall                   = 0.5F;
     WaterColorMultiplier       = 0xffffff;
     SpawnableMonsterList       = new List <SpawnListEntry>();
     SpawnableCreatureList      = new List <SpawnListEntry>();
     SpawnableWaterCreatureList = new List <SpawnListEntry>();
     EnableRain                 = true;
     WorldGenTrees              = new WorldGenTrees(false);
     WorldGenBigTree            = new WorldGenBigTree(false);
     WorldGenForest             = new WorldGenForest(false);
     WorldGenSwamp              = new WorldGenSwamp();
     BiomeID         = par1;
     BiomeList[par1] = this;
     BiomeDecorator  = CreateBiomeDecorator();
     SpawnableCreatureList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntitySheep), 12, 4, 4));
     SpawnableCreatureList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityPig), 10, 4, 4));
     SpawnableCreatureList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityChicken), 10, 4, 4));
     SpawnableCreatureList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityCow), 8, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntitySpider), 10, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityZombie), 10, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntitySkeleton), 10, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityCreeper), 10, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntitySlime), 10, 4, 4));
     SpawnableMonsterList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntityEnderman), 1, 1, 4));
     SpawnableWaterCreatureList.Add(new SpawnListEntry(typeof(net.minecraft.src.EntitySquid), 10, 4, 4));
 }
コード例 #2
0
        /// <summary>
        /// Attempts to grow a sapling into a tree
        /// </summary>
        public virtual void GrowTree(World par1World, int par2, int par3, int par4, Random par5Random)
        {
            int    i    = par1World.GetBlockMetadata(par2, par3, par4) & 3;
            object obj  = null;
            int    j    = 0;
            int    k    = 0;
            bool   flag = false;

            if (i == 1)
            {
                obj = new WorldGenTaiga2(true);
            }
            else if (i == 2)
            {
                obj = new WorldGenForest(true);
            }
            else if (i == 3)
            {
                j = 0;

                do
                {
                    if (j < -1)
                    {
                        break;
                    }

                    k = 0;

                    do
                    {
                        if (k < -1)
                        {
                            break;
                        }

                        if (Func_50076_f(par1World, par2 + j, par3, par4 + k, 3) && Func_50076_f(par1World, par2 + j + 1, par3, par4 + k, 3) && Func_50076_f(par1World, par2 + j, par3, par4 + k + 1, 3) && Func_50076_f(par1World, par2 + j + 1, par3, par4 + k + 1, 3))
                        {
                            obj  = new WorldGenHugeTrees(true, 10 + par5Random.Next(20), 3, 3);
                            flag = true;
                            break;
                        }

                        k--;
                    }while (true);

                    if (obj != null)
                    {
                        break;
                    }

                    j--;
                }while (true);

                if (obj == null)
                {
                    j   = k = 0;
                    obj = new WorldGenTrees(true, 4 + par5Random.Next(7), 3, 3, false);
                }
            }
            else
            {
                obj = new WorldGenTrees(true);

                if (par5Random.Next(10) == 0)
                {
                    obj = new WorldGenBigTree(true);
                }
            }

            if (flag)
            {
                par1World.SetBlock(par2 + j, par3, par4 + k, 0);
                par1World.SetBlock(par2 + j + 1, par3, par4 + k, 0);
                par1World.SetBlock(par2 + j, par3, par4 + k + 1, 0);
                par1World.SetBlock(par2 + j + 1, par3, par4 + k + 1, 0);
            }
            else
            {
                par1World.SetBlock(par2, par3, par4, 0);
            }

            if (!((WorldGenerator)(obj)).Generate(par1World, par5Random, par2 + j, par3, par4 + k))
            {
                if (flag)
                {
                    par1World.SetBlockAndMetadata(par2 + j, par3, par4 + k, BlockID, i);
                    par1World.SetBlockAndMetadata(par2 + j + 1, par3, par4 + k, BlockID, i);
                    par1World.SetBlockAndMetadata(par2 + j, par3, par4 + k + 1, BlockID, i);
                    par1World.SetBlockAndMetadata(par2 + j + 1, par3, par4 + k + 1, BlockID, i);
                }
                else
                {
                    par1World.SetBlockAndMetadata(par2, par3, par4, BlockID, i);
                }
            }
        }