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

◆ KillTile_GetTreeDrops()

static void Terraria.WorldGen.KillTile_GetTreeDrops ( int i,
int j,
Tile tileCache,
ref bool bonusWood,
ref int dropItem,
ref int secondaryItem )
inlinestaticprivate

Definition at line 60506 of file WorldGen.cs.

60507 {
60508 //IL_02bc: Unknown result type (might be due to invalid IL or missing references)
60509 if (tileCache.frameX >= 22 && tileCache.frameY >= 198)
60510 {
60511 if (Main.netMode != 1)
60512 {
60513 if (genRand.Next(2) == 0)
60514 {
60515 int k;
60516 for (k = j; Main.tile[i, k] != null && (!Main.tile[i, k].active() || !Main.tileSolid[Main.tile[i, k].type] || Main.tileSolidTop[Main.tile[i, k].type]); k++)
60517 {
60518 }
60519 if (Main.tile[i, k] != null)
60520 {
60521 Tile tile = Main.tile[i, k];
60522 bool vanillaResult = false;
60523 if (tile.type == 2 || tile.type == 109 || tile.type == 477 || tile.type == 492 || tile.type == 147 || tile.type == 199 || tile.type == 23 || tile.type == 633)
60524 {
60525 vanillaResult = true;
60526 }
60527 if (vanillaResult || TileLoader.CanDropAcorn(tile.type))
60528 {
60529 dropItem = 9;
60530 secondaryItem = 27;
60531 }
60532 else
60533 {
60534 dropItem = 9;
60535 }
60536 }
60537 }
60538 else
60539 {
60540 dropItem = 9;
60541 }
60542 }
60543 }
60544 else
60545 {
60546 dropItem = 9;
60547 }
60548 if (dropItem != 9)
60549 {
60550 return;
60551 }
60552 GetTreeBottom(i, j, out var x, out var y);
60553 if (Main.tile[x, y].active())
60554 {
60555 switch (Main.tile[x, y].type)
60556 {
60557 case 633:
60558 dropItem = 5215;
60559 break;
60560 case 23:
60561 case 661:
60562 dropItem = 619;
60563 break;
60564 case 199:
60565 case 662:
60566 dropItem = 911;
60567 break;
60568 case 60:
60569 dropItem = 620;
60570 break;
60571 case 109:
60572 case 492:
60573 dropItem = 621;
60574 break;
60575 case 70:
60576 if (genRand.Next(2) == 0)
60577 {
60578 dropItem = 183;
60579 }
60580 else
60581 {
60582 dropItem = 0;
60583 }
60584 break;
60585 case 147:
60586 dropItem = 2503;
60587 break;
60588 }
60589 TileLoader.DropTreeWood(Main.tile[x, y].type, ref dropItem);
60590 }
60591 int num = Player.FindClosest(new Vector2((float)(x * 16), (float)(y * 16)), 16, 16);
60592 int axe = Main.player[num].inventory[Main.player[num].selectedItem].axe;
60593 if (genRand.Next(100) < axe || Main.rand.Next(3) == 0)
60594 {
60595 bonusWood = true;
60596 }
60597 }
static void DropTreeWood(int type, ref int wood)
static bool CanDropAcorn(int type)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
static UnifiedRandom genRand
Definition WorldGen.cs:1455
static void GetTreeBottom(int i, int j, out int x, out int y)

References Terraria.ModLoader.TileLoader.CanDropAcorn(), Terraria.ModLoader.TileLoader.DropTreeWood(), Terraria.Player.FindClosest(), Terraria.Tile.frameX, Terraria.Tile.frameY, Terraria.Main.netMode, Terraria.Main.player, Terraria.Main.rand, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and Terraria.Tile.type.

+ Here is the call graph for this function: