public override bool Place(Point origin, StructureMap structures)
 {
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point = new Point(origin.X - 25, origin.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 59, 147, 1 };
     WorldUtils.Gen(point, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     int item = nums[0] + nums[1];
     int num = nums[59];
     int item1 = nums[147];
     if (item1 <= num || item1 <= item)
     {
         return false;
     }
     int num1 = 0;
     for (int i = GenBase._random.Next(10, 15); i > 5; i--)
     {
         int num2 = GenBase._random.Next(-5, 5);
         Point point1 = new Point(origin.X + num2, origin.Y + num1);
         Shapes.Circle circle = new Shapes.Circle(i);
         GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 0.3), null, null };
         ushort[] numArray1 = new ushort[] { 147, 161, 224, 0, 1 };
         blotch[1] = new Modifiers.OnlyTiles(numArray1);
         blotch[2] = new Actions.SetTile(162, true, true);
         WorldUtils.Gen(point1, circle, Actions.Chain(blotch));
         Point point2 = new Point(origin.X + num2, origin.Y + num1);
         Shapes.Circle circle1 = new Shapes.Circle(i);
         GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(4, 0.3), new Modifiers.HasLiquid(-1, -1), new Actions.SetTile(162, true, true), new Actions.SetLiquid(0, 0) };
         WorldUtils.Gen(point2, circle1, Actions.Chain(genActionArray));
         num1 = num1 + (i - 2);
     }
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point y;
     Point point;
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point1 = new Point(origin.X - 25, origin.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 1 };
     WorldUtils.Gen(point1, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     if (nums[0] + nums[1] < 1250)
     {
         return false;
     }
     Searches.Up up = new Searches.Up(1000);
     GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(1, 50).Not() };
     bool flag = WorldUtils.Find(origin, Searches.Chain(up, genConditionArray), out y);
     Point point2 = origin;
     Searches.Up up1 = new Searches.Up(origin.Y - y.Y);
     GenCondition[] isTile = new GenCondition[1];
     ushort[] numArray1 = new ushort[] { 53 };
     isTile[0] = new Conditions.IsTile(numArray1);
     if (WorldUtils.Find(point2, Searches.Chain(up1, isTile), out point))
     {
         return false;
     }
     if (!flag)
     {
         return false;
     }
     y.Y = y.Y + 50;
     ShapeData shapeDatum = new ShapeData();
     ShapeData shapeDatum1 = new ShapeData();
     Point point3 = new Point(origin.X, origin.Y + 20);
     Point point4 = new Point(origin.X, origin.Y + 30);
     float single = 0.8f + GenBase._random.NextFloat() * 0.5f;
     if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 0))
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(origin.X, y.Y + 10, 1, origin.Y - y.Y - 9), 2))
     {
         return false;
     }
     Shapes.Slime slime = new Shapes.Slime(20, single, 1f);
     GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.4), (new Actions.ClearTile(true)).Output(shapeDatum) };
     WorldUtils.Gen(point3, slime, Actions.Chain(blotch));
     Shapes.Mound mound = new Shapes.Mound(14, 14);
     GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), (new Actions.SetFrames(true)).Output(shapeDatum1) };
     WorldUtils.Gen(point4, mound, Actions.Chain(genActionArray));
     shapeDatum.Subtract(shapeDatum1, point3, point4);
     ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true);
     GenAction[] setTile = new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point3, innerOutline, Actions.Chain(setTile));
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] rectangleMask = new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) };
     WorldUtils.Gen(point3, all, Actions.Chain(rectangleMask));
     ModShapes.All all1 = new ModShapes.All(shapeDatum);
     GenAction[] placeWall = new GenAction[] { new Actions.PlaceWall(68, true), null, null, null };
     ushort[] numArray2 = new ushort[] { 2 };
     placeWall[1] = new Modifiers.OnlyTiles(numArray2);
     placeWall[2] = new Modifiers.Offset(0, 1);
     placeWall[3] = new ActionVines(3, 5, 52);
     WorldUtils.Gen(point3, all1, Actions.Chain(placeWall));
     ShapeData shapeDatum2 = new ShapeData();
     Point point5 = new Point(origin.X, y.Y + 10);
     Shapes.Rectangle rectangle1 = new Shapes.Rectangle(1, origin.Y - y.Y - 9);
     GenAction[] onlyTile = new GenAction[] { new Modifiers.Blotches(2, 0.2), (new Actions.ClearTile(false)).Output(shapeDatum2), new Modifiers.Expand(1), null, null };
     ushort[] numArray3 = new ushort[] { 53 };
     onlyTile[3] = new Modifiers.OnlyTiles(numArray3);
     onlyTile[4] = (new Actions.SetTile(397, false, true)).Output(shapeDatum2);
     WorldUtils.Gen(point5, rectangle1, Actions.Chain(onlyTile));
     WorldUtils.Gen(new Point(origin.X, y.Y + 10), new ModShapes.All(shapeDatum2), new Actions.SetFrames(true));
     if (GenBase._random.Next(3) != 0)
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15);
     }
     else
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17);
     }
     ModShapes.All all2 = new ModShapes.All(shapeDatum1);
     GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, -1), null, null, null };
     ushort[] numArray4 = new ushort[] { 2 };
     offset[1] = new Modifiers.OnlyTiles(numArray4);
     offset[2] = new Modifiers.Offset(0, -1);
     offset[3] = new ActionGrass();
     WorldUtils.Gen(point4, all2, Actions.Chain(offset));
     structures.AddStructure(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 4);
     return true;
 }
 public void PlaceThing()
 {
     int i;
     bool flag;
     if ((this.inventory[this.selectedItem].type == 1071 || this.inventory[this.selectedItem].type == 1543) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
     {
         int num = Player.tileTargetX;
         int num1 = Player.tileTargetY;
         if (Main.tile[num, num1] != null && Main.tile[num, num1].active())
         {
             this.showItemIcon = true;
             if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
             {
                 int num2 = -1;
                 int num3 = -1;
                 int num4 = 0;
                 while (num4 < 58)
                 {
                     if (this.inventory[num4].stack <= 0 || this.inventory[num4].paint <= 0)
                     {
                         num4++;
                     }
                     else
                     {
                         num2 = this.inventory[num4].paint;
                         num3 = num4;
                         break;
                     }
                 }
                 if (num2 > 0 && Main.tile[num, num1].color() != num2 && WorldGen.paintTile(num, num1, (byte)num2, true))
                 {
                     int num5 = num3;
                     Item item = this.inventory[num5];
                     item.stack = item.stack - 1;
                     if (this.inventory[num5].stack <= 0)
                     {
                         this.inventory[num5].SetDefaults(0, false);
                     }
                     this.itemTime = this.inventory[this.selectedItem].useTime;
                 }
             }
         }
     }
     if ((this.inventory[this.selectedItem].type == 1072 || this.inventory[this.selectedItem].type == 1544) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
     {
         int num6 = Player.tileTargetX;
         int num7 = Player.tileTargetY;
         if (Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
         {
             this.showItemIcon = true;
             if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
             {
                 int num8 = -1;
                 int num9 = -1;
                 int num10 = 0;
                 while (num10 < 58)
                 {
                     if (this.inventory[num10].stack <= 0 || this.inventory[num10].paint <= 0)
                     {
                         num10++;
                     }
                     else
                     {
                         num8 = this.inventory[num10].paint;
                         num9 = num10;
                         break;
                     }
                 }
                 if (num8 > 0 && Main.tile[num6, num7].wallColor() != num8 && WorldGen.paintWall(num6, num7, (byte)num8, true))
                 {
                     int num11 = num9;
                     Item item1 = this.inventory[num11];
                     item1.stack = item1.stack - 1;
                     if (this.inventory[num11].stack <= 0)
                     {
                         this.inventory[num11].SetDefaults(0, false);
                     }
                     this.itemTime = this.inventory[this.selectedItem].useTime;
                 }
             }
         }
     }
     if ((this.inventory[this.selectedItem].type == 1100 || this.inventory[this.selectedItem].type == 1545) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
     {
         int num12 = Player.tileTargetX;
         int num13 = Player.tileTargetY;
         if (Main.tile[num12, num13] != null && (Main.tile[num12, num13].wallColor() > 0 && Main.tile[num12, num13].wall > 0 || Main.tile[num12, num13].color() > 0 && Main.tile[num12, num13].active()))
         {
             this.showItemIcon = true;
             if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
             {
                 if (Main.tile[num12, num13].color() > 0 && Main.tile[num12, num13].active() && WorldGen.paintTile(num12, num13, 0, true))
                 {
                     this.itemTime = this.inventory[this.selectedItem].useTime;
                 }
                 else if (Main.tile[num12, num13].wallColor() > 0 && Main.tile[num12, num13].wall > 0 && WorldGen.paintWall(num12, num13, 0, true))
                 {
                     this.itemTime = this.inventory[this.selectedItem].useTime;
                 }
             }
         }
     }
     if ((this.inventory[this.selectedItem].type == 929 || this.inventory[this.selectedItem].type == 1338 || this.inventory[this.selectedItem].type == 1345) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
     {
         int num14 = Player.tileTargetX;
         int num15 = Player.tileTargetY;
         if (Main.tile[num14, num15].active() && Main.tile[num14, num15].type == TileID.Cannon)
         {
             int num16 = 0;
             if (Main.tile[num14, num15].frameX < 72)
             {
                 if (this.inventory[this.selectedItem].type == 929)
                 {
                     num16 = 1;
                 }
             }
             else if (Main.tile[num14, num15].frameX < 144)
             {
                 if (this.inventory[this.selectedItem].type == 1338)
                 {
                     num16 = 2;
                 }
             }
             else if (Main.tile[num14, num15].frameX < 288 && this.inventory[this.selectedItem].type == 1345)
             {
                 num16 = 3;
             }
             if (num16 > 0)
             {
                 this.showItemIcon = true;
                 if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
                 {
                     int num17 = Main.tile[num14, num15].frameX / 18;
                     int num18 = 0;
                     int num19 = 0;
                     while (num17 >= 4)
                     {
                         num18++;
                         num17 = num17 - 4;
                     }
                     num17 = num14 - num17;
                     for (i = Main.tile[num14, num15].frameY / 18; i >= 3; i = i - 3)
                     {
                         num19++;
                     }
                     i = num15 - i;
                     this.itemTime = this.inventory[this.selectedItem].useTime;
                     float single = 14f;
                     float single1 = 0f;
                     float single2 = 0f;
                     int num20 = 162;
                     if (num16 == 2)
                     {
                         num20 = 281;
                     }
                     if (num16 == 3)
                     {
                         num20 = 178;
                     }
                     int num21 = this.inventory[this.selectedItem].damage;
                     int num22 = 8;
                     if (num19 == 0)
                     {
                         single1 = 10f;
                         single2 = 0f;
                     }
                     if (num19 == 1)
                     {
                         single1 = 7.5f;
                         single2 = -2.5f;
                     }
                     if (num19 == 2)
                     {
                         single1 = 5f;
                         single2 = -5f;
                     }
                     if (num19 == 3)
                     {
                         single1 = 2.75f;
                         single2 = -6f;
                     }
                     if (num19 == 4)
                     {
                         single1 = 0f;
                         single2 = -10f;
                     }
                     if (num19 == 5)
                     {
                         single1 = -2.75f;
                         single2 = -6f;
                     }
                     if (num19 == 6)
                     {
                         single1 = -5f;
                         single2 = -5f;
                     }
                     if (num19 == 7)
                     {
                         single1 = -7.5f;
                         single2 = -2.5f;
                     }
                     if (num19 == 8)
                     {
                         single1 = -10f;
                         single2 = 0f;
                     }
                     Vector2 vector2 = new Vector2((float)((num17 + 2) * 16), (float)((i + 2) * 16));
                     float single3 = single1;
                     float single4 = single2;
                     float single5 = (float)Math.Sqrt((double)(single3 * single3 + single4 * single4));
                     single5 = single / single5;
                     single3 = single3 * single5;
                     single4 = single4 * single5;
                     Projectile.NewProjectile(vector2.X, vector2.Y, single3, single4, num20, num21, (float)num22, Main.myPlayer, 0f, 0f);
                 }
             }
         }
     }
     if (this.inventory[this.selectedItem].type >= 1874 && this.inventory[this.selectedItem].type <= 1905 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 171 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
     {
         int num23 = this.inventory[this.selectedItem].type;
         if (num23 >= 1874 && num23 <= 1877)
         {
             num23 = num23 - 1873;
             if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 0) != num23)
             {
                 this.itemTime = this.inventory[this.selectedItem].useTime;
                 WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 0);
                 WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 0, num23);
                 int num24 = Player.tileTargetX;
                 int num25 = Player.tileTargetY;
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
                 {
                     num24 = num24 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
                     num25 = num25 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
                 }
                 NetMessage.SendTileSquare(-1, num24, num25, 1);
             }
         }
         else if (num23 >= 1878 && num23 <= 1883)
         {
             num23 = num23 - 1877;
             if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 1) != num23)
             {
                 this.itemTime = this.inventory[this.selectedItem].useTime;
                 WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 1);
                 WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 1, num23);
                 int num26 = Player.tileTargetX;
                 int num27 = Player.tileTargetY;
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
                 {
                     num26 = num26 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
                     num27 = num27 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
                 }
                 NetMessage.SendTileSquare(-1, num26, num27, 1);
             }
         }
         else if (num23 >= 1884 && num23 <= 1894)
         {
             num23 = num23 - 1883;
             if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 2) != num23)
             {
                 this.itemTime = this.inventory[this.selectedItem].useTime;
                 WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 2);
                 WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 2, num23);
                 int num28 = Player.tileTargetX;
                 int num29 = Player.tileTargetY;
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
                 {
                     num28 = num28 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
                     num29 = num29 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
                 }
                 NetMessage.SendTileSquare(-1, num28, num29, 1);
             }
         }
         else if (num23 >= 1895 && num23 <= 1905)
         {
             num23 = num23 - 1894;
             if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 3) != num23)
             {
                 this.itemTime = this.inventory[this.selectedItem].useTime;
                 WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 3);
                 WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 3, num23);
                 int num30 = Player.tileTargetX;
                 int num31 = Player.tileTargetY;
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
                 {
                     num30 = num30 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
                     num31 = num31 - Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
                 }
                 NetMessage.SendTileSquare(-1, num30, num31, 1);
             }
         }
     }
     if (ItemID.Sets.ExtractinatorMode[this.inventory[this.selectedItem].type] >= 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 219)
     {
         if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
         {
             this.itemTime = this.inventory[this.selectedItem].useTime;
             int extractinatorMode = ItemID.Sets.ExtractinatorMode[this.inventory[this.selectedItem].type];
             Player.ExtractinatorUse(extractinatorMode);
         }
     }
     else if (this.inventory[this.selectedItem].createTile >= 0 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
     {
         this.showItemIcon = true;
         bool flag1 = false;
         if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].lava())
         {
             if (Main.tileSolid[this.inventory[this.selectedItem].createTile])
             {
                 flag1 = true;
             }
             else if (!TileObjectData.CheckLiquidPlacement(this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle, Main.tile[Player.tileTargetX, Player.tileTargetY]))
             {
                 flag1 = true;
             }
         }
         bool flag2 = true;
         if (this.inventory[this.selectedItem].tileWand > 0)
         {
             int num32 = this.inventory[this.selectedItem].tileWand;
             flag2 = false;
             int num33 = 0;
             while (num33 < 58)
             {
                 if (num32 != this.inventory[num33].type || this.inventory[num33].stack <= 0)
                 {
                     num33++;
                 }
                 else
                 {
                     flag2 = true;
                     break;
                 }
             }
         }
         if (Main.tileRope[this.inventory[this.selectedItem].createTile] && flag2 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tileRope[Main.tile[Player.tileTargetX, Player.tileTargetY].type])
         {
             int num34 = Player.tileTargetY;
             int num35 = Player.tileTargetX;
             int num36 = this.inventory[this.selectedItem].createTile;
             while (Main.tile[num35, num34].active() && Main.tileRope[Main.tile[num35, num34].type] && num34 < Main.maxTilesX - 5 && Main.tile[num35, num34 + 2] != null && !Main.tile[num35, num34 + 1].lava())
             {
                 num34++;
                 if (Main.tile[num35, num34] != null)
                 {
                     continue;
                 }
                 flag2 = false;
                 num34 = Player.tileTargetY;
             }
             if (!Main.tile[num35, num34].active())
             {
                 Player.tileTargetY = num34;
             }
         }
         if (flag2 && (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && !flag1 || Main.tileCut[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tile[Player.tileTargetX, Player.tileTargetY].type >= 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= 375 || this.inventory[this.selectedItem].createTile == 199 || this.inventory[this.selectedItem].createTile == 23 || this.inventory[this.selectedItem].createTile == 2 || this.inventory[this.selectedItem].createTile == 109 || this.inventory[this.selectedItem].createTile == 60 || this.inventory[this.selectedItem].createTile == 70 || TileID.Sets.BreakableWhenPlacing[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
         {
             bool flag3 = false;
             bool flag4 = false;
             TileObject tileObject = new TileObject();
             if (!TileObjectData.CustomPlace(this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle) || this.inventory[this.selectedItem].createTile == 82)
             {
                 if (this.inventory[this.selectedItem].type == 213)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 1)
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 23 || this.inventory[this.selectedItem].createTile == 2 || this.inventory[this.selectedItem].createTile == 109 || this.inventory[this.selectedItem].createTile == 199)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0)
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 227)
                 {
                     flag3 = true;
                 }
                 else if (this.inventory[this.selectedItem].createTile >= 373 && this.inventory[this.selectedItem].createTile <= 375)
                 {
                     int num37 = Player.tileTargetX;
                     int num38 = Player.tileTargetY - 1;
                     if (Main.tile[num37, num38].nactive() && Main.tileSolid[Main.tile[num37, num38].type] && !Main.tileSolidTop[Main.tile[num37, num38].type])
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 60 || this.inventory[this.selectedItem].createTile == 70)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 59)
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 4 || this.inventory[this.selectedItem].createTile == 136)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall <= 0)
                     {
                         if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && !WorldGen.SolidTileNoAttach(Player.tileTargetX + 1, Player.tileTargetY))
                         {
                             if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].halfBrick() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].slope() != 0))
                             {
                                 if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
                                 {
                                     WorldGen.SlopeTile(Player.tileTargetX, Player.tileTargetY + 1, 0);
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)(Player.tileTargetY + 1), 0f, 0, 0, 0);
                                     }
                                 }
                             }
                             else if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && (Main.tile[Player.tileTargetX - 1, Player.tileTargetY].halfBrick() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].slope() != 0))
                             {
                                 if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
                                 {
                                     WorldGen.SlopeTile(Player.tileTargetX - 1, Player.tileTargetY, 0);
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(Player.tileTargetX - 1), (float)Player.tileTargetY, 0f, 0, 0, 0);
                                     }
                                 }
                             }
                             else if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && !WorldGen.SolidTileNoAttach(Player.tileTargetX + 1, Player.tileTargetY) && (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].halfBrick() || Main.tile[Player.tileTargetX + 1, Player.tileTargetY].slope() != 0) && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
                             {
                                 WorldGen.SlopeTile(Player.tileTargetX + 1, Player.tileTargetY, 0);
                                 if (Main.netMode == 1)
                                 {
                                     NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(Player.tileTargetX + 1), (float)Player.tileTargetY, 0f, 0, 0, 0);
                                 }
                             }
                         }
                         int num39 = Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type;
                         if (Main.tile[Player.tileTargetX, Player.tileTargetY].halfBrick())
                         {
                             num39 = -1;
                         }
                         int num40 = Main.tile[Player.tileTargetX - 1, Player.tileTargetY].type;
                         int num41 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY].type;
                         int num42 = Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type;
                         int num43 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].type;
                         int num44 = Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type;
                         int num45 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].type;
                         if (!Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive())
                         {
                             num39 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY].nactive())
                         {
                             num40 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY].nactive())
                         {
                             num41 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].nactive())
                         {
                             num42 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].nactive())
                         {
                             num43 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY + 1].nactive())
                         {
                             num44 = -1;
                         }
                         if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].nactive())
                         {
                             num45 = -1;
                         }
                         if (num39 >= 0 && Main.tileSolid[num39] && (!Main.tileNoAttach[num39] || num39 == 19))
                         {
                             flag3 = true;
                         }
                         else if (num40 >= 0 && Main.tileSolid[num40] && !Main.tileNoAttach[num40] || num40 == 5 && num42 == 5 && num44 == 5 || num40 == 124)
                         {
                             flag3 = true;
                         }
                         else if (num41 >= 0 && Main.tileSolid[num41] && !Main.tileNoAttach[num41] || num41 == 5 && num43 == 5 && num45 == 5 || num41 == 124)
                         {
                             flag3 = true;
                         }
                     }
                     else
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 78 || this.inventory[this.selectedItem].createTile == 98 || this.inventory[this.selectedItem].createTile == 100 || this.inventory[this.selectedItem].createTile == 173 || this.inventory[this.selectedItem].createTile == 174 || this.inventory[this.selectedItem].createTile == 324)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive() && (Main.tileSolid[Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type] || Main.tileTable[Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type]))
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 13 || this.inventory[this.selectedItem].createTile == 29 || this.inventory[this.selectedItem].createTile == 33 || this.inventory[this.selectedItem].createTile == 49 || this.inventory[this.selectedItem].createTile == 50 || this.inventory[this.selectedItem].createTile == 103)
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive() && Main.tileTable[Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type])
                     {
                         flag3 = true;
                     }
                 }
                 else if (this.inventory[this.selectedItem].createTile == 275 || this.inventory[this.selectedItem].createTile == 276 || this.inventory[this.selectedItem].createTile == 277)
                 {
                     flag3 = true;
                 }
                 else if (this.inventory[this.selectedItem].createTile != 51 && this.inventory[this.selectedItem].createTile != 330 && this.inventory[this.selectedItem].createTile != 331 && this.inventory[this.selectedItem].createTile != 332 && this.inventory[this.selectedItem].createTile != 333 && this.inventory[this.selectedItem].createTile != 336 && this.inventory[this.selectedItem].createTile != 340 && this.inventory[this.selectedItem].createTile != 342 && this.inventory[this.selectedItem].createTile != 341 && this.inventory[this.selectedItem].createTile != 343 && this.inventory[this.selectedItem].createTile != 344 && this.inventory[this.selectedItem].createTile != 379 && this.inventory[this.selectedItem].createTile != 351)
                 {
                     if (this.inventory[this.selectedItem].createTile != 314)
                     {
                         Tile tile = Main.tile[Player.tileTargetX - 1, Player.tileTargetY];
                         Tile tile1 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY];
                         Tile tile2 = Main.tile[Player.tileTargetX, Player.tileTargetY - 1];
                         Tile tile3 = Main.tile[Player.tileTargetX, Player.tileTargetY + 1];
                         if (tile1.active() && (Main.tileSolid[tile1.type] || Main.tileRope[tile1.type] || tile1.type == 314) || tile1.wall > 0 || tile.active() && (Main.tileSolid[tile.type] || Main.tileRope[tile.type] || tile.type == TileID.MinecartTrack) || tile.wall > 0 || tile3.active() && (Main.tileSolid[tile3.type] || tile3.type == 124 || Main.tileRope[tile3.type] || tile3.type == 314) || tile3.wall > 0 || tile2.active() && (Main.tileSolid[tile2.type] || tile2.type == 124 || Main.tileRope[tile2.type] || tile2.type == 314) || tile2.wall > 0)
                         {
                             flag3 = true;
                         }
                     }
                     else
                     {
                         for (int j = Player.tileTargetX - 1; j <= Player.tileTargetX + 1; j++)
                         {
                             int num46 = Player.tileTargetY - 1;
                             while (num46 <= Player.tileTargetY + 1)
                             {
                                 Tile tile4 = Main.tile[j, num46];
                                 if (tile4.active() || tile4.wall > 0)
                                 {
                                     flag3 = true;
                                     break;
                                 }
                                 else
                                 {
                                     num46++;
                                 }
                             }
                         }
                     }
                 }
                 else if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX + 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall > 0)
                 {
                     flag3 = true;
                 }
                 if (this.inventory[this.selectedItem].type == 213 && Main.tile[Player.tileTargetX, Player.tileTargetY].active())
                 {
                     int num47 = Player.tileTargetX;
                     int num48 = Player.tileTargetY;
                     if (Main.tile[num47, num48].type == TileID.Plants || Main.tile[num47, num48].type == TileID.Plants2 || Main.tile[num47, num48].type == TileID.BloomingHerbs)
                     {
                         WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
                         if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1)
                         {
                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
                         }
                     }
                     else if (Main.tile[num47, num48].type == TileID.MatureHerbs)
                     {
                         bool flag5 = false;
                         int num49 = Main.tile[num47, num48].frameX / 18;
                         if (num49 == 0 && Main.dayTime)
                         {
                             flag5 = true;
                         }
                         if (num49 == 1 && !Main.dayTime)
                         {
                             flag5 = true;
                         }
                         if (num49 == 3 && !Main.dayTime && (Main.bloodMoon || Main.moonPhase == 0))
                         {
                             flag5 = true;
                         }
                         if (num49 == 4 && (Main.raining || Main.cloudAlpha > 0f))
                         {
                             flag5 = true;
                         }
                         if (num49 == 5 && !Main.raining && Main.dayTime && Main.time > 40500)
                         {
                             flag5 = true;
                         }
                         if (flag5)
                         {
                             WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
                         }
                     }
                 }
                 if (Main.tileAlch[this.inventory[this.selectedItem].createTile])
                 {
                     flag3 = true;
                 }
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].active() && (Main.tileCut[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || TileID.Sets.BreakableWhenPlacing[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tile[Player.tileTargetX, Player.tileTargetY].type >= 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= 375))
                 {
                     if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == this.inventory[this.selectedItem].createTile)
                     {
                         flag3 = false;
                     }
                     else if ((Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 78 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 380) && (Main.tile[Player.tileTargetX, Player.tileTargetY].type != 3 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 73 || !Main.tileAlch[this.inventory[this.selectedItem].createTile]))
                     {
                         flag3 = false;
                     }
                     else
                     {
                         WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
                         if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1)
                         {
                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 4, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
                         }
                     }
                 }
                 if (!flag3 && this.inventory[this.selectedItem].createTile == 19)
                 {
                     for (int k = Player.tileTargetX - 1; k <= Player.tileTargetX + 1; k++)
                     {
                         int num50 = Player.tileTargetY - 1;
                         while (num50 <= Player.tileTargetY + 1)
                         {
                             if (!Main.tile[k, num50].active())
                             {
                                 num50++;
                             }
                             else
                             {
                                 flag3 = true;
                                 break;
                             }
                         }
                     }
                 }
             }
             else
             {
                 flag4 = true;
                 flag3 = TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, (int)this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle, this.direction, out tileObject, false);
             }
             if (flag3)
             {
                 int num51 = this.inventory[this.selectedItem].placeStyle;
                 if (!flag4)
                 {
                     if (this.inventory[this.selectedItem].createTile == 36)
                     {
                         num51 = Main.rand.Next(7);
                     }
                     if (this.inventory[this.selectedItem].createTile == 212 && this.direction > 0)
                     {
                         num51 = 1;
                     }
                     if (this.inventory[this.selectedItem].createTile == 141)
                     {
                         num51 = Main.rand.Next(2);
                     }
                     if (this.inventory[this.selectedItem].createTile == 128 || this.inventory[this.selectedItem].createTile == 269 || this.inventory[this.selectedItem].createTile == 334)
                     {
                         num51 = (this.direction >= 0 ? 1 : -1);
                     }
                     if (this.inventory[this.selectedItem].createTile == 241 && this.inventory[this.selectedItem].placeStyle == 0)
                     {
                         num51 = Main.rand.Next(0, 9);
                     }
                     if (this.inventory[this.selectedItem].createTile == 35 && this.inventory[this.selectedItem].placeStyle == 0)
                     {
                         num51 = Main.rand.Next(9);
                     }
                 }
                 if (this.inventory[this.selectedItem].createTile == 314 && num51 == 2 && this.direction == 1)
                 {
                     num51++;
                 }
                 int[,] numArray = new int[11, 11];
                 if (this.autoPaint)
                 {
                     for (int l = 0; l < 11; l++)
                     {
                         for (int m = 0; m < 11; m++)
                         {
                             int num52 = Player.tileTargetX - 5 + l;
                             int num53 = Player.tileTargetY - 5 + m;
                             if (!Main.tile[num52, num53].active())
                             {
                                 numArray[l, m] = -1;
                             }
                             else
                             {
                                 numArray[l, m] = Main.tile[num52, num53].type;
                             }
                         }
                     }
                 }
                 bool flag6 = false;
                 if (!flag4)
                 {
                     flag = WorldGen.PlaceTile(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, false, flag6, this.whoAmI, num51);
                 }
                 else
                 {
                     flag = TileObject.Place(tileObject);
                     WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
                 }
                 if (this.inventory[this.selectedItem].type == 213 && !flag && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 1 && Main.tile[Player.tileTargetX, Player.tileTargetY].active())
                 {
                     int key = 0;
                     int value = 0;
                     Point tileCoordinates = base.Center.ToTileCoordinates();
                     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
                     Point point = new Point(tileCoordinates.X - 25, tileCoordinates.Y - 25);
                     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
                     ushort[] numArray1 = new ushort[] { 182, 180, 179, 183, 181, 381 };
                     WorldUtils.Gen(point, rectangle, (new Actions.TileScanner(numArray1)).Output(nums));
                     foreach (KeyValuePair<ushort, int> keyValuePair in nums)
                     {
                         if (keyValuePair.Value <= value)
                         {
                             continue;
                         }
                         value = keyValuePair.Value;
                         key = keyValuePair.Key;
                     }
                     if (value == 0)
                     {
                         Random random = Main.rand;
                         int[] numArray2 = new int[] { 182, 180, 179, 183, 181 };
                         key = Terraria.Utils.SelectRandom<int>(random, numArray2);
                     }
                     if (key != 0)
                     {
                         Main.tile[Player.tileTargetX, Player.tileTargetY].type = (ushort)key;
                         WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
                         flag = true;
                     }
                 }
                 if (flag)
                 {
                     this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed);
                     if (!flag4)
                     {
                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 1, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.inventory[this.selectedItem].createTile, num51, 0, 0);
                         if (this.inventory[this.selectedItem].createTile == 15)
                         {
                             if (this.direction == 1)
                             {
                                 Tile tile5 = Main.tile[Player.tileTargetX, Player.tileTargetY];
                                 tile5.frameX = (short)(tile5.frameX + 18);
                                 Tile tile6 = Main.tile[Player.tileTargetX, Player.tileTargetY - 1];
                                 tile6.frameX = (short)(tile6.frameX + 18);
                             }
                             if (Main.netMode == 1)
                             {
                                 NetMessage.SendTileSquare(-1, Player.tileTargetX - 1, Player.tileTargetY - 1, 3);
                             }
                         }
                         else if ((this.inventory[this.selectedItem].createTile == 79 || this.inventory[this.selectedItem].createTile == 90) && Main.netMode == 1)
                         {
                             NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 5);
                         }
                     }
                     else
                     {
                         TileObjectData.CallPostPlacementPlayerHook(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, num51, this.direction, tileObject);
                         if (Main.netMode == 1 && !Main.tileContainer[this.inventory[this.selectedItem].createTile])
                         {
                             NetMessage.SendObjectPlacment(-1, Player.tileTargetX, Player.tileTargetY, tileObject.type, tileObject.style, tileObject.alternate, tileObject.random, this.direction);
                         }
                     }
                     if (this.inventory[this.selectedItem].createTile == 137)
                     {
                         if (this.direction == 1)
                         {
                             Tile tile7 = Main.tile[Player.tileTargetX, Player.tileTargetY];
                             tile7.frameX = (short)(tile7.frameX + 18);
                         }
                         if (Main.netMode == 1)
                         {
                             NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1);
                         }
                     }
                     if (this.inventory[this.selectedItem].createTile == 19 && Main.smartDigEnabled)
                     {
                         int num54 = Player.tileTargetX;
                         int num55 = Player.tileTargetY;
                         int num56 = -1;
                         int num57 = 0;
                         int num58 = 0;
                         bool flag7 = true;
                         for (int n = -1; n < 2; n++)
                         {
                             for (int o = -1; o < 2; o++)
                             {
                                 if ((n != 0 || o != 0) && Main.tile[num54 + n, num55 + o].type == 19)
                                 {
                                     flag7 = false;
                                 }
                             }
                         }
                         if (!flag7)
                         {
                             Tile tile8 = Main.tile[num54 - 1, num55 - 1];
                             if (tile8.active() && tile8.type == 19 && tile8.slope() != 2)
                             {
                                 num57++;
                             }
                             tile8 = Main.tile[num54 - 1, num55 + 1];
                             if (tile8.active() && tile8.type == 19 && tile8.slope() != 1)
                             {
                                 num58++;
                             }
                             tile8 = Main.tile[num54 + 1, num55 - 1];
                             if (tile8.active() && tile8.type == 19 && tile8.slope() != 1)
                             {
                                 num58++;
                             }
                             tile8 = Main.tile[num54 + 1, num55 + 1];
                             if (tile8.active() && tile8.type == 19 && tile8.slope() != 2)
                             {
                                 num57++;
                             }
                             tile8 = Main.tile[num54 - 1, num55];
                             if (WorldGen.SolidTile(tile8))
                             {
                                 num57++;
                                 if (tile8.type == 19 && tile8.slope() == 0)
                                 {
                                     num57++;
                                 }
                             }
                             tile8 = Main.tile[num54 + 1, num55];
                             if (WorldGen.SolidTile(tile8))
                             {
                                 num58++;
                                 if (tile8.type == 19 && tile8.slope() == 0)
                                 {
                                     num58++;
                                 }
                             }
                             if (num57 > num58)
                             {
                                 num56 = 1;
                             }
                             else if (num58 > num57)
                             {
                                 num56 = 2;
                             }
                             tile8 = Main.tile[num54 - 1, num55];
                             if (tile8.active() && tile8.type == 19)
                             {
                                 num56 = 0;
                             }
                             tile8 = Main.tile[num54 + 1, num55];
                             if (tile8.active() && tile8.type == 19)
                             {
                                 num56 = 0;
                             }
                             int num59 = 0;
                             int num60 = 0;
                             if (num56 == -1)
                             {
                                 num56 = 0;
                                 int num61 = 0;
                                 num59 = -1;
                                 tile8 = Main.tile[num54 + num59, num55];
                                 if (tile8.active() && tile8.type == 19 && tile8.slope() != 0)
                                 {
                                     int directionInt = (tile8.slope() == 1).ToDirectionInt() * num59;
                                     num56 = (directionInt == -1 ? 0 : (int)tile8.slope());
                                     bool flag8 = true;
                                     if (Main.tile[num54 + num59 * 2, num55 + directionInt].active() && Main.tile[num54 + num59 * 2, num55].type == 19 && num56 == Main.tile[num54 + num59 * 2, num55 + directionInt].slope())
                                     {
                                         flag8 = false;
                                     }
                                     if (Main.tile[num54, num55 - directionInt].active() && Main.tile[num54, num55 - directionInt].type == 19 && tile8.slope() == Main.tile[num54, num55 - directionInt].slope())
                                     {
                                         flag8 = false;
                                     }
                                     if (flag8)
                                     {
                                         WorldGen.SlopeTile(num54 + num59, num55, num56);
                                         num61 = tile8.slope();
                                         if (Main.netMode == 1)
                                         {
                                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(num54 + num59), (float)num55, (float)num61, 0, 0, 0);
                                         }
                                     }
                                 }
                                 num59 = 1;
                                 num60 = 0;
                                 tile8 = Main.tile[num54 + num59, num55 + num60];
                                 if (tile8.active() && tile8.type == 19 && tile8.slope() != 0)
                                 {
                                     int directionInt1 = (tile8.slope() == 1).ToDirectionInt() * num59;
                                     num56 = (directionInt1 == -1 ? 0 : (int)tile8.slope());
                                     bool flag9 = true;
                                     if (Main.tile[num54 + num59 * 2, num55 + directionInt1].active() && Main.tile[num54 + num59 * 2, num55].type == 19 && num56 == Main.tile[num54 + num59 * 2, num55 + directionInt1].slope())
                                     {
                                         flag9 = false;
                                     }
                                     if (Main.tile[num54, num55 - directionInt1].active() && Main.tile[num54, num55 - directionInt1].type == 19 && tile8.slope() == Main.tile[num54, num55 - directionInt1].slope())
                                     {
                                         flag9 = false;
                                     }
                                     if (flag9)
                                     {
                                         WorldGen.SlopeTile(num54 + num59, num55, num56);
                                         num61 = tile8.slope();
                                         if (Main.netMode == 1)
                                         {
                                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(num54 + num59), (float)num55, (float)num61, 0, 0, 0);
                                         }
                                     }
                                 }
                                 if (num57 == num58 && WorldGen.PlatformProperSides(num54, num55, false) == 0)
                                 {
                                     tile8 = Main.tile[num54, num55 + 1];
                                     if (tile8.active() && !tile8.halfBrick() && tile8.slope() == 0 && Main.tileSolid[tile8.type])
                                     {
                                         num56 = (this.direction == 1 ? 2 : 1);
                                         WorldGen.SlopeTile(num54, num55, num56);
                                         num61 = Main.tile[num54, num55].slope();
                                         if (Main.netMode == 1)
                                         {
                                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num61, 0, 0, 0);
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 WorldGen.SlopeTile(num54, num55, num56);
                                 int num62 = Main.tile[num54, num55].slope();
                                 if (Main.netMode == 1)
                                 {
                                     NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num62, 0, 0, 0);
                                 }
                                 if (num56 != 1)
                                 {
                                     num59 = 1;
                                     num60 = -1;
                                 }
                                 else
                                 {
                                     num59 = -1;
                                     num60 = -1;
                                 }
                                 tile8 = Main.tile[num54 + num59, num55 + num60];
                                 if (tile8.active() && tile8.type == 19 && tile8.slope() == 0 && (!Main.tile[num54 + num59 + num59, num55 + num60].active() || Main.tile[num54 + num59 + num59, num55 + num60].type != 19 || !Main.tile[num54 + num59 + num59, num55 + num60].halfBrick()))
                                 {
                                     WorldGen.SlopeTile(num54 + num59, num55 + num60, num56);
                                     num62 = tile8.slope();
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(num54 + num59), (float)(num55 + num60), (float)num62, 0, 0, 0);
                                     }
                                 }
                                 if (num56 != 1)
                                 {
                                     num59 = -1;
                                     num60 = 1;
                                 }
                                 else
                                 {
                                     num59 = 1;
                                     num60 = 1;
                                 }
                                 tile8 = Main.tile[num54 + num59, num55 + num60];
                                 if (tile8.active() && tile8.type == 19 && tile8.slope() == 0 && WorldGen.PlatformProperSides(num54 + num59, num55 + num60, true) <= 0)
                                 {
                                     WorldGen.SlopeTile(num54 + num59, num55 + num60, num56);
                                     num62 = tile8.slope();
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)(num54 + num59), (float)(num55 + num60), (float)num62, 0, 0, 0);
                                     }
                                 }
                             }
                         }
                     }
                     if (Main.tileSolid[this.inventory[this.selectedItem].createTile] && this.inventory[this.selectedItem].createTile != 19)
                     {
                         int num63 = Player.tileTargetX;
                         int num64 = Player.tileTargetY + 1;
                         if (Main.tile[num63, num64] != null && Main.tile[num63, num64].type != TileID.Platforms && (Main.tile[num63, num64].topSlope() || Main.tile[num63, num64].halfBrick()))
                         {
                             WorldGen.SlopeTile(num63, num64, 0);
                             if (Main.netMode == 1)
                             {
                                 NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)num63, (float)num64, 0f, 0, 0, 0);
                             }
                         }
                         num63 = Player.tileTargetX;
                         num64 = Player.tileTargetY - 1;
                         if (Main.tile[num63, num64] != null && Main.tile[num63, num64].type != TileID.Platforms && Main.tile[num63, num64].bottomSlope())
                         {
                             WorldGen.SlopeTile(num63, num64, 0);
                             if (Main.netMode == 1)
                             {
                                 NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)num63, (float)num64, 0f, 0, 0, 0);
                             }
                         }
                     }
                     if (Main.tileSolid[this.inventory[this.selectedItem].createTile])
                     {
                         for (int p = Player.tileTargetX - 1; p <= Player.tileTargetX + 1; p++)
                         {
                             for (int q = Player.tileTargetY - 1; q <= Player.tileTargetY + 1; q++)
                             {
                                 if (Main.tile[p, q].active() && this.inventory[this.selectedItem].createTile != Main.tile[p, q].type && (Main.tile[p, q].type == TileID.Grass || Main.tile[p, q].type == TileID.CorruptGrass || Main.tile[p, q].type == TileID.JungleGrass || Main.tile[p, q].type == TileID.MushroomGrass || Main.tile[p, q].type == TileID.HallowedGrass || Main.tile[p, q].type == TileID.FleshGrass))
                                 {
                                     bool flag10 = true;
                                     for (int r = p - 1; r <= p + 1; r++)
                                     {
                                         for (int s = q - 1; s <= q + 1; s++)
                                         {
                                             if (!WorldGen.SolidTile(r, s))
                                             {
                                                 flag10 = false;
                                             }
                                         }
                                     }
                                     if (flag10)
                                     {
                                         WorldGen.KillTile(p, q, true, false, false);
                                         if (Main.netMode == 1)
                                         {
                                             NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)p, (float)q, 1f, 0, 0, 0);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if (this.autoPaint)
                     {
                         for (int t = 0; t < 11; t++)
                         {
                             for (int u = 0; u < 11; u++)
                             {
                                 int num65 = Player.tileTargetX - 5 + t;
                                 int num66 = Player.tileTargetY - 5 + u;
                                 if ((Main.tile[num65, num66].active() || numArray[t, u] != -1) && (!Main.tile[num65, num66].active() || numArray[t, u] != Main.tile[num65, num66].type))
                                 {
                                     int num67 = -1;
                                     int num68 = -1;
                                     int num69 = 0;
                                     while (num69 < 58)
                                     {
                                         if (this.inventory[num69].stack <= 0 || this.inventory[num69].paint <= 0)
                                         {
                                             num69++;
                                         }
                                         else
                                         {
                                             num67 = this.inventory[num69].paint;
                                             num68 = num69;
                                             break;
                                         }
                                     }
                                     if (num67 > 0 && Main.tile[num65, num66].color() != num67 && WorldGen.paintTile(num65, num66, (byte)num67, true))
                                     {
                                         int num70 = num68;
                                         Item item2 = this.inventory[num70];
                                         item2.stack = item2.stack - 1;
                                         if (this.inventory[num70].stack <= 0)
                                         {
                                             this.inventory[num70].SetDefaults(0, false);
                                         }
                                         this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (this.inventory[this.selectedItem].createWall >= 0 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f >= (float)Player.tileTargetY)
     {
         this.showItemIcon = true;
         if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem && (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX + 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall > 0) && Main.tile[Player.tileTargetX, Player.tileTargetY].wall != this.inventory[this.selectedItem].createWall)
         {
             if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall != 0 && WorldGen.NearFriendlyWall(Player.tileTargetX, Player.tileTargetY))
             {
                 WorldGen.KillWall(Player.tileTargetX, Player.tileTargetY, false);
                 if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall == 0 && Main.netMode == 1)
                 {
                     NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 2, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
                 }
                 if (this.inventory[this.selectedItem].consumable)
                 {
                     Item item3 = this.inventory[this.selectedItem];
                     item3.stack = item3.stack + 1;
                 }
                 this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
                 return;
             }
             WorldGen.PlaceWall(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createWall, false);
             if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall == this.inventory[this.selectedItem].createWall)
             {
                 this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
                 if (Main.netMode == 1)
                 {
                     NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 3, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.inventory[this.selectedItem].createWall, 0, 0, 0);
                 }
                 if (this.inventory[this.selectedItem].stack > 1)
                 {
                     int num71 = this.inventory[this.selectedItem].createWall;
                     for (int v = 0; v < 4; v++)
                     {
                         int num72 = Player.tileTargetX;
                         int num73 = Player.tileTargetY;
                         if (v == 0)
                         {
                             num72--;
                         }
                         if (v == 1)
                         {
                             num72++;
                         }
                         if (v == 2)
                         {
                             num73--;
                         }
                         if (v == 3)
                         {
                             num73++;
                         }
                         if (Main.tile[num72, num73].wall == WallID.None)
                         {
                             int num74 = 0;
                             for (int w = 0; w < 4; w++)
                             {
                                 int num75 = num72;
                                 int num76 = num73;
                                 if (w == 0)
                                 {
                                     num75--;
                                 }
                                 if (w == 1)
                                 {
                                     num75++;
                                 }
                                 if (w == 2)
                                 {
                                     num76--;
                                 }
                                 if (w == 3)
                                 {
                                     num76++;
                                 }
                                 if (Main.tile[num75, num76].wall == num71)
                                 {
                                     num74++;
                                 }
                             }
                             if (num74 == 4)
                             {
                                 WorldGen.PlaceWall(num72, num73, num71, false);
                                 if (Main.tile[num72, num73].wall == num71)
                                 {
                                     Item item4 = this.inventory[this.selectedItem];
                                     item4.stack = item4.stack - 1;
                                     if (this.inventory[this.selectedItem].stack == 0)
                                     {
                                         this.inventory[this.selectedItem].SetDefaults(0, false);
                                     }
                                     if (Main.netMode == 1)
                                     {
                                         NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 3, (float)num72, (float)num73, (float)num71, 0, 0, 0);
                                     }
                                     if (this.autoPaint)
                                     {
                                         int num77 = num72;
                                         int num78 = num73;
                                         int num79 = -1;
                                         int num80 = -1;
                                         int num81 = 0;
                                         while (num81 < 58)
                                         {
                                             if (this.inventory[num81].stack <= 0 || this.inventory[num81].paint <= 0)
                                             {
                                                 num81++;
                                             }
                                             else
                                             {
                                                 num79 = this.inventory[num81].paint;
                                                 num80 = num81;
                                                 break;
                                             }
                                         }
                                         if (num79 > 0 && Main.tile[num77, num78].wallColor() != num79 && WorldGen.paintWall(num77, num78, (byte)num79, true))
                                         {
                                             int num82 = num80;
                                             Item item5 = this.inventory[num82];
                                             item5.stack = item5.stack - 1;
                                             if (this.inventory[num82].stack <= 0)
                                             {
                                                 this.inventory[num82].SetDefaults(0, false);
                                             }
                                             this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if (this.autoPaint)
                 {
                     int num83 = Player.tileTargetX;
                     int num84 = Player.tileTargetY;
                     int num85 = -1;
                     int num86 = -1;
                     int num87 = 0;
                     while (num87 < 58)
                     {
                         if (this.inventory[num87].stack <= 0 || this.inventory[num87].paint <= 0)
                         {
                             num87++;
                         }
                         else
                         {
                             num85 = this.inventory[num87].paint;
                             num86 = num87;
                             break;
                         }
                     }
                     if (num85 > 0 && Main.tile[num83, num84].wallColor() != num85 && WorldGen.paintWall(num83, num84, (byte)num85, true))
                     {
                         int num88 = num86;
                         Item item6 = this.inventory[num88];
                         item6.stack = item6.stack - 1;
                         if (this.inventory[num88].stack <= 0)
                         {
                             this.inventory[num88].SetDefaults(0, false);
                         }
                         this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
                     }
                 }
             }
         }
     }
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point point;
     Point point1;
     Point point2 = new Point(origin.X - 3, origin.Y);
     Searches.Down down = new Searches.Down(200);
     GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaAnd(6, 1) };
     if (!WorldUtils.Find(point2, Searches.Chain(down, genConditionArray), out point))
     {
         return false;
     }
     Point point3 = new Point(point.X, point.Y - 5);
     Searches.Up up = new Searches.Up(120);
     GenCondition[] genConditionArray1 = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(6, 1) };
     if (!WorldUtils.Find(point3, Searches.Chain(up, genConditionArray1), out point1) || point.Y - 5 - point1.Y > 60)
     {
         return false;
     }
     if (point.Y - point1.Y < 30)
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(point.X - 30, point.Y - 60, 60, 90), 0))
     {
         return false;
     }
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point4 = new Point(point.X - 25, point.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 59, 147, 1 };
     WorldUtils.Gen(point4, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     int item = nums[0] + nums[1];
     int num = nums[59];
     if (nums[147] > num || item > num || num < 50)
     {
         return false;
     }
     int y = (point.Y - point1.Y - 9) / 5;
     int num1 = y * 5;
     int num2 = 0;
     double num3 = GenBase._random.NextDouble() + 1;
     double num4 = GenBase._random.NextDouble() + 2;
     if (GenBase._random.Next(2) == 0)
     {
         num4 = -num4;
     }
     for (int i = 0; i < y; i++)
     {
         double num5 = (double)(i + 1) / 12;
         int num6 = (int)(Math.Sin(num5 * num3 * 3.14159274101257) * num4);
         int num7 = (num6 < num2 ? num6 - num2 : 0);
         Point point5 = new Point(point.X + num2 + num7, point.Y - (i + 1) * 5);
         Shapes.Rectangle rectangle1 = new Shapes.Rectangle(6 + Math.Abs(num6 - num2), 7);
         GenAction[] removeWall = new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) };
         WorldUtils.Gen(point5, rectangle1, Actions.Chain(removeWall));
         Point point6 = new Point(point.X + num2 + num7 + 2, point.Y - (i + 1) * 5);
         Shapes.Rectangle rectangle2 = new Shapes.Rectangle(2 + Math.Abs(num6 - num2), 5);
         GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) };
         WorldUtils.Gen(point6, rectangle2, Actions.Chain(clearTile));
         Point point7 = new Point(point.X + num2 + 2, point.Y - i * 5);
         Shapes.Rectangle rectangle3 = new Shapes.Rectangle(2, 2);
         GenAction[] genActionArray = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) };
         WorldUtils.Gen(point7, rectangle3, Actions.Chain(genActionArray));
         num2 = num6;
     }
     int num8 = 6;
     if (num4 < 0)
     {
         num8 = 0;
     }
     List<Point> points = new List<Point>();
     for (int j = 0; j < 2; j++)
     {
         double num9 = ((double)j + 1) / 3;
         int num10 = num8 + (int)(Math.Sin((double)y * num9 / 12 * num3 * 3.14159274101257) * num4);
         double num11 = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232;
         if (num8 == 0)
         {
             num11 = num11 - 1.57079637050629;
         }
         Point point8 = new Point(point.X + num10, point.Y - (int)((double)(y * 5) * num9));
         ShapeBranch shapeBranch = (new ShapeBranch(num11, (double)GenBase._random.Next(12, 16))).OutputEndpoints(points);
         GenAction[] setTile = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
         WorldUtils.Gen(point8, shapeBranch, Actions.Chain(setTile));
         num8 = 6 - num8;
     }
     int num12 = (int)(Math.Sin((double)y / 12 * num3 * 3.14159274101257) * num4);
     Point point9 = new Point(point.X + 6 + num12, point.Y - num1);
     ShapeBranch shapeBranch1 = (new ShapeBranch(-0.685398185253143, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points);
     GenAction[] setTile1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point9, shapeBranch1, Actions.Chain(setTile1));
     Point point10 = new Point(point.X + num12, point.Y - num1);
     ShapeBranch shapeBranch2 = (new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points);
     GenAction[] genActionArray1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point10, shapeBranch2, Actions.Chain(genActionArray1));
     foreach (Point point11 in points)
     {
         Shapes.Circle circle = new Shapes.Circle(4);
         GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), null, null, null, null };
         ushort[] numArray1 = new ushort[] { 383 };
         blotch[1] = new Modifiers.SkipTiles(numArray1);
         byte[] numArray2 = new byte[] { 78 };
         blotch[2] = new Modifiers.SkipWalls(numArray2);
         blotch[3] = new Actions.SetTile(384, false, true);
         blotch[4] = new Actions.SetFrames(true);
         WorldUtils.Gen(point11, circle, Actions.Chain(blotch));
     }
     for (int k = 0; k < 4; k++)
     {
         float single = (float)k / 3f * 2f + 0.57075f;
         WorldUtils.Gen(point, new ShapeRoot(single, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true));
     }
     WorldGen.AddBuriedChest(point.X + 3, point.Y - 1, (GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem()), false, 10);
     structures.AddStructure(new Rectangle(point.X - 30, point.Y - 30, 60, 60), 0);
     return true;
 }