63263 {
63268 if (num < 10)
63269 {
63270 num = 10;
63271 }
63272 if (
num2 > Main.maxTilesX - 10)
63273 {
63274 num2 = Main.maxTilesX - 10;
63275 }
63277 {
63279 }
63280 if (
num4 > Main.maxTilesY - 10)
63281 {
63282 num4 = Main.maxTilesY - 10;
63283 }
63284 if (Main.tile[i,
j] ==
null)
63285 {
63286 return;
63287 }
63288 if (Main.tile[i,
j].type == 655 && !
NPC.AnyNPCs(262))
63289 {
63291 if (Main.netMode == 2)
63292 {
63293 NetMessage.SendData(17, -1, -1,
null, 0, i,
j);
63294 }
63295 }
63296 if (Main.tileAlch[Main.tile[i,
j].type])
63297 {
63299 }
63300 else if (Main.tile[i,
j].nactive())
63301 {
63303 if (Main.rand.Next(2500) == 0)
63304 {
63306 }
63307 else if (Main.hardMode && Main.rand.Next(10000) == 0)
63308 {
63310 }
63311 if (Main.tile[i,
j].type == 519)
63312 {
63314 if (Main.tile[i,
j].active() &&
genRand.Next(2) == 0)
63315 {
63318 }
63319 }
63320 if (Main.tile[i,
j].type == 549)
63321 {
63323 }
63324 else if (Main.tile[i,
j].type == 53 && !Main.tile[i,
j].topSlope() && !Main.tile[i,
j].halfBrick() && !Main.tile[i,
j - 1].active() &&
genRand.Next(20) == 0)
63325 {
63327 }
63329 {
63331 int type = Main.tile[
i,
j].type;
63333 {
63335 {
63337 }
63338 else
63339 {
63341 }
63342 }
63343 }
63344 else if (Main.tile[i,
j].type == 61 &&
genRand.Next(3) == 0)
63345 {
63346 if (Main.tile[i,
j].frameX < 144)
63347 {
63348 if (Main.rand.Next(4) == 0)
63349 {
63351 }
63352 Main.tile[
i,
j].type = 74;
63353 if (Main.netMode == 2)
63354 {
63355 NetMessage.SendTileSquare(-1, i,
j);
63356 }
63357 }
63358 }
63359 else if ((Main.tile[i,
j].type == 60 || Main.tile[i,
j].type == 62) &&
genRand.Next(5) == 0 &&
GrowMoreVines(i,
j))
63360 {
63361 if (!Main.tile[i,
j + 1].active() && !Main.tile[
i,
j + 1].lava())
63362 {
63363 bool flag = false;
63365 {
63366 if (Main.tile[i,
num5].bottomSlope())
63367 {
63368 flag = false;
63369 break;
63370 }
63371 if (Main.tile[i,
num5].active() && Main.tile[
i,
num5].type == 60 && !Main.tile[
i,
num5].bottomSlope())
63372 {
63373 flag = true;
63374 break;
63375 }
63376 }
63377 if (flag)
63378 {
63380 Main.tile[
i,
num6].type = 62;
63381 Main.tile[
i,
num6].active(active:
true);
63383 Main.tile[
i,
num6].CopyPaintAndCoating(Main.tile[i,
num6 - 1]);
63384 if (Main.netMode == 2)
63385 {
63386 NetMessage.SendTileSquare(-1, i,
num6);
63387 }
63388 }
63389 }
63390 }
63391 else if ((Main.tile[i,
j].type == 633 || Main.tile[i,
j].type == 638) &&
GrowMoreVines(i,
j))
63392 {
63393 if (!Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
63394 {
63396 if (Main.tile[i,
j].type == 638)
63397 {
63399 }
63401 {
63402 bool flag2 =
false;
63404 {
63405 if (Main.tile[i,
num7].bottomSlope())
63406 {
63408 break;
63409 }
63410 if (Main.tile[i,
num7].active() && Main.tile[i,
num7].type == 633 && !Main.tile[i,
num7].bottomSlope())
63411 {
63413 break;
63414 }
63415 }
63417 {
63419 Main.tile[
i,
num8].type = 638;
63420 Main.tile[
i,
num8].active(active:
true);
63421 Main.tile[
i,
num8].CopyPaintAndCoating(Main.tile[i,
num8 - 1]);
63423 if (Main.netMode == 2)
63424 {
63425 NetMessage.SendTileSquare(-1, i,
num8);
63426 }
63427 }
63428 }
63429 }
63430 }
63431 else if ((Main.tile[i,
j].type == 70 || Main.tile[i,
j].type == 528) &&
GrowMoreVines(i,
j))
63432 {
63433 if (!Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
63434 {
63436 if (Main.tile[i,
j].type == 528)
63437 {
63439 }
63441 {
63442 bool flag3 =
false;
63444 {
63445 if (Main.tile[i,
num9].bottomSlope())
63446 {
63448 break;
63449 }
63450 if (Main.tile[i,
num9].active() && Main.tile[i,
num9].type == 70 && !Main.tile[i,
num9].bottomSlope())
63451 {
63453 break;
63454 }
63455 }
63457 {
63459 Main.tile[
i,
num10].type = 528;
63461 Main.tile[
i,
num10].CopyPaintAndCoating(Main.tile[i,
num10 - 1]);
63463 if (Main.netMode == 2)
63464 {
63465 NetMessage.SendTileSquare(-1, i,
num10);
63466 }
63467 }
63468 }
63469 }
63470 }
63471 else if ((Main.tile[i,
j].type == 661 || Main.tile[i,
j].type == 636) &&
GrowMoreVines(i,
j))
63472 {
63473 if (!Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
63474 {
63476 if (Main.tile[i,
j].type == 636)
63477 {
63479 }
63481 {
63482 bool flag4 =
false;
63484 {
63485 if (Main.tile[i,
num11].bottomSlope())
63486 {
63488 break;
63489 }
63490 if (Main.tile[i,
num11].active() && Main.tile[i,
num11].type == 661 && !Main.tile[i,
num11].bottomSlope())
63491 {
63493 break;
63494 }
63495 }
63497 {
63499 Main.tile[
i,
num12].type = 636;
63501 Main.tile[
i,
num12].CopyPaintAndCoating(Main.tile[i,
num12 - 1]);
63503 if (Main.netMode == 2)
63504 {
63505 NetMessage.SendTileSquare(-1, i,
num12);
63506 }
63507 }
63508 }
63509 }
63510 }
63511 else if ((Main.tile[i,
j].type == 662 || Main.tile[i,
j].type == 205) &&
GrowMoreVines(i,
j))
63512 {
63513 if (!Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 1].lava())
63514 {
63516 if (Main.tile[i,
j].type == 205)
63517 {
63519 }
63521 {
63522 bool flag5 =
false;
63524 {
63525 if (Main.tile[i,
num13].bottomSlope())
63526 {
63528 break;
63529 }
63530 if (Main.tile[i,
num13].active() && Main.tile[i,
num13].type == 662 && !Main.tile[i,
num13].bottomSlope())
63531 {
63533 break;
63534 }
63535 }
63537 {
63539 Main.tile[
i,
num14].type = 205;
63541 Main.tile[
i,
num14].CopyPaintAndCoating(Main.tile[i,
num14 - 1]);
63543 if (Main.netMode == 2)
63544 {
63545 NetMessage.SendTileSquare(-1, i,
num14);
63546 }
63547 }
63548 }
63549 }
63550 }
63551 else if ((Main.tile[i,
j].type == 60 || Main.tile[i,
j].type == 62) &&
genRand.Next(80) == 0 && !
PlayerLOS(i,
j))
63552 {
63555 if (Main.tile[i,
j].type == 60)
63556 {
63558 }
63559 for (
int k = i;
k <
i + 2;
k++)
63560 {
63563 {
63565 }
63566 if (Main.tile[
k,
num16].liquid > 0 || Main.wallHouse[Main.tile[
k,
num16].wall])
63567 {
63569 }
63571 {
63572 break;
63573 }
63575 {
63576 if ((Main.tile[
k,
l].active() && (!Main.tileCut[Main.tile[
k,
l].type] || Main.tile[
k,
l].type == 444)) || Main.tile[
k,
l].lava())
63577 {
63579 }
63581 {
63582 break;
63583 }
63584 }
63586 {
63587 break;
63588 }
63589 }
63591 {
63593 }
63595 {
63596 for (
int m = i;
m <
i + 2;
m++)
63597 {
63598 Main.tile[
m,
num15 - 1].slope(0);
63599 Main.tile[
m,
num15 - 1].halfBrick(halfBrick:
false);
63601 {
63602 if (Main.tile[
m,
n].active())
63603 {
63605 }
63606 }
63607 }
63609 {
63611 {
63616 }
63617 }
63618 if (Main.netMode == 2)
63619 {
63620 NetMessage.SendTileSquare(-1, i,
num15 - 1, 2, 3);
63621 }
63622 }
63623 }
63625 {
63629 {
63632 {
63634 }
63636 {
63638 }
63640 {
63641 break;
63642 }
63644 {
63646 {
63648 }
63650 {
63651 break;
63652 }
63653 }
63655 {
63656 break;
63657 }
63658 }
63660 {
63662 }
63664 {
63667 {
63668 if (Main.tile[i,
j +
num23].active())
63669 {
63671 break;
63672 }
63673 }
63675 {
63677 if (Main.netMode == 2)
63678 {
63679 NetMessage.SendTileSquare(-1, i,
j - 2, 2, 2);
63680 }
63681 }
63682 }
63683 }
63684 else if (Main.tile[i,
j].type == 69)
63685 {
63687 }
63688 else if (Main.tile[i,
j].type == 147 || Main.tile[i,
j].type == 161 || Main.tile[i,
j].type == 163 || Main.tile[i,
j].type == 164 || Main.tile[i,
j].type == 200)
63689 {
63690 if (Main.rand.Next(10) == 0 && !Main.tile[i,
j + 1].active() && !Main.tile[i,
j + 2].active())
63691 {
63696 {
63697 if (Main.tile[
num27,
j].type == 165 && Main.tile[
num27,
j].active())
63698 {
63700 }
63701 if (Main.tile[
num27,
j + 1].type == 165 && Main.tile[
num27,
j + 1].active())
63702 {
63704 }
63705 if (Main.tile[
num27,
j + 2].type == 165 && Main.tile[
num27,
j + 2].active())
63706 {
63708 }
63709 if (Main.tile[
num27,
j + 3].type == 165 && Main.tile[
num27,
j + 3].active())
63710 {
63712 }
63713 }
63715 {
63718 if (Main.netMode == 2 && Main.tile[i,
j + 1].active())
63719 {
63720 NetMessage.SendTileSquare(-1, i,
j + 1, 1, 2);
63721 }
63722 }
63723 }
63724 }
63726 {
63727 int type2 = Main.tile[
i,
j].type;
63728 bool flag9 =
false;
63729 TileColorCache color = Main.tile[
i,
j].BlockColorAndCoating();
63731 {
63733 {
63735 {
63740 {
63743 }
63744 }
63745 }
63746 }
63747 if (Main.netMode == 2 &&
flag9)
63748 {
63749 NetMessage.SendTileSquare(-1, i,
j, 3);
63750 }
63752 {
63756 {
63757 case 0:
63759 break;
63760 case 1:
63762 break;
63763 case 2:
63765 break;
63766 default:
63768 break;
63769 }
63771 {
63773 {
63774 Main.tile[
num31,
num32].CopyPaintAndCoating(Main.tile[i,
j]);
63775 }
63776 if (Main.netMode == 2 && Main.tile[
num31,
num32].active())
63777 {
63778 NetMessage.SendTileSquare(-1,
num31,
num32);
63779 }
63780 }
63781 }
63782 }
63783 else if (Main.tile[i,
j].type == 20)
63784 {
63786 {
63788 }
63789 }
63790 else if (Main.tile[i,
j].type == 590)
63791 {
63793 {
63795 }
63796 }
63797 else if (Main.tile[i,
j].type == 595)
63798 {
63800 {
63802 }
63803 }
63804 else if (Main.tile[i,
j].type == 615 &&
genRand.Next(5) == 0)
63805 {
63807 }
63808 }
63809 else
63810 {
63811 if (Main.tile[i,
j].wall == 62 && Main.tile[i,
j].liquid == 0)
63812 {
63814 }
63816 {
63818 }
63819 }
63821 {
63822 if (Main.tile[i,
j].wall == 81 || Main.tile[i,
j].wall == 83 || (Main.tile[i,
j].type == 199 && Main.tile[i,
j].active()))
63823 {
63827 {
63830 {
63832 {
63834 {
63837 {
63839 break;
63840 }
63841 }
63842 }
63843 }
63845 {
63847 if (Main.netMode == 2)
63848 {
63849 NetMessage.SendTileSquare(-1,
num33,
num34);
63850 }
63851 }
63852 }
63853 }
63854 else if (Main.tile[i,
j].wall == 69 || Main.tile[i,
j].wall == 3 || (Main.tile[i,
j].type == 23 && Main.tile[i,
j].active()))
63855 {
63859 {
63862 {
63864 {
63866 {
63869 {
63871 break;
63872 }
63873 }
63874 }
63875 }
63877 {
63879 if (Main.netMode == 2)
63880 {
63881 NetMessage.SendTileSquare(-1,
num37,
num38);
63882 }
63883 }
63884 }
63885 }
63886 else if (Main.tile[i,
j].wall == 70 || (Main.tile[i,
j].type == 109 && Main.tile[i,
j].active()))
63887 {
63891 {
63894 {
63896 {
63898 {
63901 {
63903 break;
63904 }
63905 }
63906 }
63907 }
63909 {
63911 if (Main.netMode == 2)
63912 {
63913 NetMessage.SendTileSquare(-1,
num41,
num42);
63914 }
63915 }
63916 }
63917 }
63919 }
63920 if (!Main.tile[i,
j].nactive())
63921 {
63922 return;
63923 }
63924 if (Main.tile[i,
j].type == 61 &&
genRand.Next(3) == 0 && Main.tile[i,
j].frameX < 144)
63925 {
63926 if (Main.rand.Next(4) == 0)
63927 {
63929 }
63930 Main.tile[
i,
j].type = 74;
63931 if (Main.netMode == 2)
63932 {
63933 NetMessage.SendTileSquare(-1, i,
j);
63934 }
63935 }
63936 if ((Main.tile[i,
j].type == 60 || Main.tile[i,
j].type == 62) &&
GrowMoreVines(i,
j))
63937 {
63939 if (Main.tile[i,
j].type == 62)
63940 {
63942 }
63943 if (
genRand.Next(
maxValue5) != 0 || Main.tile[
i,
j + 1].active() || Main.tile[
i,
j + 1].lava())
63944 {
63945 return;
63946 }
63949 {
63950 if (Main.tile[i,
num45].bottomSlope())
63951 {
63953 break;
63954 }
63955 if (Main.tile[i,
num45].active() && Main.tile[
i,
num45].type == 60 && !Main.tile[
i,
num45].bottomSlope())
63956 {
63958 break;
63959 }
63960 }
63962 {
63964 Main.tile[
i,
num46].type = 62;
63966 Main.tile[
i,
num46].CopyPaintAndCoating(Main.tile[i,
num46 - 1]);
63968 if (Main.netMode == 2)
63969 {
63970 NetMessage.SendTileSquare(-1, i,
num46);
63971 }
63972 }
63973 }
63974 else if ((Main.tile[i,
j].type == 633 || Main.tile[i,
j].type == 638) &&
GrowMoreVines(i,
j))
63975 {
63977 if (Main.tile[i,
j].type == 638)
63978 {
63980 }
63981 if (
genRand.Next(
maxValue6) != 0 || Main.tile[i,
j + 1].active() || Main.tile[i,
j + 1].lava())
63982 {
63983 return;
63984 }
63987 {
63988 if (Main.tile[i,
num47].bottomSlope())
63989 {
63991 break;
63992 }
63993 if (Main.tile[i,
num47].active() && Main.tile[i,
num47].type == 633 && !Main.tile[i,
num47].bottomSlope())
63994 {
63996 break;
63997 }
63998 }
64000 {
64002 Main.tile[
i,
num48].type = 638;
64004 Main.tile[
i,
num48].CopyPaintAndCoating(Main.tile[i,
num48 - 1]);
64006 if (Main.netMode == 2)
64007 {
64008 NetMessage.SendTileSquare(-1, i,
num48);
64009 }
64010 }
64011 }
64012 else
64013 {
64014 if ((Main.tile[i,
j].type != 70 && Main.tile[i,
j].type != 528) || !
GrowMoreVines(i,
j))
64015 {
64016 return;
64017 }
64019 if (Main.tile[i,
j].type == 528)
64020 {
64022 }
64023 if (
genRand.Next(
maxValue7) != 0 || Main.tile[i,
j + 1].active() || Main.tile[i,
j + 1].lava())
64024 {
64025 return;
64026 }
64029 {
64030 if (Main.tile[i,
num49].bottomSlope())
64031 {
64033 break;
64034 }
64035 if (Main.tile[i,
num49].active() && Main.tile[i,
num49].type == 70 && !Main.tile[i,
num49].bottomSlope())
64036 {
64038 break;
64039 }
64040 }
64042 {
64044 Main.tile[
i,
num50].type = 528;
64046 Main.tile[
i,
num50].CopyPaintAndCoating(Main.tile[i,
num50 - 1]);
64048 if (Main.netMode == 2)
64049 {
64050 NetMessage.SendTileSquare(-1, i,
num50);
64051 }
64052 }
64053 }
64054 }
static bool[] SpreadUnderground
static bool[] tileMossBrick
static void GrowAlch(int x, int y)
static void UpdateWorld_GrassGrowth(int i, int j, int minI, int maxI, int minJ, int maxJ, bool underground)
static bool AttemptToGrowTreeFromSapling(int x, int y, bool underground)
static bool AllowedToSpreadInfections
static int CountNearBlocksTypes(int i, int j, int radius, int cap=0, params int[] tiletypes)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static void GrowCheckSeaweed(int x, int y)
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static UnifiedRandom genRand
static void SpreadDesertWalls(int wallDist, int i, int j)
static void GrowSpike(int i, int j, ushort spikeType, ushort landType)
static bool PlayerLOS(int x, int y)
static void plantDye(int i, int j, bool exoticPlant=false)
static bool GrowMoreVines(int x, int y)
static void TrySpawningTownNPC(int x, int y)
static int MossConversion(int thisType, int otherType)
static void hardUpdateWorld(int i, int j)
static void GrowWeb(int i, int j)
static void SpreadGrass(int i, int j, int dirt=0, int grass=2, bool repeat=true, TileColorCache color=default(TileColorCache))
static bool InWorld(int x, int y, int fluff=0)
static bool AnchorValid(Tile tileCache, AnchorType anchor)
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static void CheckCatTail(int x, int j)
static void PlaceTight(int x, int y, bool spiders=false)
static void GrowCatTail(int x, int j)