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

◆ TryKillingTreesAboveIfTheyWouldBecomeInvalid()

static bool Terraria.WorldGen.TryKillingTreesAboveIfTheyWouldBecomeInvalid ( int i,
int j,
int newFloorType )
inlinestatic

Definition at line 49672 of file WorldGen.cs.

49673 {
49674 if (newFloorType < 0)
49675 {
49676 return false;
49677 }
49678 if (!InWorld(i, j, 2))
49679 {
49680 return false;
49681 }
49682 Tile tile = Main.tile[i, j - 1];
49683 if (tile == null || !tile.active())
49684 {
49685 return false;
49686 }
49687 int type = tile.type;
49688 if (!IsTreeType(tile.type) && tile.type != 323)
49689 {
49690 return false;
49691 }
49692 bool flag = true;
49693 flag = type switch
49694 {
49695 72 => newFloorType == 70,
49698 };
49699 if (flag && GrowTreeSettings.Profiles.TryGetFromTreeId(type, out var profile))
49700 {
49701 flag = profile.GroundTest(newFloorType);
49702 }
49703 if (!flag)
49704 {
49705 KillTile(i, j - 1);
49706 if (Main.netMode == 1)
49707 {
49708 NetMessage.SendData(17, -1, -1, null, 0, i, j - 1);
49709 }
49710 }
49711 return true;
49712 }
static bool IsTreeType(int tree)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:6481

References Terraria.Tile.active(), Terraria.ID.TileID.Sets.Conversion.Grass, Terraria.ID.TileID.Sets.Conversion.JungleGrass, Terraria.Main.netMode, Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.NetMessage.SendData(), Terraria.ID.TileID.Sets.Conversion.Snow, Terraria.Main.tile, Terraria.WorldGen.GrowTreeSettings.Profiles.TryGetFromTreeId(), and Terraria.Tile.type.

+ Here is the call graph for this function: