コード例 #1
0
ファイル: Buildings.cs プロジェクト: RavetcoFX/mace-minecraft
        private static void MakeSewerEntrance(BlockManager bm, int x, int z, int intPlotSize)
        {
            // path
            BlockShapes.MakeHollowLayers(x, x + 8, 63, 63, z, z + intPlotSize, (int)BlockType.DOUBLE_SLAB);
            // building
            BlockShapes.MakeHollowBox(x + 2, x + 6, 63, 67, z + 2, z + 6, (int)BlockType.STONE);
            // doorway
            BlockShapes.MakeSolidBox(x + 4, x + 4, 64, 65, z + 2, z + 2, (int)BlockType.AIR);
            // tunnel down
            BlockShapes.MakeSolidBox(x + 4, x + 4, 55, 63, z + 4, z + 4, (int)BlockType.AIR);
            // ladder back
            BlockShapes.MakeSolidBox(x + 4, x + 4, 52, 55, z + 5, z + 5, (int)BlockType.STONE);
            // ladder rungs
            BlockHelper.MakeLadder(x + 4, 52, 63, z + 4);
            // hatch
            bm.SetID(x + 4, 64, z + 4, (int)BlockType.TRAPDOOR);
            bm.SetData(x + 4, 64, z + 4, 2);
            // chest with torches
            bm.SetID(x + 5, 64, z + 5, (int)BlockType.CHEST);
            TileEntityChest tec = new TileEntityChest();

            tec.Items[0] = BlockHelper.MakeItem((int)BlockType.REDSTONE_TORCH_ON, 64);
            tec.Items[1] = BlockHelper.MakeItem((int)BlockType.TORCH, 32);
            bm.SetTileEntity(x + 5, 64, z + 5, tec);
            // sign
            BlockHelper.MakeSign(x + 4, 66, z + 1, "Sewers||Currently|empty!", (int)BlockType.STONE);
        }
コード例 #2
0
 public static void MakeGuardTowers(BlockManager bm, int intFarmSize, int intMapSize, bool booIncludeWalls)
 {
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79,
                              intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80,
                               intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 59, 71,
                              intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81,
                                  intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockHelper.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 2);
     BlockHelper.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 2);
     // add cobwebs
     // todo: could probably use double-mirroring here
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     // add chests
     MakeGuardChest(bm, intFarmSize + 11, 72, intFarmSize + 11);
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intFarmSize + 11);
     MakeGuardChest(bm, intFarmSize + 11, 72, intMapSize - (intFarmSize + 11));
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intMapSize - (intFarmSize + 11));
     // add archery slots
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 73, 76,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 75, 75,
                              intFarmSize + 7, intFarmSize + 9, (int)BlockType.AIR, 2);
     if (!booIncludeWalls)
     {
         BlockHelper.MakeLadder(intFarmSize + 13, 64, 71, intFarmSize + 8, 2);
     }
 }
コード例 #3
0
 public static void MakeGuardTowers()
 {
     Console.WriteLine("Making guard towers");
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79, intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 71, 71, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81, intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockShapes.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 7, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 9, 0, 1);
     // add cobwebs
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, 30, 1, 30);
     // add chests
     MakeGuardChest(intFarmSize + 5, 72, intFarmSize + 5);
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intFarmSize + 5);
     MakeGuardChest(intFarmSize + 5, 72, intMapSize - (intFarmSize + 5));
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intMapSize - (intFarmSize + 5));
 }
コード例 #4
0
        public static void MakeMoat(int intFarmSize, int intMapSize, string strMoatLiquid)
        {
            int intMoatLiquid = (int)BlockType.STATIONARY_WATER;

            if (strMoatLiquid == "Lava" || (strMoatLiquid == "Random" && rand.NextDouble() > 0.75))
            {
                intMoatLiquid = (int)BlockType.STATIONARY_LAVA;
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 62, a, intMapSize - a, intMoatLiquid);
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 63, 63, a, intMapSize - a, (int)BlockType.AIR);
            }
        }
コード例 #5
0
        public static void MakeMoat()
        {
            Console.WriteLine("Making moat");
            int intMoatLiquid = (int)BlockType.STATIONARY_WATER;

            if (rand.Next(100) > 75)
            {
                intMoatLiquid = (int)BlockType.STATIONARY_LAVA;
            }

            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 62, a, intMapSize - a, intMoatLiquid);
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 63, 63, a, intMapSize - a, (int)BlockType.AIR);
            }
        }
コード例 #6
0
 public static void MakeWall()
 {
     Console.WriteLine("Making walls");
     // walls
     for (int a = intFarmSize + 6; a <= intFarmSize + 10; a++)
     {
         BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 71, a, intMapSize - a, (int)BlockType.STONE);
     }
     // outside and inside edges at the top
     BlockShapes.MakeHollowLayers(intFarmSize + 6, intMapSize - (intFarmSize + 6), 72, 72, intFarmSize + 6, intMapSize - (intFarmSize + 6), (int)BlockType.STONE);
     BlockShapes.MakeHollowLayers(intFarmSize + 10, intMapSize - (intFarmSize + 10), 72, 72, intFarmSize + 10, intMapSize - (intFarmSize + 10), (int)BlockType.STONE);
     // alternating blocks on top of the edges
     for (int a = intFarmSize + 7; a <= intMapSize - (intFarmSize + 7); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 6, (int)BlockType.STONE, 2);
     }
     for (int a = intFarmSize + 11; a <= intMapSize - (intFarmSize + 11); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 10, (int)BlockType.STONE, 2);
     }
 }
コード例 #7
0
 public static void MakeWalls(int intFarmSize, int intMapSize)
 {
     // walls
     for (int a = intFarmSize + 6; a <= intFarmSize + 10; a++)
     {
         BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 71, a, intMapSize - a, (int)BlockType.STONE);
     }
     // outside and inside edges at the top
     BlockShapes.MakeHollowLayers(intFarmSize + 6, intMapSize - (intFarmSize + 6), 72, 72,
                                  intFarmSize + 6, intMapSize - (intFarmSize + 6), (int)BlockType.STONE);
     BlockShapes.MakeHollowLayers(intFarmSize + 10, intMapSize - (intFarmSize + 10), 72, 72,
                                  intFarmSize + 10, intMapSize - (intFarmSize + 10), (int)BlockType.STONE);
     // alternating blocks on top of the edges
     for (int a = intFarmSize + 6; a <= intMapSize - (intFarmSize + 6); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 6, (int)BlockType.STONE, 2);
     }
     for (int a = intFarmSize + 10; a <= intMapSize - (intFarmSize + 10); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 10, (int)BlockType.STONE, 2);
     }
     // ladder
     BlockHelper.MakeLadder((intMapSize / 2) - 5, 64, 72, intFarmSize + 11, 2);
 }
コード例 #8
0
ファイル: Moat.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeMoat(int intFarmSize, int intMapSize, string strMoatType, bool booIncludeGuardTowers)
        {
            if (strMoatType == "Random")
            {
                int intRand = rand.Next(100);
                if (intRand >= 90)
                {
                    strMoatType = "Drop to Bedrock";
                }
                else if (intRand >= 80)
                {
                    strMoatType = "Cactus";
                }
                else if (intRand >= 50)
                {
                    strMoatType = "Lava";
                }
                else
                {
                    strMoatType = "Water";
                }
            }
            switch (strMoatType)
            {
            case "Drop to Bedrock":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 2, 63, a, intMapSize - a, (int)BlockType.AIR);
                }
                break;

            case "Cactus":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 63, a, intMapSize - a, (int)BlockType.AIR);
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 58, a, intMapSize - a, (int)BlockType.SAND);
                }
                for (int a = intFarmSize + 1; a <= intMapSize / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 1, (int)BlockType.CACTUS, 2);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 3, (int)BlockType.CACTUS, 2);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 1, (int)BlockType.CACTUS, 2, 50);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 3, (int)BlockType.CACTUS, 2, 50);
                }
                for (int a = intFarmSize; a <= intMapSize / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmSize, (int)BlockType.CACTUS, 2);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 2, (int)BlockType.CACTUS, 2);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 4, (int)BlockType.CACTUS, 2);
                    BlockShapes.MakeBlock(a, 60, intFarmSize, (int)BlockType.CACTUS, 2, 50);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 2, (int)BlockType.CACTUS, 2, 50);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 4, (int)BlockType.CACTUS, 2, 50);
                }
                if (booIncludeGuardTowers)
                {
                    for (int a = intFarmSize + 3; a <= intFarmSize + 13; a += 2)
                    {
                        BlockShapes.MakeBlock(a, 59, intFarmSize + 3, (int)BlockType.AIR, 2);
                        BlockShapes.MakeBlock(a, 60, intFarmSize + 3, (int)BlockType.AIR, 2);
                    }
                }
                break;

            case "Lava":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 62, 63, a, intMapSize - a, (int)BlockType.AIR);
                }
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 61, a, intMapSize - a, (int)BlockType.LAVA);
                }
                break;

            case "Water":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 63, a, intMapSize - a, (int)BlockType.WATER);
                }
                break;
            }
        }
コード例 #9
0
        public static void MakeGuardTowers(BlockManager bm, int intFarmLength, int intMapLength, bool booIncludeWalls,
                                           string strOutsideLights, string strTowerAddition,
                                           bool booIncludeItemsInChests, int intWallMaterial)
        {
            // remove wall
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 11, 64, 79,
                                     intFarmLength + 5, intFarmLength + 11, BlockType.AIR, 1);
            // add tower
            BlockShapes.MakeHollowBox(intFarmLength + 4, intFarmLength + 12, 63, 80,
                                      intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1, -1);
            // divide into two rooms
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 12, 2, 72,
                                     intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 11, 64, 67,
                                     intFarmLength + 5, intFarmLength + 11, BlockType.AIR, 1);
            switch (strOutsideLights)
            {
            case "Fire":
                BlockShapes.MakeBlock(intFarmLength + 5, 76, intFarmLength + 3, BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 5, 77, intFarmLength + 3, BlockType.FIRE, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 11, 76, intFarmLength + 3, BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 11, 77, intFarmLength + 3, BlockType.FIRE, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(intFarmLength + 6, y, intFarmLength + 3, intWallMaterial, 2);
                    BlockHelper.MakeTorch(intFarmLength + 10, y, intFarmLength + 3, intWallMaterial, 2);
                }
                break;

            case "None":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // add torches
            BlockHelper.MakeTorch(intFarmLength + 6, 79, intFarmLength + 13, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 79, intFarmLength + 13, intWallMaterial, 2);
            // add torches inside
            BlockHelper.MakeTorch(intFarmLength + 6, 77, intFarmLength + 11, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 77, intFarmLength + 11, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 5, 77, intFarmLength + 6, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 5, 77, intFarmLength + 10, intWallMaterial, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(intFarmLength + 7, 73, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 9, 73, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 7, 74, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 9, 74, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(intFarmLength + 4, intFarmLength + 12, 81, 81,
                                         intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1, -1);
            // alternating top blocks
            for (int x = intFarmLength + 4; x <= intFarmLength + 12; x += 2)
            {
                for (int z = intFarmLength + 4; z <= intFarmLength + 12; z += 2)
                {
                    if (x == intFarmLength + 4 || x == intFarmLength + 12 || z == intFarmLength + 4 || z == intFarmLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, intWallMaterial, 1, 100, -1);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBox(intFarmLength + 8, intFarmLength + 8, 73, 82,
                                     intFarmLength + 8, intFarmLength + 8, intWallMaterial, 1);
            BlockHelper.MakeLadder(intFarmLength + 7, 73, 82, intFarmLength + 8, 2, intWallMaterial);
            BlockHelper.MakeLadder(intFarmLength + 9, 73, 82, intFarmLength + 8, 2, intWallMaterial);
            // add torches on the roof
            BlockShapes.MakeBlock(intFarmLength + 6, 81, intFarmLength + 6, BlockType.TORCH, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 6, 81, intFarmLength + 10, BlockType.TORCH, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 10, 81, intFarmLength + 10, BlockType.TORCH, 1, 100, -1);
            // add cobwebs
            BlockShapes.MakeBlock(intFarmLength + 5, 79, intFarmLength + 5, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 5, 79, intFarmLength + 11, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 79, intFarmLength + 5, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 79, intFarmLength + 11, BlockType.COBWEB, 1, 30, -1);
            // add chests
            MakeGuardChest(bm, intFarmLength + 11, 73, intFarmLength + 11, booIncludeItemsInChests);
            MakeGuardChest(bm, intMapLength - (intFarmLength + 11), 73, intFarmLength + 11, booIncludeItemsInChests);
            MakeGuardChest(bm, intFarmLength + 11, 73, intMapLength - (intFarmLength + 11), booIncludeItemsInChests);
            MakeGuardChest(bm, intMapLength - (intFarmLength + 11), 73, intMapLength - (intFarmLength + 11),
                           booIncludeItemsInChests);
            // add archery slots
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 74, 77,
                                     intFarmLength + 8, intFarmLength + 8, BlockType.AIR, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 76, 76,
                                     intFarmLength + 7, intFarmLength + 9, BlockType.AIR, 2);
            if (!booIncludeWalls)
            {
                BlockHelper.MakeLadder(intFarmLength + 13, 64, 72, intFarmLength + 8, 2, intWallMaterial);
            }
            // include beds
            BlockHelper.MakeBed(intFarmLength + 5, intFarmLength + 6, 64, intFarmLength + 8, intFarmLength + 8, 2);
            BlockHelper.MakeBed(intFarmLength + 5, intFarmLength + 6, 64, intFarmLength + 10, intFarmLength + 10, 2);
            BlockHelper.MakeBed(intFarmLength + 11, intFarmLength + 10, 64, intFarmLength + 8, intFarmLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 73, intFarmLength + 5, intFarmLength + 5,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 5, intFarmLength + 5,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     BlockType.WOOD, 2);
            // add ladders
            BlockHelper.MakeLadder(intFarmLength + 5, 64, 73, intFarmLength + 6, 2, BlockType.WOOD);
            // make torches
            BlockHelper.MakeTorch(intFarmLength + 10, 66, intFarmLength + 5, BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmLength + 6, 66, intFarmLength + 11, BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 66, intFarmLength + 11, BlockType.WOOD, 2);
            // make columns for real
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 73, intFarmLength + 5, intFarmLength + 5,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 5, intFarmLength + 5,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     intWallMaterial, 2);
            // make cobwebs
            BlockShapes.MakeBlock(intFarmLength + 11, 67, intFarmLength + 8, BlockType.COBWEB, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(intFarmLength + 11, 65, intFarmLength + 11, BlockType.GOLD_BLOCK, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.GOLD_BLOCK, 1, 100, -1);
            BlockHelper.MakeDoor(intFarmLength + 11, 64, intFarmLength + 12, BlockType.GOLD_BLOCK, true, 2);
            BlockShapes.MakeBlock(intFarmLength + 11, 65, intFarmLength + 11, BlockType.AIR, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.AIR, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.STONE_PLATE, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 13, BlockType.STONE_PLATE, 2, 100, -1);
            //BlockShapes.MakeBlock(intFarmLength + 13, 64, intFarmLength + 11, BlockType.STONE_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(intFarmLength + 12, 65, intFarmLength + 13, "~Guard Tower~~", intWallMaterial, 1);
            BlockHelper.MakeSign(intFarmLength + 8, 74, intFarmLength + 13, "~Guard Tower~~", intWallMaterial, 2);
            // make beacon
            switch (strTowerAddition)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBox(intFarmLength + 8, intFarmLength + 8, 83, 84,
                                         intFarmLength + 8, intFarmLength + 8, intWallMaterial, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 85, 85,
                                         intFarmLength + 6, intFarmLength + 10, intWallMaterial, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 86, 86,
                                         intFarmLength + 6, intFarmLength + 10, BlockType.NETHERRACK, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 87, 87,
                                         intFarmLength + 6, intFarmLength + 10, BlockType.FIRE, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 83, 91,
                                         intFarmLength + 12, intFarmLength + 12, BlockType.FENCE, 2);
                BlockShapes.MakeBlock(intFarmLength + 4, 84, intFarmLength + 13, BlockType.FENCE, 2, 100, 0);
                BlockShapes.MakeBlock(intFarmLength + 4, 91, intFarmLength + 13, BlockType.FENCE, 2, 100, 0);
                int[] intColours = Utils.ShuffleArray(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
                switch (RandomHelper.Next(7))
                {
                case 0:         //2vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    break;

                case 1:         //3vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 15, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 16, intFarmLength + 18, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 19, intFarmLength + 21, BlockType.WOOL, 2, intColours[2]);
                    break;

                case 2:         //4vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 14, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 15, intFarmLength + 16, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 17, intFarmLength + 18, BlockType.WOOL, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 19, intFarmLength + 20, BlockType.WOOL, 2, intColours[3]);
                    break;

                case 3:         //2horiz
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    break;

                case 4:         //3horiz
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 86,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 87, 88,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 89, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[2]);
                    break;

                case 5:         //quarters
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[3]);
                    break;

                case 6:         //cross
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 87, 88,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 17, intFarmLength + 18, BlockType.WOOL, 2, intColours[1]);
                    break;

                default:
                    Debug.Fail("Invalid switch result");
                    break;
                }
                break;
            }
        }
コード例 #10
0
        public static void MakeGuardTowers(BlockManager bm, frmMace frmLogForm)
        {
            // remove wall
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 11, 64, 79,
                                     City.FarmLength + 5, City.FarmLength + 11, BlockInfo.Air.ID, 1);
            // add tower
            BlockShapes.MakeHollowBox(City.FarmLength + 4, City.FarmLength + 12, 63, 80,
                                      City.FarmLength + 4, City.FarmLength + 12, City.WallMaterialID, 1, City.WallMaterialData);
            // divide into two rooms
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 12, 2, 72,
                                             City.FarmLength + 4, City.FarmLength + 12,
                                             City.WallMaterialID, 1, City.WallMaterialData);
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 11, 64, 67,
                                     City.FarmLength + 5, City.FarmLength + 11, BlockInfo.Air.ID, 1);

            switch (City.OutsideLightType)
            {
            case "Fire":
                BlockShapes.MakeBlock(City.FarmLength + 5, 76, City.FarmLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 5, 77, City.FarmLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 11, 76, City.FarmLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 11, 77, City.FarmLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(City.FarmLength + 6, y, City.FarmLength + 3, City.WallMaterialID, 2);
                    BlockHelper.MakeTorch(City.FarmLength + 10, y, City.FarmLength + 3, City.WallMaterialID, 2);
                }
                break;

            case "None":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // add torches
            BlockHelper.MakeTorch(City.FarmLength + 6, 79, City.FarmLength + 13, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 79, City.FarmLength + 13, City.WallMaterialID, 2);
            // add torches inside
            BlockHelper.MakeTorch(City.FarmLength + 6, 77, City.FarmLength + 11, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 77, City.FarmLength + 11, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 5, 77, City.FarmLength + 6, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 5, 77, City.FarmLength + 10, City.WallMaterialID, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(City.FarmLength + 7, 73, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 9, 73, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 7, 74, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 9, 74, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(City.FarmLength + 4, City.FarmLength + 12, 81, 81,
                                         City.FarmLength + 4, City.FarmLength + 12,
                                         City.WallMaterialID, 1, City.WallMaterialData);

            // alternating top blocks
            for (int x = City.FarmLength + 4; x <= City.FarmLength + 12; x += 2)
            {
                for (int z = City.FarmLength + 4; z <= City.FarmLength + 12; z += 2)
                {
                    if (x == City.FarmLength + 4 ||
                        x == City.FarmLength + 12 ||
                        z == City.FarmLength + 4 ||
                        z == City.FarmLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, City.WallMaterialID, 1, 100, City.WallMaterialData);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 8, City.FarmLength + 8, 73, 82,
                                             City.FarmLength + 8, City.FarmLength + 8, City.WallMaterialID, 1,
                                             City.WallMaterialData);
            BlockHelper.MakeLadder(City.FarmLength + 7, 73, 82, City.FarmLength + 8, 2, City.WallMaterialID);
            BlockHelper.MakeLadder(City.FarmLength + 9, 73, 82, City.FarmLength + 8, 2, City.WallMaterialID);
            // add torches on the roof
            BlockShapes.MakeBlock(City.FarmLength + 6, 81, City.FarmLength + 6, BlockInfo.Torch.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 6, 81, City.FarmLength + 10, BlockInfo.Torch.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 10, 81, City.FarmLength + 10, BlockInfo.Torch.ID, 1, 100, -1);
            // add cobwebs
            BlockShapes.MakeBlock(City.FarmLength + 5, 79, City.FarmLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 5, 79, City.FarmLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 79, City.FarmLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 79, City.FarmLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);

            // add chests
            MakeGuardChest(bm, City.FarmLength + 11, 73, City.FarmLength + 11);
            MakeGuardChest(bm, City.MapLength - (City.FarmLength + 11), 73, City.FarmLength + 11);
            MakeGuardChest(bm, City.FarmLength + 11, 73, City.MapLength - (City.FarmLength + 11));
            MakeGuardChest(bm, City.MapLength - (City.FarmLength + 11), 73, City.MapLength - (City.FarmLength + 11));

            // add archery slots
            BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 74, 77,
                                     City.FarmLength + 8, City.FarmLength + 8, BlockInfo.Air.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 76, 76,
                                     City.FarmLength + 7, City.FarmLength + 9, BlockInfo.Air.ID, 2);
            if (!City.HasWalls)
            {
                BlockHelper.MakeLadder(City.FarmLength + 13, 64, 72, City.FarmLength + 8, 2, City.WallMaterialID);
            }
            // include beds
            BlockHelper.MakeBed(City.FarmLength + 5, City.FarmLength + 6, 64, City.FarmLength + 8, City.FarmLength + 8, 2);
            BlockHelper.MakeBed(City.FarmLength + 5, City.FarmLength + 6, 64, City.FarmLength + 10, City.FarmLength + 10, 2);
            BlockHelper.MakeBed(City.FarmLength + 11, City.FarmLength + 10, 64, City.FarmLength + 8, City.FarmLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 5, 64, 73,
                                     City.FarmLength + 5, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 11, City.FarmLength + 11, 64, 71,
                                     City.FarmLength + 5, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 5, 64, 71,
                                     City.FarmLength + 11, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 11, City.FarmLength + 11, 64, 71,
                                     City.FarmLength + 11, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            // add ladders
            BlockHelper.MakeLadder(City.FarmLength + 5, 64, 73, City.FarmLength + 6, 2, BlockInfo.Wood.ID);
            // make torches
            BlockHelper.MakeTorch(City.FarmLength + 10, 66, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 6, 66, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 66, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            // make columns for real
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 5, City.FarmLength + 5, 64, 73, City.FarmLength + 5,
                                             City.FarmLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 11, City.FarmLength + 11, 64, 71, City.FarmLength + 5,
                                             City.FarmLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 5, City.FarmLength + 5, 64, 71, City.FarmLength + 11,
                                             City.FarmLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 11, City.FarmLength + 11, 64, 71, City.FarmLength + 11,
                                             City.FarmLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            // make cobwebs
            BlockShapes.MakeBlock(City.FarmLength + 11, 67, City.FarmLength + 8, BlockInfo.Cobweb.ID, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(City.FarmLength + 11, 65, City.FarmLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockHelper.MakeDoor(City.FarmLength + 11, 64, City.FarmLength + 12, BlockInfo.GoldBlock.ID, true, 2);
            BlockShapes.MakeBlock(City.FarmLength + 11, 65, City.FarmLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.StonePlate.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 13, BlockInfo.StonePlate.ID, 2, 100, -1);
            //BlockShapes.MakeBlock(City.intFarmSize + 13, 64, City.intFarmSize + 11, BlockInfo.Stone.ID_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(City.FarmLength + 12, 65, City.FarmLength + 13, "~Guard Tower~~", City.WallMaterialID, 1);
            BlockHelper.MakeSign(City.FarmLength + 8, 74, City.FarmLength + 13, "~Guard Tower~~", City.WallMaterialID, 2);
            // make beacon
            frmLogForm.UpdateLog("Creating tower addition: " + City.TowersAdditionType, true, true);
            switch (City.TowersAdditionType)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBoxWithData(City.FarmLength + 8, City.FarmLength + 8, 83, 84,
                                                 City.FarmLength + 8, City.FarmLength + 8,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBoxWithData(City.FarmLength + 6, City.FarmLength + 10, 85, 85,
                                                 City.FarmLength + 6, City.FarmLength + 10,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBox(City.FarmLength + 6, City.FarmLength + 10, 86, 86,
                                         City.FarmLength + 6, City.FarmLength + 10, BlockInfo.Netherrack.ID, 1);
                BlockShapes.MakeSolidBox(City.FarmLength + 6, City.FarmLength + 10, 87, 87,
                                         City.FarmLength + 6, City.FarmLength + 10, BlockInfo.Fire.ID, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 83, 91,
                                         City.FarmLength + 12, City.FarmLength + 12, BlockInfo.Fence.ID, 2);
                BlockShapes.MakeBlock(City.FarmLength + 4, 84, City.FarmLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                BlockShapes.MakeBlock(City.FarmLength + 4, 91, City.FarmLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                int[] intColours = RandomHelper.ShuffleArray(Enumerable.Range(0, 15).ToArray());
                switch (RandomHelper.Next(8))
                {
                case 0:         //2vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                case 1:         //3vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 15, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 16, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 19, City.FarmLength + 21, BlockInfo.Wool.ID, 2, intColours[2]);
                    break;

                case 2:         //4vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 14, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 15, City.FarmLength + 16, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 19, City.FarmLength + 20, BlockInfo.Wool.ID, 2, intColours[3]);
                    break;

                case 3:         //2horiz
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                case 4:         //3horiz
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 86,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 89, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[2]);
                    break;

                case 5:         //quarters
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[3]);
                    break;

                case 6:         //cross
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                default:         // inside "circle"
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 86, 89,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 16, City.FarmLength + 19, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;
                }
                break;
            }
        }
コード例 #11
0
        public static void MakeMoat(int intFarmLength, int intMapLength, string strMoatType, bool booIncludeGuardTowers)
        {
            switch (strMoatType)
            {
            case "Drop to Bedrock":
                for (int a = intFarmLength - 1; a <= intFarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 2, 63, a, intMapLength - a, BlockType.AIR, 0, -1);
                }
                break;

            case "Cactus":
                for (int a = intFarmLength - 1; a <= intFarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 59, 63, a, intMapLength - a, BlockType.AIR, 0, -1);
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 58, 58, a, intMapLength - a, BlockType.SAND, 0, -1);
                }
                for (int a = intFarmLength + 1; a <= intMapLength / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmLength + 1, BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmLength + 3, BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmLength + 1, BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmLength + 3, BlockType.CACTUS, 2, 50, -1);
                }
                for (int a = intFarmLength; a <= intMapLength / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmLength, BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmLength + 2, BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmLength + 4, BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmLength, BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmLength + 2, BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmLength + 4, BlockType.CACTUS, 2, 50, -1);
                }
                if (booIncludeGuardTowers)
                {
                    for (int a = intFarmLength + 3; a <= intFarmLength + 13; a += 2)
                    {
                        BlockShapes.MakeBlock(a, 59, intFarmLength + 3, BlockType.AIR, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, intFarmLength + 3, BlockType.AIR, 2, 100, -1);
                    }
                }
                break;

            case "Lava":
                for (int a = intFarmLength - 1; a <= intFarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 59, 61, a, intMapLength - a, BlockType.LAVA, 0, -1);
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 62, 63, a, intMapLength - a, BlockType.AIR, 0, -1);
                }
                break;

            case "Fire":
                for (int a = intFarmLength - 1; a <= intFarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 59, 59, a, intMapLength - a,
                                                 BlockType.NETHERRACK, 0, -1);
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 60, 60, a, intMapLength - a, BlockType.FIRE, 0, -1);
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 61, 63, a, intMapLength - a, BlockType.AIR, 0, -1);
                }
                break;

            case "Water":
                for (int a = intFarmLength - 1; a <= intFarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapLength - a, 59, 63, a, intMapLength - a, BlockType.WATER, 0, -1);
                }
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
        }
コード例 #12
0
        public static void MakePlots(bool[,] booSewerEntrances)
        {
            Console.WriteLine("Making plots");
            int intPlots = 1 + (((intMapSize - (intFarmSize + 20)) - (intFarmSize + 18)) / intPlotSize);

            for (int x = intFarmSize + 18; x < intMapSize - (intFarmSize + 20); x += intPlotSize)
            {
                for (int z = intFarmSize + 18; z < intMapSize - (intFarmSize + 20); z += intPlotSize)
                {
                    if (booSewerEntrances[(x - (intFarmSize + 18)) / intPlotSize, (z - (intFarmSize + 18)) / intPlotSize])
                    {
                        BlockShapes.MakeHollowBox(x + (intPlotSize / 2) - 2, x + (intPlotSize / 2) + 2, 63, 67,
                                                  z + (intPlotSize / 2) - 2, z + (intPlotSize / 2) + 2,
                                                  (int)BlockType.STONE);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 64, 65,
                                                 z + (intPlotSize / 2) - 2, z + (intPlotSize / 2) - 2,
                                                 (int)BlockType.AIR);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 55, 63,
                                                 z + (intPlotSize / 2), z + (intPlotSize / 2),
                                                 (int)BlockType.AIR);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 52, 55,
                                                 z + (intPlotSize / 2) + 1, z + (intPlotSize / 2) + 1, (int)BlockType.STONE);
                        BlockShapes.MakeLadder(x + (intPlotSize / 2), 52, 63, z + (intPlotSize / 2), 2);
                        bm.SetID(x + (intPlotSize / 2), 64, z + (intPlotSize / 2), 96); // hatch
                        bm.SetData(x + (intPlotSize / 2), 64, z + (intPlotSize / 2), 2);
                        bm.SetID(x + (intPlotSize / 2) + 1, 64, z + (intPlotSize / 2) + 1, (int)BlockType.CHEST);
                        TileEntityChest tec = new TileEntityChest();
                        tec.Items[0] = MakeItem((int)BlockType.REDSTONE_TORCH_ON, 32);
                        tec.Items[1] = MakeItem((int)BlockType.TORCH, 8);
                        bm.SetTileEntity(x + (intPlotSize / 2) + 1, 64, z + (intPlotSize / 2) + 1, tec);
                        MakeSign(x + (intPlotSize / 2), 66, z + (intPlotSize / 2) - 3, "Sewers||Currently|empty!", (int)BlockType.STONE);
                    }
                    else
                    {
                        int intRandBuilding = rand.Next(100);
                        if (intRandBuilding >= 90)
                        {
                            BlockShapes.MakeHollowLayers(x + 3, x + 9, 63, 63, z + 3, z + 9, (int)BlockType.DOUBLE_SLAB);
                            for (int a = 0; a <= 3; a++)
                            {
                                bm.SetID(x + 6, 63, z + a, (int)BlockType.DOUBLE_SLAB);
                            }
                            int x1 = x + rand.Next(5, 7);
                            int z1 = z + rand.Next(5, 7);
                            BlockShapes.MakeSolidBox(x1, x1 + 1, 63, 63, z1, z1 + 1, (int)BlockType.STATIONARY_WATER);
                            int  intFail = 0, intTrees = 10;
                            bool blnValid = true;
                            do
                            {
                                x1 = x + 1 + rand.Next(0, intPlotSize - 2);
                                z1 = z + 1 + rand.Next(0, intPlotSize - 2);
                                if (bm.GetID(x1, 63, z1) != (int)BlockType.DOUBLE_SLAB &&
                                    bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER)
                                {
                                    blnValid = true;
                                    for (int a = x1 - 4; a <= x1 + 4 && blnValid; a++)
                                    {
                                        for (int b = z1 - 4; b <= z1 + 4 && blnValid; b++)
                                        {
                                            if (bm.GetID(a, 64, b) == (int)BlockType.SAPLING)
                                            {
                                                blnValid = false;
                                            }
                                        }
                                    }
                                    if (blnValid)
                                    {
                                        bm.SetID(x1, 64, z1, (int)BlockType.SAPLING);
                                        bm.SetData(x1, 64, z1, 15);
                                        intTrees--;
                                        intFail = 0;
                                    }
                                    else
                                    {
                                        intFail++;
                                    }
                                }
                            } while (intTrees > 0 && intFail < 200);
                            for (x1 = x + 1; x1 < x + intPlotSize - 1; x1++)
                            {
                                for (z1 = z + 1; z1 < z + intPlotSize - 1; z1++)
                                {
                                    if (bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER &&
                                        bm.GetID(x1, 64, z1) != (int)BlockType.SAPLING &&
                                        bm.GetID(x1, 63, z1) != (int)BlockType.DOUBLE_SLAB)
                                    {
                                        int intRand = rand.Next(100);
                                        if (intRand > 66)
                                        {
                                            bm.SetID(x1, 64, z1, (int)BlockType.YELLOW_FLOWER);
                                        }
                                        else if (intRand > 33)
                                        {
                                            bm.SetID(x1, 64, z1, (int)BlockType.RED_ROSE);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            BlockShapes.MakeHollowBox(x + 2, x + 10, 63, 67, z + 2, z + 10, (int)BlockType.WOOD_PLANK);
                            for (int a = 0; a <= 4; a++)
                            {
                                BlockShapes.MakeSolidBox(x + 2, x + 10, 67 + a, 67 + a, z + 2 + a, z + 10 - a, (int)BlockType.WOOD);
                            }
                            BlockShapes.MakeSolidBox(x + 10, x + 10, 65, 65, z + 6, z + 8, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 2, x + 2, 65, 65, z + 4, z + 8, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 2, z + 2, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 10, z + 10, (int)BlockType.GLASS);
                            bm.SetID(x + 10, 64, z + 4, (int)BlockType.WOOD_DOOR);
                            bm.SetData(x + 10, 64, z + 4, 5);
                            bm.SetID(x + 10, 65, z + 4, (int)BlockType.WOOD_DOOR);
                            bm.SetData(x + 10, 65, z + 4, 13);
                        }
                    }
                    BlockShapes.MakeHollowLayers(x, x + intPlotSize, 63, 63, z, z + intPlotSize, (int)BlockType.DOUBLE_SLAB);
                }
            }
        }
コード例 #13
0
        public static void MakeFarms(BetaWorld world, BlockManager bm, int intFarmSize, int intMapSize)
        {
            AddMushroomFarms(bm, intFarmSize, intMapSize);
            int intFail  = 0;
            int intFarms = 0;

            while (intFail <= 500)
            {
                int xlen = rand.Next(8, 26);
                int x1   = rand.Next(4, intMapSize - (4 + xlen));
                int zlen = rand.Next(8, 26);
                int z1   = rand.Next(4, intMapSize - (4 + zlen));
                if (!(x1 >= intFarmSize && z1 >= intFarmSize &&
                      x1 <= intMapSize - intFarmSize && z1 <= intMapSize - intFarmSize))
                {
                    bool booValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                        {
                            // make sure it doesn't overlap with the spawn point or another farm
                            if ((x == intMapSize / 2 && z == intMapSize - (intFarmSize - 10)) ||
                                bm.GetID(x, 63, z) != (int)BlockType.GRASS || bm.GetID(x, 64, z) != (int)BlockType.AIR)
                            {
                                booValid = false;
                                intFail++;
                            }
                        }
                    }
                    if (booValid)
                    {
                        // first there is a 25% chance of a hill or pond
                        // if not, for large farms, there is a 50% chance it'll be an orchard
                        // if not, 25% are cactus, 50% are wheat and 25% are sugarcane

                        FarmTypes curFarm;
                        int       intFarmType = rand.Next(100);
                        if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                        {
                            if (rand.NextDouble() > 0.5)
                            {
                                curFarm = FarmTypes.Pond;
                                MakePond(bm, x1, xlen, z1, zlen, false);
                            }
                            else
                            {
                                curFarm = FarmTypes.Hill;
                                MakeHill(bm, x1, xlen, z1, zlen, false);
                            }
                        }
                        else
                        {
                            intFarmType = rand.Next(100);
                            if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                            {
                                curFarm = FarmTypes.Orchard;
                                xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                            }
                            else
                            {
                                intFarmType = rand.Next(100);
                                if (intFarmType > 75)
                                {
                                    curFarm = FarmTypes.Cactus;
                                }
                                else if (intFarmType > 25)
                                {
                                    curFarm = FarmTypes.Wheat;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                                else
                                {
                                    curFarm = FarmTypes.SugarCane;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                            }
                        }

                        int intWallMaterial =
                            rand.NextDouble() > 0.5 ? (int)BlockType.FENCE : (int)BlockType.LEAVES;

                        switch (curFarm)
                        {
                        case FarmTypes.Hill:
                        case FarmTypes.Pond:
                            intWallMaterial = 0;
                            break;

                        case FarmTypes.SugarCane:
                        case FarmTypes.Mushroom:
                            if (rand.NextDouble() > 0.5)
                            {
                                intWallMaterial = 0;
                            }
                            break;

                        case FarmTypes.Wheat:
                            intWallMaterial = (int)BlockType.LEAVES;
                            break;
                        }
                        switch (intWallMaterial)
                        {
                        case (int)BlockType.FENCE:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen, (int)BlockType.FENCE);
                            break;

                        case (int)BlockType.LEAVES:
                            // the saplings will all disappear if one of them is broken.
                            // so we put wood beneath them to stop that happening
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen, (int)BlockType.WOOD);
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, (int)BlockType.LEAVES, 0,
                                                         RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE, (int)LeafType.BIRCH));
                            break;
                        }

                        switch (curFarm)
                        {
                        case FarmTypes.Orchard:
                            int intSaplingType = RandomHelper.RandomNumber(BlockHelper.SaplingBirch,
                                                                           BlockHelper.SaplingOak,
                                                                           BlockHelper.SaplingSpruce);
                            for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                            {
                                for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                {
                                    bm.SetID(x, 63, z, (int)BlockType.GRASS);
                                    bm.SetID(x, 64, z, (int)BlockType.SAPLING);
                                    bm.SetData(x, 64, z, intSaplingType);
                                }
                            }
                            break;

                        case FarmTypes.Cactus:
                            int intAttempts = 0;
                            do
                            {
                                int  xCactus = rand.Next(x1 + 1, x1 + xlen), zCactus = rand.Next(z1 + 1, z1 + zlen);
                                bool booValidFarm = true;
                                for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                {
                                    for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                    {
                                        if (bm.GetID(xCheck, 64, zCheck) != (int)BlockType.AIR)
                                        {
                                            booValidFarm = false;
                                        }
                                    }
                                }
                                if (booValidFarm)
                                {
                                    bm.SetID(xCactus, 64, zCactus, (int)BlockType.CACTUS);
                                    if (rand.NextDouble() > 0.5)
                                    {
                                        bm.SetID(xCactus, 65, zCactus, (int)BlockType.CACTUS);
                                    }
                                }
                                intAttempts++;
                            }while (intAttempts < 100);
                            break;

                        case FarmTypes.Wheat:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1, (int)BlockType.GLASS);
                            break;
                        }

                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                switch ((int)curFarm)
                                {
                                case (int)FarmTypes.Cactus:
                                    bm.SetID(x, 63, z, (int)BlockType.SAND);
                                    break;

                                case (int)FarmTypes.Wheat:
                                    if (z == z1 + 1)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.DOUBLE_SLAB);
                                    }
                                    else if (x % 2 == 0)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.FARMLAND);
                                        bm.SetData(x, 63, z, 1);
                                        bm.SetID(x, 64, z, (int)BlockType.CROPS);
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                    }
                                    break;

                                case (int)FarmTypes.SugarCane:
                                    if (z != z1 + 1)
                                    {
                                        if (x % 2 == 0)
                                        {
                                            bm.SetID(x, 64, z, (int)BlockType.SUGAR_CANE);
                                            if (rand.Next(100) > 50)
                                            {
                                                bm.SetID(x, 65, z, (int)BlockType.SUGAR_CANE);
                                            }
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                        }
                                    }
                                    break;
                                }
                            }
                        }

                        int d = rand.Next(x1 + 1, x1 + xlen - 1);
                        if (curFarm == FarmTypes.Wheat)
                        {
                            bm.SetID(d, 63, z1, (int)BlockType.DOUBLE_SLAB);
                        }
                        if (intWallMaterial != 0)
                        {
                            bm.SetID(d, 64, z1, (int)BlockType.WOOD_DOOR);
                            bm.SetData(d, 64, z1, 4);
                            bm.SetID(d, 65, z1, (int)BlockType.WOOD_DOOR);
                            bm.SetData(d, 65, z1, 4 + (int)DoorState.TOPHALF);
                        }
                        intFail = 0;
                        intFarms++;
                        if (intFarms % 10 == 0)
                        {
                            world.Save();
                        }
                    }
                }
            }
            MakeMiniPondsAndHills(world, bm, intFarmSize, intMapSize);
            MakeFlowers(bm, intFarmSize, intMapSize);
        }
コード例 #14
0
        public static void MakeFarms(BlockManager bm, int intFarmSize, int intMapSize)
        {
            int intFarms = intMapSize / 6;

            while (intFarms > 0)
            {
                int xlen = rand.Next(6, 14);
                int x1   = rand.Next(intMapSize - xlen);
                int zlen = rand.Next(6, 14);
                int z1   = rand.Next(intMapSize - zlen);
                if (!(x1 >= intFarmSize && z1 >= intFarmSize && x1 <= intMapSize - intFarmSize && z1 <= intMapSize - intFarmSize))
                {
                    bool booValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                        {
                            // make sure it doesn't overlap with the spawn point or another farm
                            if ((x == intMapSize / 2 && z == intMapSize - 21) || bm.GetID(x, 63, z) != (int)BlockType.GRASS || bm.GetID(x, 64, z) != (int)BlockType.AIR)
                            {
                                booValid = false;
                            }
                        }
                    }
                    if (booValid)
                    {
                        FarmTypes curFarm;
                        int       intFarmType = rand.Next(100);
                        if (intFarmType > 80)
                        {
                            curFarm = FarmTypes.Cactus;    // 20%
                        }
                        else if (intFarmType > 30)
                        {
                            curFarm = FarmTypes.Wheat;     // 50%
                        }
                        else
                        {
                            curFarm = FarmTypes.SugarCane; // 30%
                        }
                        BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen, (int)BlockType.FENCE);

                        if (curFarm == FarmTypes.Cactus)
                        {
                            int intAttempts = 0;
                            do
                            {
                                int  xCactus = rand.Next(x1 + 1, x1 + xlen), zCactus = rand.Next(z1 + 1, z1 + zlen);
                                bool booValidFarm = true;
                                for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                {
                                    for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                    {
                                        if (bm.GetID(xCheck, 64, zCheck) != (int)BlockType.AIR)
                                        {
                                            booValidFarm = false;
                                        }
                                    }
                                }
                                if (booValidFarm)
                                {
                                    bm.SetID(xCactus, 64, zCactus, (int)BlockType.CACTUS);
                                    if (rand.NextDouble() > 0.5)
                                    {
                                        bm.SetID(xCactus, 65, zCactus, (int)BlockType.CACTUS);
                                    }
                                }
                                intAttempts++;
                            }while (intAttempts < 100);
                        }

                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                switch ((int)curFarm)
                                {
                                case (int)FarmTypes.Cactus:
                                    bm.SetID(x, 63, z, (int)BlockType.SAND);
                                    break;

                                case (int)FarmTypes.Wheat:
                                    if (z == z1 + 1)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.DOUBLE_SLAB);
                                    }
                                    else if (x % 2 == 0)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.FARMLAND);
                                        bm.SetData(x, 63, z, 1);
                                        bm.SetID(x, 64, z, (int)BlockType.CROPS);
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                    }
                                    break;

                                case (int)FarmTypes.SugarCane:
                                    if (z != z1 + 1)
                                    {
                                        if (x % 2 == 0)
                                        {
                                            bm.SetID(x, 64, z, (int)BlockType.SUGAR_CANE);
                                            if (rand.Next(100) > 50)
                                            {
                                                bm.SetID(x, 65, z, (int)BlockType.SUGAR_CANE);
                                            }
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                        int d = rand.Next(x1 + 1, x1 + xlen - 1);
                        if (curFarm == FarmTypes.Wheat)
                        {
                            bm.SetID(d, 63, z1, (int)BlockType.DOUBLE_SLAB);
                        }
                        bm.SetID(d, 64, z1, (int)BlockType.WOOD_DOOR);
                        bm.SetData(d, 64, z1, 4);
                        bm.SetID(d, 65, z1, (int)BlockType.WOOD_DOOR);
                        bm.SetData(d, 65, z1, 12);
                        intFarms--;
                    }
                }
            }
        }
コード例 #15
0
        public static void MakeGuardTowers(BlockManager bm, int intFarmSize, int intMapSize,
                                           bool booIncludeWalls, string strOutsideLights, string strFireBeacons)
        {
            // remove wall
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79,
                                     intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
            // add tower
            BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80,
                                      intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            // divide into two rooms
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 2, 72,
                                     intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 67,
                                     intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
            switch (strOutsideLights)
            {
            case "Fire":
                for (int y = 72; y <= 79; y += 7)
                {
                    BlockShapes.MakeBlock(intFarmSize + 6, y, intFarmSize + 3, (int)BlockType.NETHERRACK, 2);
                    BlockShapes.MakeBlock(intFarmSize + 6, y + 1, intFarmSize + 3, (int)BlockType.FIRE, 2);
                    BlockShapes.MakeBlock(intFarmSize + 10, y, intFarmSize + 3, (int)BlockType.NETHERRACK, 2);
                    BlockShapes.MakeBlock(intFarmSize + 10, y + 1, intFarmSize + 3, (int)BlockType.FIRE, 2);
                }
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(intFarmSize + 6, y, intFarmSize + 3, (int)BlockType.STONE, 2);
                    BlockHelper.MakeTorch(intFarmSize + 10, y, intFarmSize + 3, (int)BlockType.STONE, 2);
                }
                break;
            }
            // add torches
            BlockHelper.MakeTorch(intFarmSize + 6, 79, intFarmSize + 13, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 79, intFarmSize + 13, (int)BlockType.STONE, 2);
            // add torches inside
            BlockHelper.MakeTorch(intFarmSize + 6, 77, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 77, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 5, 77, intFarmSize + 6, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 5, 77, intFarmSize + 10, (int)BlockType.STONE, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(intFarmSize + 7, 73, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 9, 73, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 7, 74, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 9, 74, intFarmSize + 12, (int)BlockType.AIR, 2);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81,
                                         intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            // alternating top blocks
            for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
            {
                for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
                {
                    if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 73, 82,
                                     intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
            BlockHelper.MakeLadder(intFarmSize + 7, 73, 82, intFarmSize + 8, 2);
            BlockHelper.MakeLadder(intFarmSize + 9, 73, 82, intFarmSize + 8, 2);
            // add torches on the roof
            BlockShapes.MakeBlock(intFarmSize + 6, 81, intFarmSize + 6, (int)BlockType.TORCH, 1);
            BlockShapes.MakeBlock(intFarmSize + 6, 81, intFarmSize + 10, (int)BlockType.TORCH, 2);
            BlockShapes.MakeBlock(intFarmSize + 10, 81, intFarmSize + 10, (int)BlockType.TORCH, 1);
            // add cobwebs
            BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
            // add chests
            MakeGuardChest(bm, intFarmSize + 11, 73, intFarmSize + 11);
            MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 73, intFarmSize + 11);
            MakeGuardChest(bm, intFarmSize + 11, 73, intMapSize - (intFarmSize + 11));
            MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 73, intMapSize - (intFarmSize + 11));
            // add archery slots
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 74, 77,
                                     intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 76, 76,
                                     intFarmSize + 7, intFarmSize + 9, (int)BlockType.AIR, 2);
            if (!booIncludeWalls)
            {
                BlockHelper.MakeLadder(intFarmSize + 13, 64, 72, intFarmSize + 8, 2);
            }
            // include beds
            BlockHelper.MakeBed(intFarmSize + 5, intFarmSize + 6, 64, intFarmSize + 8, intFarmSize + 8, 2);
            BlockHelper.MakeBed(intFarmSize + 5, intFarmSize + 6, 64, intFarmSize + 10, intFarmSize + 10, 2);
            BlockHelper.MakeBed(intFarmSize + 11, intFarmSize + 10, 64, intFarmSize + 8, intFarmSize + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 73, intFarmSize + 5, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 5, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.WOOD, 2);
            // add ladders
            BlockHelper.MakeLadder(intFarmSize + 5, 64, 73, intFarmSize + 6, 2, (int)BlockType.WOOD);
            // make torches
            BlockHelper.MakeTorch(intFarmSize + 10, 66, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmSize + 6, 66, intFarmSize + 11, (int)BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 66, intFarmSize + 11, (int)BlockType.WOOD, 2);
            // make columns for real
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 73, intFarmSize + 5, intFarmSize + 5, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 5, intFarmSize + 5, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.STONE, 2);
            // make cobwebs
            BlockShapes.MakeBlock(intFarmSize + 11, 67, intFarmSize + 8, (int)BlockType.COBWEB, 2, 75);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(intFarmSize + 11, 65, intFarmSize + 11, (int)BlockType.GOLD_BLOCK, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.GOLD_BLOCK, 1);
            BlockHelper.MakeDoor(intFarmSize + 11, 64, intFarmSize + 12, (int)BlockType.GOLD_BLOCK, true, 2);
            BlockShapes.MakeBlock(intFarmSize + 11, 65, intFarmSize + 11, (int)BlockType.AIR, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.AIR, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.STONE_PLATE, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 13, (int)BlockType.STONE_PLATE, 2);
            // make beacon
            if (strFireBeacons == "Yes")
            {
                BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 83, 84,
                                         intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 85, 85, intFarmSize + 6, intFarmSize + 10, (int)BlockType.STONE, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 86, 86, intFarmSize + 6, intFarmSize + 10, (int)BlockType.NETHERRACK, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 87, 87, intFarmSize + 6, intFarmSize + 10, (int)BlockType.FIRE, 1);
            }
        }
コード例 #16
0
ファイル: Farms.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeFarms(BetaWorld world, BlockManager bm, frmMace frmLogForm)
        {
            if (City.HasFarms)
            {
                frmLogForm.UpdateLog("Creating farm buildings", true, true);
                AddBuildings(bm);
                frmLogForm.UpdateLog("Creating farms and outside features", true, true);
                int intFail  = 0;
                int intFarms = 0;
                while (intFail <= 500)
                {
                    int xlen = RandomHelper.Next(8, 26);
                    int x1   = RandomHelper.Next(5, City.MapLength - (5 + xlen));
                    int zlen = RandomHelper.Next(8, 26);
                    int z1   = RandomHelper.Next(5, City.MapLength - (5 + zlen));
                    if (!(x1 >= City.FarmLength && z1 >= City.FarmLength &&
                          x1 <= City.MapLength - City.FarmLength && z1 <= City.MapLength - City.FarmLength))
                    {
                        bool booValid = true;
                        for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                        {
                            for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                            {
                                // make sure it doesn't overlap with the spawn point or another farm
                                if ((x == City.MapLength / 2 && z == SpawnZ) ||
                                    bm.GetID(x, 63, z) != City.GroundBlockID ||
                                    bm.GetID(x, 64, z) != BlockInfo.Air.ID)
                                {
                                    booValid = false;
                                    intFail++;
                                }
                            }
                        }
                        if (booValid)
                        {
                            // first there is a 25% chance of a hill or pond
                            // if not, for large farms, there is a 50% chance it'll be an orchard
                            // if not, 33% are cactus, 33% are wheat and 33% are sugarcane

                            FarmTypes curFarm;
                            int       intFarmType = RandomHelper.Next(100);
                            if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                            {
                                if (RandomHelper.NextDouble() > 0.5)
                                {
                                    curFarm = FarmTypes.Pond;
                                    MakePond(bm, x1, xlen, z1, zlen, false);
                                }
                                else
                                {
                                    curFarm = FarmTypes.Hill;
                                    MakeHill(bm, x1, xlen, z1, zlen, false);
                                }
                            }
                            else
                            {
                                intFarmType = RandomHelper.Next(100);
                                if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                                {
                                    curFarm = FarmTypes.Orchard;
                                    xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                    zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                                }
                                else
                                {
                                    intFarmType = RandomHelper.Next(3);
                                    if (intFarmType == 2)
                                    {
                                        curFarm = FarmTypes.Cactus;
                                    }
                                    else if (intFarmType == 1)
                                    {
                                        curFarm = FarmTypes.Wheat;
                                        xlen   += (xlen % 2) - 1;
                                        zlen   += (zlen % 2) - 1;
                                    }
                                    else
                                    {
                                        curFarm = FarmTypes.SugarCane;
                                        xlen   += (xlen % 2) - 1;
                                        zlen   += (zlen % 2) - 1;
                                    }
                                }
                            }

                            int intWallMaterial = RandomHelper.NextDouble() > 0.5 ? BlockInfo.Fence.ID : BlockInfo.Leaves.ID;

                            switch (curFarm)
                            {
                            case FarmTypes.Hill:
                            case FarmTypes.Pond:
                                intWallMaterial = 0;
                                break;

                            case FarmTypes.SugarCane:
                            case FarmTypes.Mushroom:
                                if (RandomHelper.NextDouble() > 0.5)
                                {
                                    intWallMaterial = 0;
                                }
                                break;

                            case FarmTypes.Wheat:
                                intWallMaterial = BlockInfo.Leaves.ID;
                                break;
                                // no need for default - the other types don't need anything here
                            }
#pragma warning disable
                            switch (intWallMaterial)
                            {
                            case BlockType.FENCE:
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen,
                                                             BlockInfo.Fence.ID, 0, -1);
                                break;

                            case BlockType.LEAVES:
                                // the saplings will all disappear if one of them is broken.
                                // so we put wood beneath them to stop that happening
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen,
                                                             BlockInfo.Wood.ID, 0, -1);
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, BlockInfo.Leaves.ID, 0,
                                                             RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE,
                                                                                       (int)LeafType.BIRCH));
                                break;

                            case 0:
                                // no wall
                                break;

                            default:
                                Debug.Fail("Invalid switch result");
                                break;
                            }
#pragma warning restore

                            switch (curFarm)
                            {
                            case FarmTypes.Orchard:
                                int intSaplingType = RandomHelper.RandomNumber(SaplingBirchDataID,
                                                                               SaplingOakDataID,
                                                                               SaplingSpruceDataID);
                                for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                                {
                                    for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                    {
                                        BlockShapes.MakeBlock(x, 63, z, City.GroundBlockID, City.GroundBlockData);
                                        BlockShapes.MakeBlock(x, 64, z, BlockInfo.Sapling.ID, intSaplingType);
                                    }
                                }
                                break;

                            case FarmTypes.Cactus:
                                int intAttempts = 0;
                                do
                                {
                                    int  xCactus      = RandomHelper.Next(x1 + 1, x1 + xlen);
                                    int  zCactus      = RandomHelper.Next(z1 + 1, z1 + zlen);
                                    bool booValidFarm = true;
                                    for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                    {
                                        for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                        {
                                            if (bm.GetID(xCheck, 64, zCheck) != BlockInfo.Air.ID)
                                            {
                                                booValidFarm = false;
                                            }
                                        }
                                    }
                                    if (booValidFarm)
                                    {
                                        bm.SetID(xCactus, 64, zCactus, BlockInfo.Cactus.ID);
                                        if (RandomHelper.NextDouble() > 0.5)
                                        {
                                            bm.SetID(xCactus, 65, zCactus, BlockInfo.Cactus.ID);
                                        }
                                    }
                                }while (++intAttempts < 100);
                                break;

                            case FarmTypes.Wheat:
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen,
                                                             BlockInfo.Glass.ID, 0, -1);
                                BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1,
                                                         BlockInfo.Glass.ID, 0);
                                break;
                                // no need for a default, because there's nothing to do for the other farms
                            }

                            for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                            {
                                for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                                {
                                    switch (curFarm)
                                    {
                                    case FarmTypes.Cactus:
                                        bm.SetID(x, 63, z, BlockInfo.Sand.ID);
                                        break;

                                    case FarmTypes.Wheat:
                                        if (z == z1 + 1)
                                        {
                                            bm.SetID(x, 63, z, BlockInfo.DoubleSlab.ID);
                                        }
                                        else if (x % 2 == 0)
                                        {
                                            BlockShapes.MakeBlock(x, 63, z, BlockInfo.Farmland.ID, 1);
                                            bm.SetID(x, 64, z, BlockInfo.Crops.ID);
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, BlockInfo.StationaryWater.ID);
                                        }
                                        break;

                                    case FarmTypes.SugarCane:
                                        if (z != z1 + 1)
                                        {
                                            if (x % 2 == 0)
                                            {
                                                bm.SetID(x, 64, z, BlockInfo.SugarCane.ID);
                                                if (RandomHelper.Next(100) > 50)
                                                {
                                                    bm.SetID(x, 65, z, BlockInfo.SugarCane.ID);
                                                }
                                            }
                                            else
                                            {
                                                bm.SetID(x, 63, z, BlockInfo.StationaryWater.ID);
                                            }
                                        }
                                        break;
                                        // no need for a default, because there's nothing to do for the other farms
                                    }
                                }
                            }
                            int intDoorPosition = x1 + RandomHelper.Next(1, xlen - 1);
                            if (curFarm == FarmTypes.Wheat)
                            {
                                bm.SetID(intDoorPosition, 63, z1, BlockInfo.DoubleSlab.ID);
                            }
                            if (intWallMaterial != 0)
                            {
                                if (curFarm == FarmTypes.Wheat || intWallMaterial == BlockInfo.Leaves.ID)
                                {
                                    BlockShapes.MakeBlock(intDoorPosition, 64, z1, BlockInfo.WoodDoor.ID, 4);
                                    BlockShapes.MakeBlock(intDoorPosition, 65, z1, BlockInfo.WoodDoor.ID, 4 + (int)DoorState.TOPHALF);
                                }
                                else
                                {
                                    bm.SetID(intDoorPosition, 64, z1, BlockInfo.FenceGate.ID);
                                    bm.SetData(intDoorPosition, 64, z1, 0);
                                }
                            }
                            intFail = 0;
                            if (++intFarms > 10)
                            {
                                world.Save();
                                intFarms = 0;
                            }
                        }
                    }
                }
                MakeMiniPondsAndHills(world, bm);
            }
            if (City.HasFlowers)
            {
                MakeFlowers(world, bm);
            }
        }
コード例 #17
0
        public static void MakeWalls(BetaWorld world, int intFarmSize, int intMapSize,
                                     string strCityEmblem, string strOutsideLights,
                                     int intWallMaterial)
        {
            // walls
            for (int a = intFarmSize + 6; a <= intFarmSize + 10; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 72, a, intMapSize - a, intWallMaterial, 0, -1);
                world.Save();
            }
            // outside and inside edges at the top
            BlockShapes.MakeHollowLayers(intFarmSize + 5, intMapSize - (intFarmSize + 5), 72, 73,
                                         intFarmSize + 5, intMapSize - (intFarmSize + 5), intWallMaterial, 0, -1);
            BlockShapes.MakeHollowLayers(intFarmSize + 11, intMapSize - (intFarmSize + 11), 72, 73,
                                         intFarmSize + 11, intMapSize - (intFarmSize + 11), intWallMaterial, 0, -1);
            // alternating blocks on top of the edges
            for (int a = intFarmSize + 6; a <= intMapSize - (intFarmSize + 6); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, intFarmSize + 5, intWallMaterial, 2, 100, -1);
            }
            for (int a = intFarmSize + 10; a <= intMapSize - (intFarmSize + 10); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, intFarmSize + 11, intWallMaterial, 2, 100, -1);
            }
            // ladder
            BlockHelper.MakeLadder((intMapSize / 2) - 5, 64, 72, intFarmSize + 11, 2, intWallMaterial);
            BlockShapes.MakeBlock((intMapSize / 2) - 5, 73, intFarmSize + 11, (int)BlockType.AIR, 2, 100, -1);
            // decorations at the gates
            switch (strOutsideLights)
            {
            case "Fire":
                // fire above the entrances
                BlockShapes.MakeBlock((intMapSize / 2) - 1, 69, intFarmSize + 5, (int)BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock((intMapSize / 2), 69, intFarmSize + 5, (int)BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock((intMapSize / 2) - 1, 70, intFarmSize + 5, (int)BlockType.FIRE, 2, 100, -1);
                BlockShapes.MakeBlock((intMapSize / 2), 70, intFarmSize + 5, (int)BlockType.FIRE, 2, 100, -1);
                // fire on the outside walls
                for (int a = intFarmSize + 8; a < (intMapSize / 2) - 9; a += 4)
                {
                    BlockShapes.MakeBlock(a, 69, intFarmSize + 5, (int)BlockType.NETHERRACK, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 70, intFarmSize + 5, (int)BlockType.FIRE, 2, 100, -1);
                }
                break;

            case "Torches":
                // torches above the entrances
                BlockHelper.MakeTorch((intMapSize / 2), 70, intFarmSize + 5, intWallMaterial, 2);
                BlockHelper.MakeTorch((intMapSize / 2) - 1, 70, intFarmSize + 5, intWallMaterial, 2);
                // torches on the outside walls
                for (int a = intFarmSize + 8; a < (intMapSize / 2) - 9; a += 4)
                {
                    BlockHelper.MakeTorch(a, 70, intFarmSize + 5, intWallMaterial, 2);
                }
                break;
            }
            // torches on the inside walls
            for (int a = intFarmSize + 16; a < (intMapSize / 2); a += 4)
            {
                BlockHelper.MakeTorch(a, 69, intFarmSize + 11, intWallMaterial, 2);
            }
            // torches on the wall roofs
            for (int a = intFarmSize + 16; a < (intMapSize / 2); a += 4)
            {
                BlockShapes.MakeBlock(a, 73, intFarmSize + 8, (int)BlockType.TORCH, 2, 100, -1);
            }
            MakeEmblem(intFarmSize, intMapSize, strCityEmblem);
        }
コード例 #18
0
        public static void MakeFarms()
        {
            Console.WriteLine("Making farms");
            int intFarms = intMapSize / 6;

            while (intFarms > 0)
            {
                int xlen = rand.Next(6, 14);
                int x1   = rand.Next(0, intMapSize - xlen);
                int zlen = rand.Next(6, 14);
                int z1   = rand.Next(0, intMapSize - zlen);
                if (!(x1 >= intFarmSize && z1 >= intFarmSize && x1 <= intMapSize - intFarmSize && z1 <= intMapSize - intFarmSize))
                {
                    bool blnValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && blnValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && blnValid; z++)
                        {
                            if (bm.GetID(x, 63, z) != (int)BlockType.GRASS || bm.GetID(x, 64, z) != (int)BlockType.AIR)
                            {
                                blnValid = false;
                            }
                        }
                    }
                    if (blnValid)
                    {
                        int intFarmType = rand.Next(100);
                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                if (z == z1 + 1)
                                {
                                    if (intFarmType < 75)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.DOUBLE_SLAB);
                                    }
                                }
                                else if (x % 2 == 0)
                                {
                                    if (intFarmType >= 75)
                                    {
                                        bm.SetID(x, 64, z, (int)BlockType.SUGAR_CANE);
                                        if (rand.Next(100) > 50)
                                        {
                                            bm.SetID(x, 65, z, (int)BlockType.SUGAR_CANE);
                                        }
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.FARMLAND);
                                        bm.SetData(x, 63, z, 1);
                                        bm.SetID(x, 64, z, (int)BlockType.CROPS);
                                    }
                                }
                                else
                                {
                                    bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                }
                            }
                        }
                        BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen, (int)BlockType.FENCE);
                        int d = rand.Next(x1 + 1, x1 + xlen - 1);
                        if (intFarmType < 75)
                        {
                            bm.SetID(d, 63, z1, (int)BlockType.DOUBLE_SLAB);
                        }
                        bm.SetID(d, 64, z1, (int)BlockType.WOOD_DOOR);
                        bm.SetData(d, 64, z1, 4);
                        bm.SetID(d, 65, z1, (int)BlockType.WOOD_DOOR);
                        bm.SetData(d, 65, z1, 12);
                        intFarms--;
                    }
                }
            }
        }
コード例 #19
0
ファイル: Buildings.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeBuildings(BlockManager bm, bool[,] booSewerEntrances,
                                         int intFarmSize, int intMapSize, int intSewerSectionSize)
        {
            int intPlotBlocks = (1 + intMapSize) - ((intFarmSize + 18) * 2);

            int[,] intArea = new int[intPlotBlocks, intPlotBlocks];

            for (int x = 0; x <= booSewerEntrances.GetUpperBound(0); x++)
            {
                for (int z = 0; z <= booSewerEntrances.GetUpperBound(1); z++)
                {
                    if (booSewerEntrances[x, z])
                    {
                        int a = intFarmSize + 20 + (x * intSewerSectionSize);
                        int b = intFarmSize + 20 + (z * intSewerSectionSize);
                        MakeSewerEntrance(bm, a, b, 8);
                        for (int xMap = a; xMap <= a + 8; xMap++)
                        {
                            for (int zMap = b; zMap <= b + 8; zMap++)
                            {
                                if (xMap == a || zMap == b || xMap == a + 8 || zMap == b + 8)
                                {
                                    intArea[xMap - (intFarmSize + 20), zMap - (intFarmSize + 20)] = 2;
                                }
                                else
                                {
                                    intArea[xMap - (intFarmSize + 20), zMap - (intFarmSize + 20)] = 2;
                                }
                            }
                        }
                    }
                }
            }
            for (int intPlotSize = 12; intPlotSize > 3; intPlotSize -= 2)
            {
                for (int intAttempts = 0; intAttempts < 1000; intAttempts++)
                {
                    int x = rand.Next(1 + (intArea.GetUpperBound(0) / 2)) * 2;
                    int z = rand.Next(1 + (intArea.GetUpperBound(1) / 2)) * 2;
                    if (x + intPlotSize <= intArea.GetUpperBound(0) && z + intPlotSize <= intArea.GetUpperBound(1))
                    {
                        bool booValid = true;
                        for (int d = x; d < x + intPlotSize; d++)
                        {
                            for (int e = z; e < z + intPlotSize; e++)
                            {
                                if (intArea[d, e] == 2)
                                {
                                    booValid = false;
                                }
                            }
                        }
                        if (booValid)
                        {
                            int xMap = x + (intFarmSize + 18);
                            int zMap = z + (intFarmSize + 18);
                            BlockShapes.MakeHollowLayers(xMap, xMap + intPlotSize, 63, 63,
                                                         zMap, zMap + intPlotSize, (int)BlockType.DOUBLE_SLAB);
                            switch (intPlotSize)
                            {
                            case 12:
                                MakeHouse(bm, xMap, zMap);
                                break;

                            case 10:
                                MakePark(bm, xMap, zMap);
                                break;

                            case 8:
                                break;

                            case 6:
                                break;

                            case 4:
                                MakeSmallPark(bm, xMap, zMap);
                                break;
                            }
                            for (int d = x; d <= x + intPlotSize; d++)
                            {
                                for (int e = z; e <= z + intPlotSize; e++)
                                {
                                    if (d == x || e == z || d == x + intPlotSize || e == z + intPlotSize)
                                    {
                                        intArea[d, e] = 1;
                                    }
                                    else
                                    {
                                        intArea[d, e] = 2;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #20
0
ファイル: Walls.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeWalls(BetaWorld 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.MakeBlock((City.MapLength / 2) - 5, 73, City.EdgeLength + 11, BlockInfo.Air.ID, 2, 100, -1);
            // 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);
                }
            }
            frmLogForm.UpdateLog("Creating wall emblems: " + City.CityEmblemType, true, true);
            MakeEmblem();
        }
コード例 #21
0
ファイル: Farms.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeFarms(BetaWorld world, BlockManager bm, int intFarmLength, int intMapLength)
        {
            AddBuildings(bm, intFarmLength, intMapLength);
            int intFail  = 0;
            int intFarms = 0;

            while (intFail <= 500)
            {
                int xlen = RandomHelper.Next(8, 26);
                int x1   = RandomHelper.Next(4, intMapLength - (4 + xlen));
                int zlen = RandomHelper.Next(8, 26);
                int z1   = RandomHelper.Next(4, intMapLength - (4 + zlen));
                if (!(x1 >= intFarmLength && z1 >= intFarmLength &&
                      x1 <= intMapLength - intFarmLength && z1 <= intMapLength - intFarmLength))
                {
                    bool booValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                        {
                            // make sure it doesn't overlap with the spawn point or another farm
                            if ((x == intMapLength / 2 && z == intMapLength - (intFarmLength - 10)) ||
                                bm.GetID(x, 63, z) != BlockType.GRASS || bm.GetID(x, 64, z) != BlockType.AIR)
                            {
                                booValid = false;
                                intFail++;
                            }
                        }
                    }
                    if (booValid)
                    {
                        // first there is a 25% chance of a hill or pond
                        // if not, for large farms, there is a 50% chance it'll be an orchard
                        // if not, 33% are cactus, 33% are wheat and 33% are sugarcane

                        FarmTypes curFarm;
                        int       intFarmType = RandomHelper.Next(100);
                        if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                        {
                            if (RandomHelper.NextDouble() > 0.5)
                            {
                                curFarm = FarmTypes.Pond;
                                MakePond(bm, x1, xlen, z1, zlen, false);
                            }
                            else
                            {
                                curFarm = FarmTypes.Hill;
                                MakeHill(bm, x1, xlen, z1, zlen, false);
                            }
                        }
                        else
                        {
                            intFarmType = RandomHelper.Next(100);
                            if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                            {
                                curFarm = FarmTypes.Orchard;
                                xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                            }
                            else
                            {
                                intFarmType = RandomHelper.Next(3);
                                if (intFarmType == 2)
                                {
                                    curFarm = FarmTypes.Cactus;
                                }
                                else if (intFarmType == 1)
                                {
                                    curFarm = FarmTypes.Wheat;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                                else
                                {
                                    curFarm = FarmTypes.SugarCane;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                            }
                        }

                        int intWallMaterial = RandomHelper.NextDouble() > 0.5 ? BlockType.FENCE : BlockType.LEAVES;

                        switch (curFarm)
                        {
                        case FarmTypes.Hill:
                        case FarmTypes.Pond:
                            intWallMaterial = 0;
                            break;

                        case FarmTypes.SugarCane:
                        case FarmTypes.Mushroom:
                            if (RandomHelper.NextDouble() > 0.5)
                            {
                                intWallMaterial = 0;
                            }
                            break;

                        case FarmTypes.Wheat:
                            intWallMaterial = BlockType.LEAVES;
                            break;
                            // no need for default - the other types don't need anything here
                        }
                        switch (intWallMaterial)
                        {
                        case BlockType.FENCE:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen,
                                                         BlockType.FENCE, 0, -1);
                            break;

                        case BlockType.LEAVES:
                            // the saplings will all disappear if one of them is broken.
                            // so we put wood beneath them to stop that happening
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen,
                                                         BlockType.WOOD, 0, -1);
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, BlockType.LEAVES, 0,
                                                         RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE,
                                                                                   (int)LeafType.BIRCH));
                            break;

                        case 0:
                            // no wall
                            break;

                        default:
                            Debug.Fail("Invalid switch result");
                            break;
                        }

                        switch (curFarm)
                        {
                        case FarmTypes.Orchard:
                            int intSaplingType = RandomHelper.RandomNumber(SaplingBirchDataID,
                                                                           SaplingOakDataID,
                                                                           SaplingSpruceDataID);
                            for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                            {
                                for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                {
                                    bm.SetID(x, 63, z, BlockType.GRASS);
                                    BlockShapes.MakeBlock(x, 64, z, BlockType.SAPLING, intSaplingType);
                                }
                            }
                            break;

                        case FarmTypes.Cactus:
                            int intAttempts = 0;
                            do
                            {
                                int  xCactus      = RandomHelper.Next(x1 + 1, x1 + xlen);
                                int  zCactus      = RandomHelper.Next(z1 + 1, z1 + zlen);
                                bool booValidFarm = true;
                                for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                {
                                    for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                    {
                                        if (bm.GetID(xCheck, 64, zCheck) != BlockType.AIR)
                                        {
                                            booValidFarm = false;
                                        }
                                    }
                                }
                                if (booValidFarm)
                                {
                                    bm.SetID(xCactus, 64, zCactus, BlockType.CACTUS);
                                    if (RandomHelper.NextDouble() > 0.5)
                                    {
                                        bm.SetID(xCactus, 65, zCactus, BlockType.CACTUS);
                                    }
                                }
                            }while (++intAttempts < 100);
                            break;

                        case FarmTypes.Wheat:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen,
                                                         BlockType.GLASS, 0, -1);
                            BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1,
                                                     BlockType.GLASS, 0);
                            break;
                            // no need for a default, because there's nothing to do for the other farms
                        }

                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                switch (curFarm)
                                {
                                case FarmTypes.Cactus:
                                    bm.SetID(x, 63, z, BlockType.SAND);
                                    break;

                                case FarmTypes.Wheat:
                                    if (z == z1 + 1)
                                    {
                                        bm.SetID(x, 63, z, BlockType.DOUBLE_SLAB);
                                    }
                                    else if (x % 2 == 0)
                                    {
                                        BlockShapes.MakeBlock(x, 63, z, BlockType.FARMLAND, 1);
                                        bm.SetID(x, 64, z, BlockType.CROPS);
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, BlockType.STATIONARY_WATER);
                                    }
                                    break;

                                case FarmTypes.SugarCane:
                                    if (z != z1 + 1)
                                    {
                                        if (x % 2 == 0)
                                        {
                                            bm.SetID(x, 64, z, BlockType.SUGAR_CANE);
                                            if (RandomHelper.Next(100) > 50)
                                            {
                                                bm.SetID(x, 65, z, BlockType.SUGAR_CANE);
                                            }
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, BlockType.STATIONARY_WATER);
                                        }
                                    }
                                    break;
                                    // no need for a default, because there's nothing to do for the other farms
                                }
                            }
                        }
                        int intDoorPosition = x1 + RandomHelper.Next(1, xlen - 1);
                        if (curFarm == FarmTypes.Wheat)
                        {
                            bm.SetID(intDoorPosition, 63, z1, BlockType.DOUBLE_SLAB);
                        }
                        if (intWallMaterial != 0)
                        {
                            BlockShapes.MakeBlock(intDoorPosition, 64, z1, BlockType.WOOD_DOOR, 4);
                            BlockShapes.MakeBlock(intDoorPosition, 65, z1, BlockType.WOOD_DOOR,
                                                  4 + (int)DoorState.TOPHALF);
                        }
                        intFail = 0;
                        if (++intFarms > 10)
                        {
                            world.Save();
                            intFarms = 0;
                        }
                    }
                }
            }
            MakeMiniPondsAndHills(world, bm, intFarmLength, intMapLength);
            MakeFlowers(bm, intFarmLength, intMapLength);
        }
コード例 #22
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();
        }
コード例 #23
0
        public static void MakeMoat(int intFarmSize, int intMapSize, string strMoatType, bool booIncludeGuardTowers)
        {
            switch (strMoatType)
            {
            case "Drop to Bedrock":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 2, 63, a, intMapSize - a, (int)BlockType.AIR, 0, -1);
                }
                break;

            case "Cactus":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 63, a, intMapSize - a, (int)BlockType.AIR, 0, -1);
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 58, a, intMapSize - a, (int)BlockType.SAND, 0, -1);
                }
                for (int a = intFarmSize + 1; a <= intMapSize / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 1, (int)BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 3, (int)BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 1, (int)BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 3, (int)BlockType.CACTUS, 2, 50, -1);
                }
                for (int a = intFarmSize; a <= intMapSize / 2; a += 2)
                {
                    BlockShapes.MakeBlock(a, 59, intFarmSize, (int)BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 2, (int)BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 59, intFarmSize + 4, (int)BlockType.CACTUS, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmSize, (int)BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 2, (int)BlockType.CACTUS, 2, 50, -1);
                    BlockShapes.MakeBlock(a, 60, intFarmSize + 4, (int)BlockType.CACTUS, 2, 50, -1);
                }
                if (booIncludeGuardTowers)
                {
                    for (int a = intFarmSize + 3; a <= intFarmSize + 13; a += 2)
                    {
                        BlockShapes.MakeBlock(a, 59, intFarmSize + 3, (int)BlockType.AIR, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, intFarmSize + 3, (int)BlockType.AIR, 2, 100, -1);
                    }
                }
                break;

            case "Lava":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 62, 63, a, intMapSize - a, (int)BlockType.AIR, 0, -1);
                }
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 61, a, intMapSize - a, (int)BlockType.LAVA, 0, -1);
                }
                break;

            case "Water":
                for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 63, a, intMapSize - a, (int)BlockType.WATER, 0, -1);
                }
                break;
            }
        }
コード例 #24
0
ファイル: Moat.cs プロジェクト: RavetcoFX/mace-minecraft
 public static void MakeMoat(frmMace frmLogForm, BlockManager bm)
 {
     frmLogForm.UpdateLog("Moat type: " + City.MoatType, true, true);
     switch (City.MoatType)
     {
         case "Drop to Bedrock":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 2, 63, a,
                                              City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             BlockShapes.MakeHollowLayers(City.EdgeLength - 2, City.MapLength - (City.EdgeLength - 2),
                                          64, 64,
                                          City.EdgeLength - 2, City.MapLength - (City.EdgeLength - 2), BlockInfo.Fence.ID, 0, -1);
             break;
         case "Cactus":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 63, 63, a,
                                              City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
             }
             for (int a = City.EdgeLength + 1; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             for (int a = City.EdgeLength; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             if (City.HasGuardTowers)
             {
                 for (int a = City.EdgeLength + 3; a <= City.EdgeLength + 13; a += 2)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                 }
             }
             break;
         case "Cactus Low":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 58,
                                              a, City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
             }
             for (int a = City.EdgeLength + 1; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             for (int a = City.EdgeLength; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             if (City.HasGuardTowers)
             {
                 for (int a = City.EdgeLength + 3; a <= City.EdgeLength + 13; a += 2)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                 }
             }
             break;
         case "Lava":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 55, 56,
                                              a, City.MapLength - a, BlockInfo.Lava.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             break;
         case "Fire":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 56, 56,
                                              a, City.MapLength - a, BlockInfo.Netherrack.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 57,
                                              a, City.MapLength - a, BlockInfo.Fire.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             break;
         case "Water":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                              a, City.MapLength - a, BlockInfo.Water.ID, 0, -1);
             }
             break;
         default:
             Debug.Fail("Invalid switch result");
             break;
     }
     // drawbridge
     int intBridgeEnd = City.HasMoat ? -2 : 5;
     if (City.MoatType == "Lava" || City.MoatType == "Fire")
     {
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.StoneBrick.ID, 2);
     }
     else
     {
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.WoodPlank.ID, 2);
     }
     BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 64, 65,
                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.Air.ID, 2);
 }
コード例 #25
0
        public static void MakeGuardTowers(BlockManager bm, frmMace frmLogForm)
        {
            // remove wall
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 11, 64, 79,
                                     City.EdgeLength + 5, City.EdgeLength + 11, BlockInfo.Air.ID, 1);
            // add tower
            BlockShapes.MakeHollowBox(City.EdgeLength + 4, City.EdgeLength + 12, 63, 80,
                                      City.EdgeLength + 4, City.EdgeLength + 12, City.WallMaterialID, 1, City.WallMaterialData);
            // divide into two rooms
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 4, City.EdgeLength + 12, 2, 72,
                                             City.EdgeLength + 4, City.EdgeLength + 12,
                                             City.WallMaterialID, 1, City.WallMaterialData);
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 11, 64, 67,
                                     City.EdgeLength + 5, City.EdgeLength + 11, BlockInfo.Air.ID, 1);

            switch (City.OutsideLightType)
            {
            case "Fire":
                BlockShapes.MakeBlock(City.EdgeLength + 5, 76, City.EdgeLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 5, 77, City.EdgeLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 11, 76, City.EdgeLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 11, 77, City.EdgeLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(City.EdgeLength + 6, y, City.EdgeLength + 3, City.WallMaterialID, 2);
                    BlockHelper.MakeTorch(City.EdgeLength + 10, y, City.EdgeLength + 3, City.WallMaterialID, 2);
                }
                break;

            case "None":
            case "":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            if (City.HasTorchesOnWalkways)
            {
                // add torches
                BlockHelper.MakeTorch(City.EdgeLength + 6, 79, City.EdgeLength + 13, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 79, City.EdgeLength + 13, City.WallMaterialID, 2);
                // add torches inside
                BlockHelper.MakeTorch(City.EdgeLength + 6, 77, City.EdgeLength + 11, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 77, City.EdgeLength + 11, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 5, 77, City.EdgeLength + 6, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 5, 77, City.EdgeLength + 10, City.WallMaterialID, 2);
            }
            // add openings to the walls
            BlockShapes.MakeBlock(City.EdgeLength + 7, 73, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 9, 73, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 7, 74, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 9, 74, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(City.EdgeLength + 4, City.EdgeLength + 12, 81, 81,
                                         City.EdgeLength + 4, City.EdgeLength + 12,
                                         City.WallMaterialID, 1, City.WallMaterialData);

            // alternating top blocks
            for (int x = City.EdgeLength + 4; x <= City.EdgeLength + 12; x += 2)
            {
                for (int z = City.EdgeLength + 4; z <= City.EdgeLength + 12; z += 2)
                {
                    if (x == City.EdgeLength + 4 ||
                        x == City.EdgeLength + 12 ||
                        z == City.EdgeLength + 4 ||
                        z == City.EdgeLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, City.WallMaterialID, 1, 100, City.WallMaterialData);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 8, City.EdgeLength + 8, 73, 82,
                                             City.EdgeLength + 8, City.EdgeLength + 8, City.WallMaterialID, 1,
                                             City.WallMaterialData);
            BlockHelper.MakeLadder(City.EdgeLength + 7, 73, 82, City.EdgeLength + 8, 2, City.WallMaterialID);
            BlockHelper.MakeLadder(City.EdgeLength + 9, 73, 82, City.EdgeLength + 8, 2, City.WallMaterialID);
            // add torches on the roof
            if (City.HasTorchesOnWalkways)
            {
                BlockShapes.MakeBlock(City.EdgeLength + 6, 81, City.EdgeLength + 6, BlockInfo.Torch.ID, 1, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 6, 81, City.EdgeLength + 10, BlockInfo.Torch.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 10, 81, City.EdgeLength + 10, BlockInfo.Torch.ID, 1, 100, -1);
            }
            // add cobwebs
            BlockShapes.MakeBlock(City.EdgeLength + 5, 79, City.EdgeLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 5, 79, City.EdgeLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 79, City.EdgeLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 79, City.EdgeLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);

            // add chests
            MakeGuardChest(bm, City.EdgeLength + 11, 73, City.EdgeLength + 11);
            MakeGuardChest(bm, City.MapLength - (City.EdgeLength + 11), 73, City.EdgeLength + 11);
            MakeGuardChest(bm, City.EdgeLength + 11, 73, City.MapLength - (City.EdgeLength + 11));
            MakeGuardChest(bm, City.MapLength - (City.EdgeLength + 11), 73, City.MapLength - (City.EdgeLength + 11));

            // add archery slots
            BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 74, 77,
                                     City.EdgeLength + 8, City.EdgeLength + 8, BlockInfo.Air.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 76, 76,
                                     City.EdgeLength + 7, City.EdgeLength + 9, BlockInfo.Air.ID, 2);
            if (!City.HasWalls)
            {
                BlockHelper.MakeLadder(City.EdgeLength + 13, 64, 72, City.EdgeLength + 8, 2, City.WallMaterialID);
            }
            // include beds
            BlockHelper.MakeBed(City.EdgeLength + 5, City.EdgeLength + 6, 64, City.EdgeLength + 8, City.EdgeLength + 8, 2);
            BlockHelper.MakeBed(City.EdgeLength + 5, City.EdgeLength + 6, 64, City.EdgeLength + 10, City.EdgeLength + 10, 2);
            BlockHelper.MakeBed(City.EdgeLength + 11, City.EdgeLength + 10, 64, City.EdgeLength + 8, City.EdgeLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 5, 64, 73,
                                     City.EdgeLength + 5, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71,
                                     City.EdgeLength + 5, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 5, 64, 71,
                                     City.EdgeLength + 11, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71,
                                     City.EdgeLength + 11, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            // add ladders
            BlockHelper.MakeLadder(City.EdgeLength + 5, 64, 73, City.EdgeLength + 6, 2, BlockInfo.Wood.ID);
            // make torches
            if (City.HasTorchesOnWalkways)
            {
                BlockHelper.MakeTorch(City.EdgeLength + 10, 66, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 6, 66, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 66, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            }
            // make columns for real
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 5, City.EdgeLength + 5, 64, 73, City.EdgeLength + 5,
                                             City.EdgeLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71, City.EdgeLength + 5,
                                             City.EdgeLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 5, City.EdgeLength + 5, 64, 71, City.EdgeLength + 11,
                                             City.EdgeLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71, City.EdgeLength + 11,
                                             City.EdgeLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            // make cobwebs
            BlockShapes.MakeBlock(City.EdgeLength + 11, 67, City.EdgeLength + 8, BlockInfo.Cobweb.ID, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(City.EdgeLength + 11, 65, City.EdgeLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockHelper.MakeDoor(City.EdgeLength + 11, 64, City.EdgeLength + 12, BlockInfo.GoldBlock.ID, true, 2);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 65, City.EdgeLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.StonePlate.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 13, BlockInfo.StonePlate.ID, 2, 100, -1);
            //BlockShapes.MakeBlock(City.intFarmSize + 13, 64, City.intFarmSize + 11, BlockInfo.Stone.ID_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(City.EdgeLength + 12, 65, City.EdgeLength + 13, "~Guard Tower~~", City.WallMaterialID, 1);
            BlockHelper.MakeSign(City.EdgeLength + 8, 74, City.EdgeLength + 13, "~Guard Tower~~", City.WallMaterialID, 2);
            // make beacon
            frmLogForm.UpdateLog("Creating tower addition: " + City.TowersAdditionType, true, true);
            switch (City.TowersAdditionType)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 8, City.EdgeLength + 8, 83, 84,
                                                 City.EdgeLength + 8, City.EdgeLength + 8,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 6, City.EdgeLength + 10, 85, 85,
                                                 City.EdgeLength + 6, City.EdgeLength + 10,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBox(City.EdgeLength + 6, City.EdgeLength + 10, 86, 86,
                                         City.EdgeLength + 6, City.EdgeLength + 10, BlockInfo.Netherrack.ID, 1);
                BlockShapes.MakeSolidBox(City.EdgeLength + 6, City.EdgeLength + 10, 87, 87,
                                         City.EdgeLength + 6, City.EdgeLength + 10, BlockInfo.Fire.ID, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 83, 91,
                                         City.EdgeLength + 12, City.EdgeLength + 12, BlockInfo.Fence.ID, 2);
                BlockShapes.MakeBlock(City.EdgeLength + 4, 84, City.EdgeLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                BlockShapes.MakeBlock(City.EdgeLength + 4, 91, City.EdgeLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                int[] intColours = RNG.ShuffleArray(Enumerable.Range(0, 15).ToArray());
                // select a random flag file and turn it into an array
                string[] strFlagLines = File.ReadAllLines(RNG.RandomItemFromArray(Directory.GetFiles("Resources", "Flag_*.txt")));
                for (int x = 0; x < strFlagLines[0].Length; x++)
                {
                    for (int y = 0; y < strFlagLines.GetLength(0); y++)
                    {
                        int WoolColourID = Convert.ToInt32(strFlagLines[y].Substring(x, 1));
                        BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 4, City.EdgeLength + 4,
                                                         90 - y, 90 - y,
                                                         City.EdgeLength + 13 + x, City.EdgeLength + 13 + x,
                                                         BlockInfo.Wool.ID, 2, intColours[WoolColourID]);
                    }
                }
                break;
            }
        }
コード例 #26
0
ファイル: Sewers.cs プロジェクト: RavetcoFX/mace-minecraft
        public static bool[,] MakeSewers(int intFarmSize, int intMapSize, int intPlotSize)
        {
            int intPlots = 1 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize);

            bool[,] booNewSewerEntrances = MakeSewerEntrances(intPlots, false);

            Maze maze = new Maze();

            // 51, 43, 35, 27, 19, 11, 3
            for (int y = 3; y <= 51; y += 8)
            {
                bool[,] booOldSewerEntrances = booNewSewerEntrances;
                booNewSewerEntrances         = MakeSewerEntrances(intPlots, y == 51);
                bool[,] booMaze = maze.GenerateMaze((intPlots * 2) + 1, (intPlots * 2) + 1);
                booMaze         = maze.CreateLoops(booMaze, booMaze.GetLength(0) / 4);
                if (y == 3)
                {
                    booMaze = maze.DeleteDeadEnds(booMaze, booNewSewerEntrances);
                }
                else
                {
                    booMaze = maze.DeleteDeadEnds(booMaze,
                                                  MergeBooleanArrays(booNewSewerEntrances, booOldSewerEntrances));
                }
                for (int x = 0; x < booMaze.GetUpperBound(0); x++)
                {
                    for (int z = 0; z < booMaze.GetUpperBound(1); z++)
                    {
                        if (booMaze[x, z])
                        {
                            MakeSewerSection(booMaze, x, z, intFarmSize + 18 + (x * intPlotSize / 2),
                                             intFarmSize + 18 + (z * intPlotSize / 2), y, intPlotSize);
                        }
                    }
                }
                for (int x = 0; x < booMaze.GetUpperBound(0); x++)
                {
                    for (int z = 0; z < booMaze.GetUpperBound(1); z++)
                    {
                        if (booMaze[x, z])
                        {
                            if (y > 3 &&
                                x % 2 == 1 && z % 2 == 1 &&
                                booOldSewerEntrances[(x - 1) / 2, (z - 1) / 2])
                            {
                                BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2) - 1,
                                                         intFarmSize + 18 + (x * intPlotSize / 2) + 1,
                                                         y - 7, y + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) - 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         (int)BlockType.AIR);
                                BlockShapes.MakeHollowLayers(intFarmSize + 18 + (x * intPlotSize / 2) - 1,
                                                             intFarmSize + 18 + (x * intPlotSize / 2) + 1,
                                                             y, y,
                                                             intFarmSize + 18 + (z * intPlotSize / 2) - 1,
                                                             intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                             (int)BlockType.STONE);
                                BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2),
                                                         intFarmSize + 18 + (x * intPlotSize / 2),
                                                         y - 7, y + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         (int)BlockType.STONE);
                                BlockHelper.MakeLadder(intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1,
                                                       intFarmSize + 18 + (z * intPlotSize / 2));
                            }
                        }
                    }
                }
            }
            return(booNewSewerEntrances);
        }
コード例 #27
0
ファイル: Moat.cs プロジェクト: RavetcoFX/mace-minecraft
        public static void MakeMoat(frmMace frmLogForm)
        {
            frmLogForm.UpdateLog("Moat type: " + City.MoatType, true, true);
            switch (City.MoatType)
            {
            case "Drop to Bedrock":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 2, 63, a,
                                                 City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                }
                break;

            case "Cactus":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 63, 63, a,
                                                 City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
                }
                for (int a = City.FarmLength + 1; a <= City.MapLength / 2; a += 2)
                {
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                }
                for (int a = City.FarmLength; a <= City.MapLength / 2; a += 2)
                {
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                }
                if (City.HasGuardTowers)
                {
                    for (int a = City.FarmLength + 3; a <= City.FarmLength + 13; a += 2)
                    {
                        BlockShapes.MakeBlock(a, 64, City.FarmLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 65, City.FarmLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                    }
                }
                break;

            case "Low Cactus":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                                 a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 58,
                                                 a, City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
                }
                for (int a = City.FarmLength + 1; a <= City.MapLength / 2; a += 2)
                {
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                }
                for (int a = City.FarmLength; a <= City.MapLength / 2; a += 2)
                {
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                    if (RandomHelper.NextDouble() > 0.5)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                    }
                }
                if (City.HasGuardTowers)
                {
                    for (int a = City.FarmLength + 3; a <= City.FarmLength + 13; a += 2)
                    {
                        BlockShapes.MakeBlock(a, 59, City.FarmLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                        BlockShapes.MakeBlock(a, 60, City.FarmLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                    }
                }
                break;

            case "Lava":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 55, 56,
                                                 a, City.MapLength - a, BlockInfo.Lava.ID, 0, -1);
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 63,
                                                 a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                }
                break;

            case "Fire":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 56, 56,
                                                 a, City.MapLength - a, BlockInfo.Netherrack.ID, 0, -1);
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 57,
                                                 a, City.MapLength - a, BlockInfo.Fire.ID, 0, -1);
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 63,
                                                 a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                }
                break;

            case "Water":
                for (int a = City.FarmLength - 1; a <= City.FarmLength + 5; a++)
                {
                    BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                                 a, City.MapLength - a, BlockInfo.Water.ID, 0, -1);
                }
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
        }