/// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (!TheGolem.WorldObj.IsDaytime())
            {
                return(false);
            }

            if (TheGolem.GetRNG().Next(8000) != 0)
            {
                return(false);
            }
            else
            {
                TheVillager = (EntityVillager)TheGolem.WorldObj.FindNearestEntityWithinAABB(typeof(net.minecraft.src.EntityVillager), TheGolem.BoundingBox.Expand(6, 2, 6), TheGolem);
                return(TheVillager != null);
            }
        }
예제 #2
0
        public static void MakeWalls(AnvilWorld world, frmMace frmLogForm)
        {
            // walls
            for (int a = City.edgeLength + 6; a <= City.edgeLength + 10; a++)
            {
                BlockShapes.MakeHollowLayers(a, City.mapLength - a, 1, 72, a, City.mapLength - a,
                                             City.wallMaterialID, 0, City.wallMaterialData);
                world.Save();
            }
            // outside and inside edges at the top
            BlockShapes.MakeHollowLayers(City.edgeLength + 5, City.mapLength - (City.edgeLength + 5), 72, 73,
                                         City.edgeLength + 5, City.mapLength - (City.edgeLength + 5),
                                         City.wallMaterialID, 0, City.wallMaterialData);
            BlockShapes.MakeHollowLayers(City.edgeLength + 11, City.mapLength - (City.edgeLength + 11), 72, 73,
                                         City.edgeLength + 11, City.mapLength - (City.edgeLength + 11),
                                         City.wallMaterialID, 0, City.wallMaterialData);
            // alternating blocks on top of the edges
            for (int a = City.edgeLength + 6; a <= City.mapLength - (City.edgeLength + 6); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, City.edgeLength + 5, City.wallMaterialID, 2, 100, City.wallMaterialData);
            }
            for (int a = City.edgeLength + 12; a <= City.mapLength - (City.edgeLength + 12); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, City.edgeLength + 11, City.wallMaterialID, 2, 100, City.wallMaterialData);
            }
            // ladder
            BlockHelper.MakeLadder((City.mapLength / 2) - 5, 64, 72, City.edgeLength + 11, 2, City.wallMaterialID);

            BlockShapes.MakeSolidBox((City.mapLength / 2) - 5, (City.mapLength / 2) + 5,
                                     65, 74,
                                     City.edgeLength + 11, City.edgeLength + 11,
                                     BlockInfo.Air.ID, 2);

            // decorations at the gates
            frmLogForm.UpdateLog("Creating wall lights: " + City.outsideLightType, true, true);
            switch (City.outsideLightType)
            {
            case "Fire":
                // fire above the entrances
                BlockShapes.MakeBlock((City.mapLength / 2) - 1, 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2), 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2) - 1, 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2), 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                // fire on the outside walls
                for (int a = City.edgeLength + 8; a < (City.mapLength / 2) - 9; a += 4)
                {
                    BlockShapes.MakeBlock(a, 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                }
                break;

            case "Torches":
                // torches above the entrances
                BlockHelper.MakeTorch((City.mapLength / 2), 70, City.edgeLength + 5, City.wallMaterialID, 2);
                BlockHelper.MakeTorch((City.mapLength / 2) - 1, 70, City.edgeLength + 5, City.wallMaterialID, 2);
                // torches on the outside walls
                for (int a = City.edgeLength + 8; a < (City.mapLength / 2) - 9; a += 4)
                {
                    BlockHelper.MakeTorch(a, 70, City.edgeLength + 5, City.wallMaterialID, 2);
                }
                break;

            case "None":
            case "":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            if (City.hasTorchesOnWalkways)
            {
                // torches on the inside walls
                for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 4)
                {
                    BlockHelper.MakeTorch(a, 69, City.edgeLength + 11, City.wallMaterialID, 2);
                }
                // torches on the wall roofs
                for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 4)
                {
                    BlockShapes.MakeBlock(a, 73, City.edgeLength + 8, BlockInfo.Torch.ID, 2, 100, -1);
                }
            }


            for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 24)
            {
                switch (City.npcs)
                {
                case "Ghostdancer's NPCs":
                    EntityVillager eVillager;
                    eVillager        = new EntityVillager(new TypedEntity("GKnight"));
                    eVillager.Health = 20;
                    BlockShapes.MakeEntity(a, 73, City.edgeLength + 8, eVillager, 2);
                    break;

                case "Minecraft Villagers":
                    EntityMob eMob;
                    eMob        = new EntityMob(new TypedEntity("VillagerGolem"));
                    eMob.Health = 100;
                    BlockShapes.MakeEntity(a, 73, City.edgeLength + 8, eMob, 2);
                    break;
                }
            }

            frmLogForm.UpdateLog("Creating wall emblems: " + City.cityEmblemType, true, true);
            MakeEmblem();
        }
 /// <summary>
 /// Resets the task
 /// </summary>
 public override void ResetTask()
 {
     TheGolem.Func_48116_a(false);
     TheVillager = null;
 }
예제 #4
0
        private static void MakePaths(AnvilWorld world, BlockManager bm, int[,] intArea)
        {
            for (int x = 0; x < intArea.GetLength(0); x++)
            {
                for (int z = 0; z < intArea.GetLength(1); z++)
                {
                    if (intArea[x, z] == 1)
                    {
                        if (Math.Abs(x - (intArea.GetLength(0) / 2)) == City.pathExtends + 1 &&
                            Math.Abs(z - (intArea.GetLength(1) / 2)) == City.pathExtends + 1)
                        {
                            // don't need these
                        }
                        else if (Math.Abs(x - (intArea.GetLength(0) / 2)) == (City.pathExtends + 1) ||
                                 Math.Abs(z - (intArea.GetLength(1) / 2)) == (City.pathExtends + 1))
                        {
                            if (City.hasMainStreets && MultipleNeighbouringPaths(intArea, x, z))
                            {
                                bm.SetID(_intBlockStart + x, 63, _intBlockStart + z, City.pathBlockID);
                                bm.SetData(_intBlockStart + x, 63, _intBlockStart + z, City.pathBlockData);
                            }
                        }
                        else
                        {
                            bm.SetID(_intBlockStart + x, 63, _intBlockStart + z, City.pathBlockID);
                            bm.SetData(_intBlockStart + x, 63, _intBlockStart + z, City.pathBlockData);
                        }
                        if (City.hasMainStreets && City.pathAlternativeBlockID > 0)
                        {
                            if (x > 0 && z > 0 && x < intArea.GetUpperBound(0) && z < intArea.GetUpperBound(1))
                            {
                                if (Math.Abs(x - (intArea.GetLength(0) / 2)) == City.pathExtends ||
                                    Math.Abs(z - (intArea.GetLength(1) / 2)) == City.pathExtends)
                                {
                                    if (Math.Abs(x - (intArea.GetLength(0) / 2)) >= City.pathExtends &&
                                        Math.Abs(z - (intArea.GetLength(1) / 2)) >= City.pathExtends)
                                    {
                                        bm.SetID(_intBlockStart + x, 64, _intBlockStart + z, City.pathAlternativeBlockID);
                                        bm.SetData(_intBlockStart + x, 64, _intBlockStart + z, City.pathAlternativeBlockData);
                                    }
                                }
                            }
                        }
                    }
                }
                if (x % 20 == 0)
                {
                    world.Save();
                }
            }
            if (City.hasMainStreets)
            {
                for (int a = 0; a <= intArea.GetUpperBound(0); a++)
                {
                    if (a % 8 == 0)
                    {
                        switch (City.npcs)
                        {
                        case "Ghostdancer's NPCs":
                            EntityVillager eVillager = new EntityVillager(new TypedEntity("GPoor"));
                            switch (RNG.Next(2))
                            {
                            case 0:
                                eVillager = new EntityVillager(new TypedEntity("GPoor"));
                                break;

                            case 1:
                                eVillager = new EntityVillager(new TypedEntity("GRich"));
                                break;

                            case 2:
                                eVillager = new EntityVillager(new TypedEntity("GMaid"));
                                break;
                            }
                            eVillager.Health = 20;
                            BlockShapes.MakeEntity(_intBlockStart + a, 65, _intBlockStart + (intArea.GetUpperBound(0) / 2), eVillager, 0);
                            BlockShapes.MakeEntity(_intBlockStart + (intArea.GetUpperBound(0) / 2), 65, _intBlockStart + a, eVillager, 0);
                            break;

                        case "Minecraft Villagers":
                            EntityVillager eMob = new EntityVillager();
                            eMob.Health = 20;
                            BlockShapes.MakeEntity(_intBlockStart + a, 65, _intBlockStart + (intArea.GetUpperBound(0) / 2), eMob, 0);
                            BlockShapes.MakeEntity(_intBlockStart + (intArea.GetUpperBound(0) / 2), 65, _intBlockStart + a, eMob, 0);
                            break;
                        }
                    }
                    for (int c = -City.pathExtends; c <= City.pathExtends; c++)
                    {
                        intArea[a, (intArea.GetUpperBound(0) / 2) + c] = 1;
                        intArea[(intArea.GetUpperBound(0) / 2) + c, a] = 1;
                    }
                }
            }
        }