TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ PlaceSunflower()

static void Terraria.WorldGen.PlaceSunflower ( int x,
int y,
ushort type = 27 )
inlinestatic

Definition at line 47742 of file WorldGen.cs.

47743 {
47744 if ((double)y > Main.worldSurface - 1.0 && !Main.remixWorld)
47745 {
47746 return;
47747 }
47748 bool flag = true;
47749 for (int i = x; i < x + 2; i++)
47750 {
47751 for (int j = y - 3; j < y + 1; j++)
47752 {
47753 if (Main.tile[i, j] == null)
47754 {
47755 Main.tile[i, j] = default(Tile);
47756 }
47757 if (Main.tile[i, j].active() || Main.tile[i, j].wall > 0)
47758 {
47759 flag = false;
47760 }
47761 }
47762 if (Main.tile[i, y + 1] == null)
47763 {
47764 Main.tile[i, y + 1] = default(Tile);
47765 }
47766 if (!Main.tile[i, y + 1].nactive() || Main.tile[i, y + 1].halfBrick() || Main.tile[i, y + 1].slope() != 0 || (Main.tile[i, y + 1].type != 2 && Main.tile[i, y + 1].type != 109))
47767 {
47768 flag = false;
47769 }
47770 }
47771 if (!flag)
47772 {
47773 return;
47774 }
47775 int num = genRand.Next(3);
47776 for (int k = 0; k < 2; k++)
47777 {
47778 for (int l = -3; l < 1; l++)
47779 {
47780 int num2 = k * 18 + genRand.Next(3) * 36;
47781 if (l <= -2)
47782 {
47783 num2 = k * 18 + num * 36;
47784 }
47785 int num3 = (l + 3) * 18;
47786 Main.tile[x + k, y + l].active(active: true);
47787 Main.tile[x + k, y + l].frameX = (short)num2;
47788 Main.tile[x + k, y + l].frameY = (short)num3;
47789 Main.tile[x + k, y + l].type = type;
47790 }
47791 }
47792 }
static UnifiedRandom genRand
Definition WorldGen.cs:1455

References Terraria.Main.remixWorld, Terraria.Main.tile, and Terraria.Main.worldSurface.