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

◆ PlaceTile()

static bool Terraria.WorldGen.PlaceTile ( int i,
int j,
int Type,
bool mute = false,
bool forced = false,
int plr = -1,
int style = 0 )
inlinestatic

Definition at line 50270 of file WorldGen.cs.

50271 {
50272 int num = Type;
50273 if (gen && Main.tile[i, j].active() && Main.tile[i, j].type == 488)
50274 {
50275 return false;
50276 }
50277 if (num >= TileID.Count)
50278 {
50279 return false;
50280 }
50281 bool result = false;
50282 if (i >= 0 && j >= 0 && i < Main.maxTilesX && j < Main.maxTilesY)
50283 {
50284 Tile tile = Main.tile[i, j];
50285 if (tile == null)
50286 {
50287 tile = new Tile();
50288 Main.tile[i, j] = tile;
50289 }
50290 if (tile.active())
50291 {
50292 if (num == 23 && tile.type == 59)
50293 {
50294 num = 661;
50295 }
50296 if (num == 199 && tile.type == 59)
50297 {
50298 num = 662;
50299 }
50300 }
50301 if (forced || Collision.EmptyTile(i, j) || !Main.tileSolid[num] || (num == 23 && tile.type == 0 && tile.active()) || (num == 199 && tile.type == 0 && tile.active()) || (num == 2 && tile.type == 0 && tile.active()) || (num == 109 && tile.type == 0 && tile.active()) || (num == 60 && tile.type == 59 && tile.active()) || (num == 661 && tile.type == 59 && tile.active()) || (num == 662 && tile.type == 59 && tile.active()) || (num == 70 && tile.type == 59 && tile.active()) || (num == 633 && tile.type == 57 && tile.active()) || (Main.tileMoss[num] && (tile.type == 1 || tile.type == 38) && tile.active()))
50302 {
50303 if (num == 23 && (tile.type != 0 || !tile.active()))
50304 {
50305 return false;
50306 }
50307 if (num == 199 && (tile.type != 0 || !tile.active()))
50308 {
50309 return false;
50310 }
50311 if (num == 2 && (tile.type != 0 || !tile.active()))
50312 {
50313 return false;
50314 }
50315 if (num == 109 && (tile.type != 0 || !tile.active()))
50316 {
50317 return false;
50318 }
50319 if (num == 60 && (tile.type != 59 || !tile.active()))
50320 {
50321 return false;
50322 }
50323 if (num == 661 && (tile.type != 59 || !tile.active()))
50324 {
50325 return false;
50326 }
50327 if (num == 662 && (tile.type != 59 || !tile.active()))
50328 {
50329 return false;
50330 }
50331 if (num == 70 && (tile.type != 59 || !tile.active()))
50332 {
50333 return false;
50334 }
50335 if (num == 633 && (tile.type != 57 || !tile.active()))
50336 {
50337 return false;
50338 }
50339 if (Main.tileMoss[num])
50340 {
50341 if ((tile.type != 1 && tile.type != 38) || !tile.active())
50342 {
50343 return false;
50344 }
50345 if (tile.type == 38)
50346 {
50347 num = num switch
50348 {
50349 381 => 517,
50350 534 => 535,
50351 536 => 537,
50352 539 => 540,
50353 625 => 626,
50354 627 => 628,
50355 _ => 512 + num - 179,
50356 };
50357 }
50358 }
50359 if (num == 81)
50360 {
50361 if (Main.tile[i, j - 1] == null)
50362 {
50363 Main.tile[i, j - 1] = new Tile();
50364 }
50365 if (Main.tile[i, j + 1] == null)
50366 {
50367 Main.tile[i, j + 1] = new Tile();
50368 }
50369 if (Main.tile[i, j - 1].active())
50370 {
50371 return false;
50372 }
50373 if (!Main.tile[i, j + 1].active() || !Main.tileSolid[Main.tile[i, j + 1].type] || Main.tile[i, j + 1].halfBrick() || Main.tile[i, j + 1].slope() != 0)
50374 {
50375 return false;
50376 }
50377 }
50378 if ((num == 373 || num == 375 || num == 374 || num == 461) && (Main.tile[i, j - 1] == null || Main.tile[i, j - 1].bottomSlope()))
50379 {
50380 return false;
50381 }
50382 if (tile.liquid > 0 || tile.checkingLiquid())
50383 {
50384 switch (num)
50385 {
50386 case 4:
50387 if (style != 8 && style != 11 && style != 17)
50388 {
50389 return false;
50390 }
50391 break;
50392 case 3:
50393 case 20:
50394 case 24:
50395 case 27:
50396 case 32:
50397 case 51:
50398 case 69:
50399 case 72:
50400 case 201:
50401 case 352:
50402 case 529:
50403 case 624:
50404 case 637:
50405 case 656:
50406 return false;
50407 }
50408 }
50409 if (TileID.Sets.ResetsHalfBrickPlacementAttempt[num] && (!tile.active() || !Main.tileFrameImportant[tile.type]))
50410 {
50411 tile.halfBrick(halfBrick: false);
50412 tile.frameY = 0;
50413 tile.frameX = 0;
50414 }
50415 if (num == 624)
50416 {
50417 if ((!tile.active() || Main.tileCut[tile.type] || TileID.Sets.BreakableWhenPlacing[tile.type]) && HasValidGroundForAbigailsFlowerBelowSpot(i, j))
50418 {
50419 tile.active(active: true);
50420 tile.type = 624;
50421 tile.halfBrick(halfBrick: false);
50422 tile.slope(0);
50423 tile.frameX = 0;
50424 tile.frameY = 0;
50425 }
50426 }
50427 else if (num == 656)
50428 {
50429 if ((!tile.active() || Main.tileCut[tile.type] || TileID.Sets.BreakableWhenPlacing[tile.type]) && HasValidGroundForGlowTulipBelowSpot(i, j))
50430 {
50431 tile.active(active: true);
50432 tile.type = 656;
50433 tile.halfBrick(halfBrick: false);
50434 tile.slope(0);
50435 tile.frameX = 0;
50436 tile.frameY = 0;
50437 }
50438 }
50439 else if (num == 3 || num == 24 || num == 110 || num == 201 || num == 637)
50440 {
50441 if (IsFitToPlaceFlowerIn(i, j, num))
50442 {
50443 if (num == 24 && genRand.Next(13) == 0)
50444 {
50445 tile.active(active: true);
50446 tile.type = 32;
50447 SquareTileFrame(i, j);
50448 }
50449 else if (num == 201 && genRand.Next(13) == 0)
50450 {
50451 tile.active(active: true);
50452 tile.type = 352;
50453 SquareTileFrame(i, j);
50454 }
50455 else if (Main.tile[i, j + 1].type == 78 || Main.tile[i, j + 1].type == 380 || Main.tile[i, j + 1].type == 579)
50456 {
50457 tile.active(active: true);
50458 tile.type = (ushort)num;
50459 int num2 = genRand.NextFromList<int>(6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 30, 33, 36, 39, 42);
50460 switch (num2)
50461 {
50462 case 21:
50463 case 24:
50464 case 27:
50465 case 30:
50466 case 33:
50467 case 36:
50468 case 39:
50469 case 42:
50470 num2 += genRand.Next(3);
50471 break;
50472 }
50473 tile.frameX = (short)(num2 * 18);
50474 }
50475 else if (tile.wall >= 0 && tile.wall < WallID.Count && WallID.Sets.AllowsPlantsToGrow[tile.wall] && Main.tile[i, j + 1].wall >= 0 && Main.tile[i, j + 1].wall < WallID.Count && WallID.Sets.AllowsPlantsToGrow[Main.tile[i, j + 1].wall])
50476 {
50477 if (genRand.Next(50) == 0 || ((num == 24 || num == 201) && genRand.Next(40) == 0))
50478 {
50479 tile.active(active: true);
50480 tile.type = (ushort)num;
50481 if (num == 201)
50482 {
50483 tile.frameX = 270;
50484 }
50485 else
50486 {
50487 tile.frameX = 144;
50488 }
50489 }
50490 else if (genRand.Next(35) == 0 || (Main.tile[i, j].wall >= 63 && Main.tile[i, j].wall <= 70))
50491 {
50492 tile.active(active: true);
50493 tile.type = (ushort)num;
50494 int num3 = genRand.NextFromList<int>(6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
50495 if (num == 201)
50496 {
50497 num3 = genRand.NextFromList<int>(6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22);
50498 }
50499 if (num == 637)
50500 {
50501 num3 = genRand.NextFromList<int>(6, 7, 8, 9, 10);
50502 }
50503 tile.frameX = (short)(num3 * 18);
50504 }
50505 else
50506 {
50507 tile.active(active: true);
50508 tile.type = (ushort)num;
50509 tile.frameX = (short)(genRand.Next(6) * 18);
50510 }
50511 }
50512 }
50513 }
50514 else if (num == 61)
50515 {
50516 if (j + 1 < Main.maxTilesY && Main.tile[i, j + 1].active() && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick() && Main.tile[i, j + 1].type == 60)
50517 {
50518 bool flag = (double)j > Main.rockLayer || Main.remixWorld || remixWorldGen;
50519 if (genRand.Next(16) == 0 && (double)j > Main.worldSurface)
50520 {
50521 tile.active(active: true);
50522 tile.type = 69;
50523 SquareTileFrame(i, j);
50524 }
50525 else if (genRand.Next(60) == 0 && flag)
50526 {
50527 tile.active(active: true);
50528 tile.type = (ushort)num;
50529 tile.frameX = 144;
50530 }
50531 else if (genRand.Next(230) == 0 && flag)
50532 {
50533 tile.active(active: true);
50534 tile.type = (ushort)num;
50535 tile.frameX = 162;
50536 }
50537 else if (genRand.Next(15) == 0)
50538 {
50539 tile.active(active: true);
50540 tile.type = (ushort)num;
50541 if (genRand.Next(3) != 0)
50542 {
50543 tile.frameX = (short)(genRand.Next(2) * 18 + 108);
50544 }
50545 else
50546 {
50547 tile.frameX = (short)(genRand.Next(13) * 18 + 180);
50548 }
50549 }
50550 else
50551 {
50552 tile.active(active: true);
50553 tile.type = (ushort)num;
50554 tile.frameX = (short)(genRand.Next(6) * 18);
50555 }
50556 }
50557 }
50558 else if (num == 518)
50559 {
50560 PlaceLilyPad(i, j);
50561 }
50562 else if (num == 519)
50563 {
50564 PlaceCatTail(i, j);
50565 }
50566 else if (num == 529)
50567 {
50568 PlantSeaOat(i, j);
50569 }
50570 else if (num == 571)
50571 {
50572 PlaceBamboo(i, j);
50573 }
50574 else if (num == 549)
50575 {
50576 PlaceUnderwaterPlant(549, i, j);
50577 }
50578 else if (num == 71)
50579 {
50580 if (j + 1 < Main.maxTilesY && Main.tile[i, j + 1].active() && Main.tile[i, j + 1].slope() == 0 && !Main.tile[i, j + 1].halfBrick() && Main.tile[i, j + 1].type == 70)
50581 {
50582 Point point = new Point(-1, -1);
50583 if ((double)j > Main.worldSurface)
50584 {
50585 point = PlaceCatTail(i, j);
50586 }
50587 if (InWorld(point.X, point.Y))
50588 {
50589 if (gen)
50590 {
50591 int num4 = genRand.Next(14);
50592 for (int k = 0; k < num4; k++)
50593 {
50594 GrowCatTail(point.X, point.Y);
50595 }
50596 SquareTileFrame(point.X, point.Y);
50597 }
50598 }
50599 else
50600 {
50601 tile.active(active: true);
50602 tile.type = (ushort)num;
50603 tile.frameX = (short)(genRand.Next(5) * 18);
50604 }
50605 }
50606 }
50607 else if (num == 129)
50608 {
50609 if (SolidTile(i - 1, j) || SolidTile(i + 1, j) || SolidTile(i, j - 1) || SolidTile(i, j + 1))
50610 {
50611 tile.active(active: true);
50612 tile.type = (ushort)num;
50613 tile.frameX = (short)(style * 18);
50614 SquareTileFrame(i, j);
50615 }
50616 }
50617 else if (num == 178)
50618 {
50619 if (SolidTile(i - 1, j, noDoors: true) || SolidTile(i + 1, j, noDoors: true) || SolidTile(i, j - 1) || SolidTile(i, j + 1))
50620 {
50621 tile.active(active: true);
50622 tile.type = (ushort)num;
50623 tile.frameX = (short)(style * 18);
50624 tile.frameY = (short)(genRand.Next(3) * 18);
50625 SquareTileFrame(i, j);
50626 }
50627 }
50628 else if (num == 184)
50629 {
50630 if ((Main.tileMoss[Main.tile[i - 1, j].type] && SolidTile(i - 1, j)) || (Main.tileMoss[Main.tile[i + 1, j].type] && SolidTile(i + 1, j)) || (Main.tileMoss[Main.tile[i, j - 1].type] && SolidTile(i, j - 1)) || (Main.tileMoss[Main.tile[i, j + 1].type] && SolidTile(i, j + 1)))
50631 {
50632 tile.active(active: true);
50633 tile.type = (ushort)num;
50634 tile.frameX = (short)(style * 18);
50635 tile.frameY = (short)(genRand.Next(3) * 18);
50636 SquareTileFrame(i, j);
50637 }
50638 if ((TileID.Sets.tileMossBrick[Main.tile[i - 1, j].type] && SolidTile(i - 1, j)) || (TileID.Sets.tileMossBrick[Main.tile[i + 1, j].type] && SolidTile(i + 1, j)) || (TileID.Sets.tileMossBrick[Main.tile[i, j - 1].type] && SolidTile(i, j - 1)) || (TileID.Sets.tileMossBrick[Main.tile[i, j + 1].type] && SolidTile(i, j + 1)))
50639 {
50640 tile.active(active: true);
50641 tile.type = (ushort)num;
50642 tile.frameX = (short)(style * 18);
50643 tile.frameY = (short)(genRand.Next(3) * 18);
50644 SquareTileFrame(i, j);
50645 }
50646 }
50647 else if (num == 485)
50648 {
50649 PlaceObject(i, j, num, mute, style);
50650 }
50651 else if (num == 171)
50652 {
50653 PlaceXmasTree(i, j, 171);
50654 }
50655 else if (num == 254)
50656 {
50657 Place2x2Style(i, j, (ushort)num, style);
50658 }
50659 else if (num == 335 || num == 564 || num == 594)
50660 {
50661 Place2x2(i, j, (ushort)num, 0);
50662 }
50663 else if (num == 654 || num == 319 || num == 132 || num == 484 || num == 138 || num == 664 || num == 142 || num == 143 || num == 282 || (num >= 288 && num <= 295) || (num >= 316 && num <= 318))
50664 {
50665 Place2x2(i, j, (ushort)num, 0);
50666 }
50667 else if (num == 411)
50668 {
50669 Place2x2(i, j, (ushort)num, 0);
50670 }
50671 else if (num == 457)
50672 {
50673 Place2x2Horizontal(i, j, 457, style);
50674 }
50675 else if (num == 137)
50676 {
50677 tile.active(active: true);
50678 tile.type = (ushort)num;
50679 tile.frameY = (short)(18 * style);
50680 }
50681 else if (num == 136)
50682 {
50683 if (Main.tile[i - 1, j] == null)
50684 {
50685 Main.tile[i - 1, j] = new Tile();
50686 }
50687 if (Main.tile[i + 1, j] == null)
50688 {
50689 Main.tile[i + 1, j] = new Tile();
50690 }
50691 if (Main.tile[i, j + 1] == null)
50692 {
50693 Main.tile[i, j + 1] = new Tile();
50694 }
50695 if ((Main.tile[i - 1, j].nactive() && !Main.tile[i - 1, j].halfBrick() && !TileID.Sets.NotReallySolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && (SolidTile(i - 1, j) || TileID.Sets.IsBeam[Main.tile[i - 1, j].type] || (Main.tile[i - 1, j].type == 5 && Main.tile[i - 1, j - 1].type == 5 && Main.tile[i - 1, j + 1].type == 5))) || (Main.tile[i + 1, j].nactive() && !Main.tile[i + 1, j].halfBrick() && !TileID.Sets.NotReallySolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && (SolidTile(i + 1, j) || TileID.Sets.IsBeam[Main.tile[i + 1, j].type] || (Main.tile[i + 1, j].type == 5 && Main.tile[i + 1, j - 1].type == 5 && Main.tile[i + 1, j + 1].type == 5))) || (Main.tile[i, j + 1].nactive() && !Main.tile[i, j + 1].halfBrick() && SolidTile(i, j + 1) && Main.tile[i, j + 1].slope() == 0) || tile.wall > 0)
50696 {
50697 tile.active(active: true);
50698 tile.type = (ushort)num;
50699 SquareTileFrame(i, j);
50700 }
50701 }
50702 else if (num == 442)
50703 {
50704 if (Main.tile[i - 1, j] == null)
50705 {
50706 Main.tile[i - 1, j] = new Tile();
50707 }
50708 if (Main.tile[i + 1, j] == null)
50709 {
50710 Main.tile[i + 1, j] = new Tile();
50711 }
50712 if (Main.tile[i, j + 1] == null)
50713 {
50714 Main.tile[i, j + 1] = new Tile();
50715 }
50716 if ((Main.tile[i - 1, j].nactive() && !Main.tile[i - 1, j].halfBrick() && !TileID.Sets.NotReallySolid[Main.tile[i - 1, j].type] && Main.tile[i - 1, j].slope() == 0 && (SolidTile(i - 1, j) || TileID.Sets.IsBeam[Main.tile[i - 1, j].type] || (Main.tile[i - 1, j].type == 5 && Main.tile[i - 1, j - 1].type == 5 && Main.tile[i - 1, j + 1].type == 5))) || (Main.tile[i + 1, j].nactive() && !Main.tile[i + 1, j].halfBrick() && !TileID.Sets.NotReallySolid[Main.tile[i + 1, j].type] && Main.tile[i + 1, j].slope() == 0 && (SolidTile(i + 1, j) || TileID.Sets.IsBeam[Main.tile[i + 1, j].type] || (Main.tile[i + 1, j].type == 5 && Main.tile[i + 1, j - 1].type == 5 && Main.tile[i + 1, j + 1].type == 5))) || (Main.tile[i, j + 1].nactive() && !Main.tile[i, j + 1].halfBrick() && SolidTile(i, j + 1) && Main.tile[i, j + 1].slope() == 0))
50717 {
50718 tile.active(active: true);
50719 tile.type = (ushort)num;
50720 SquareTileFrame(i, j);
50721 }
50722 }
50723 else if (num == 4)
50724 {
50725 if (Main.tile[i - 1, j] == null)
50726 {
50727 Main.tile[i - 1, j] = new Tile();
50728 }
50729 if (Main.tile[i + 1, j] == null)
50730 {
50731 Main.tile[i + 1, j] = new Tile();
50732 }
50733 if (Main.tile[i, j + 1] == null)
50734 {
50735 Main.tile[i, j + 1] = new Tile();
50736 }
50737 Tile tile2 = Main.tile[i - 1, j];
50738 Tile tile3 = Main.tile[i + 1, j];
50739 Tile tile4 = Main.tile[i, j + 1];
50740 if (tile.wall > 0 || (tile2.active() && (tile2.slope() == 0 || tile2.slope() % 2 != 1) && ((Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type] && !TileID.Sets.NotReallySolid[tile2.type]) || TileID.Sets.IsBeam[tile2.type] || (IsTreeType(tile2.type) && IsTreeType(Main.tile[i - 1, j - 1].type) && IsTreeType(Main.tile[i - 1, j + 1].type)))) || (tile3.active() && (tile3.slope() == 0 || tile3.slope() % 2 != 0) && ((Main.tileSolid[tile3.type] && !Main.tileSolidTop[tile3.type] && !TileID.Sets.NotReallySolid[tile3.type]) || TileID.Sets.IsBeam[tile3.type] || (IsTreeType(tile3.type) && IsTreeType(Main.tile[i + 1, j - 1].type) && IsTreeType(Main.tile[i + 1, j + 1].type)))) || (tile4.active() && Main.tileSolid[tile4.type] && ((TileID.Sets.Platforms[tile4.type] && TopEdgeCanBeAttachedTo(i, j + 1)) || ((!Main.tileSolidTop[tile4.type] || (tile4.type == 380 && tile4.slope() == 0)) && !TileID.Sets.NotReallySolid[tile4.type] && !tile4.halfBrick() && tile4.slope() == 0))))
50741 {
50742 tile.active(active: true);
50743 tile.type = (ushort)num;
50744 tile.frameY = (short)(22 * style);
50745 SquareTileFrame(i, j);
50746 }
50747 }
50748 else if (num == 10)
50749 {
50750 if (Main.tile[i, j - 1] == null)
50751 {
50752 Main.tile[i, j - 1] = new Tile();
50753 }
50754 if (Main.tile[i, j - 2] == null)
50755 {
50756 Main.tile[i, j - 2] = new Tile();
50757 }
50758 if (Main.tile[i, j - 3] == null)
50759 {
50760 Main.tile[i, j - 3] = new Tile();
50761 }
50762 if (Main.tile[i, j + 1] == null)
50763 {
50764 Main.tile[i, j + 1] = new Tile();
50765 }
50766 if (Main.tile[i, j + 2] == null)
50767 {
50768 Main.tile[i, j + 2] = new Tile();
50769 }
50770 if (Main.tile[i, j + 3] == null)
50771 {
50772 Main.tile[i, j + 3] = new Tile();
50773 }
50774 if (!Main.tile[i, j - 1].active() && !Main.tile[i, j - 2].active() && Main.tile[i, j - 3].active() && Main.tileSolid[Main.tile[i, j - 3].type])
50775 {
50776 PlaceDoor(i, j - 1, num, style);
50777 SquareTileFrame(i, j);
50778 }
50779 else
50780 {
50781 if (Main.tile[i, j + 1].active() || Main.tile[i, j + 2].active() || !Main.tile[i, j + 3].active() || !Main.tileSolid[Main.tile[i, j + 3].type])
50782 {
50783 return false;
50784 }
50785 PlaceDoor(i, j + 1, num, style);
50786 SquareTileFrame(i, j);
50787 }
50788 }
50789 else if ((num >= 275 && num <= 281) || num == 296 || num == 297 || num == 309 || num == 358 || num == 359 || num == 413 || num == 414 || num == 542)
50790 {
50791 Place6x3(i, j, (ushort)num);
50792 }
50793 else if (num == 237 || num == 244 || num == 285 || num == 286 || num == 298 || num == 299 || num == 310 || num == 339 || num == 538 || (num >= 361 && num <= 364) || num == 532 || num == 533 || num == 486 || num == 488 || num == 544 || num == 582 || num == 619 || num == 629)
50794 {
50795 Place3x2(i, j, (ushort)num);
50796 }
50797 else if (num == 128)
50798 {
50799 PlaceMan(i, j, style);
50800 SquareTileFrame(i, j);
50801 }
50802 else if (num == 269)
50803 {
50804 PlaceWoman(i, j, style);
50805 SquareTileFrame(i, j);
50806 }
50807 else if (num == 334)
50808 {
50809 int style2 = 0;
50810 if (style == -1)
50811 {
50812 style2 = 1;
50813 }
50814 Place3x3Wall(i, j, 334, style2);
50815 SquareTileFrame(i, j);
50816 }
50817 else if (num == 149)
50818 {
50819 if (SolidTile(i - 1, j) || SolidTile(i + 1, j) || SolidTile(i, j - 1) || SolidTile(i, j + 1))
50820 {
50821 tile.frameX = (short)(18 * style);
50822 tile.active(active: true);
50823 tile.type = (ushort)num;
50824 SquareTileFrame(i, j);
50825 }
50826 }
50827 else if (num == 139 || num == 35)
50828 {
50829 PlaceMB(i, j, (ushort)num, style);
50830 SquareTileFrame(i, j);
50831 }
50832 else if (num == 165)
50833 {
50834 PlaceTight(i, j);
50835 SquareTileFrame(i, j);
50836 }
50837 else if (num == 235)
50838 {
50839 Place3x1(i, j, (ushort)num);
50840 SquareTileFrame(i, j);
50841 }
50842 else if (num == 240)
50843 {
50844 Place3x3Wall(i, j, (ushort)num, style);
50845 }
50846 else if (num == 440)
50847 {
50848 Place3x3Wall(i, j, (ushort)num, style);
50849 }
50850 else if (num == 245)
50851 {
50852 Place2x3Wall(i, j, (ushort)num, style);
50853 }
50854 else if (num == 246)
50855 {
50856 Place3x2Wall(i, j, (ushort)num, style);
50857 }
50858 else if (num == 241)
50859 {
50860 Place4x3Wall(i, j, (ushort)num, style);
50861 }
50862 else if (num == 242)
50863 {
50864 Place6x4Wall(i, j, (ushort)num, style);
50865 }
50866 else if (num == 34)
50867 {
50868 PlaceChand(i, j, (ushort)num, style);
50869 SquareTileFrame(i, j);
50870 }
50871 else if (num == 106 || num == 212 || num == 219 || num == 220 || num == 228 || num == 231 || num == 243 || num == 247 || num == 283 || (num >= 300 && num <= 308) || num == 354 || num == 355 || num == 491 || num == 642)
50872 {
50873 Place3x3(i, j, (ushort)num, style);
50874 SquareTileFrame(i, j);
50875 }
50876 else
50877 {
50878 switch (num)
50879 {
50880 case 13:
50881 case 33:
50882 case 49:
50883 case 50:
50884 case 78:
50885 case 174:
50886 case 372:
50887 case 646:
50888 PlaceOnTable1x1(i, j, num, style);
50889 SquareTileFrame(i, j);
50890 break;
50891 case 14:
50892 case 26:
50893 case 86:
50894 case 87:
50895 case 88:
50896 case 89:
50897 case 114:
50898 case 186:
50899 case 187:
50900 case 215:
50901 case 217:
50902 case 218:
50903 case 377:
50904 case 469:
50905 Place3x2(i, j, (ushort)num, style);
50906 SquareTileFrame(i, j);
50907 break;
50908 case 236:
50909 PlaceJunglePlant(i, j, (ushort)num, genRand.Next(3), 0);
50910 SquareTileFrame(i, j);
50911 break;
50912 case 238:
50913 PlaceJunglePlant(i, j, (ushort)num, 0, 0);
50914 SquareTileFrame(i, j);
50915 break;
50916 case 20:
50917 {
50918 if (Main.tile[i, j + 1] == null)
50919 {
50920 Main.tile[i, j + 1] = new Tile();
50921 }
50922 int type = Main.tile[i, j + 1].type;
50923 if (Main.tile[i, j + 1].active() && (type == 2 || type == 109 || type == 147 || type == 60 || type == 23 || type == 199 || type == 661 || type == 662 || type == 53 || type == 234 || type == 116 || type == 112))
50924 {
50925 Place1x2(i, j, (ushort)num, style);
50926 SquareTileFrame(i, j);
50927 }
50928 break;
50929 }
50930 case 15:
50931 case 216:
50932 case 338:
50933 case 390:
50934 if (Main.tile[i, j - 1] == null)
50935 {
50936 Main.tile[i, j - 1] = new Tile();
50937 }
50938 if (Main.tile[i, j] == null)
50939 {
50940 Main.tile[i, j] = new Tile();
50941 }
50942 Place1x2(i, j, (ushort)num, style);
50943 SquareTileFrame(i, j);
50944 break;
50945 case 227:
50946 PlaceDye(i, j, style);
50947 SquareTileFrame(i, j);
50948 break;
50949 case 567:
50950 PlaceGnome(i, j, style);
50951 SquareTileFrame(i, j);
50952 break;
50953 case 16:
50954 case 18:
50955 case 29:
50956 case 103:
50957 case 134:
50958 case 462:
50959 Place2x1(i, j, (ushort)num, style);
50960 SquareTileFrame(i, j);
50961 break;
50962 case 92:
50963 case 93:
50964 case 453:
50965 Place1xX(i, j, (ushort)num, style);
50966 SquareTileFrame(i, j);
50967 break;
50968 case 104:
50969 case 105:
50970 case 320:
50971 case 337:
50972 case 349:
50973 case 356:
50974 case 378:
50975 case 456:
50976 case 506:
50977 case 545:
50978 case 663:
50979 Place2xX(i, j, (ushort)num, style);
50980 SquareTileFrame(i, j);
50981 break;
50982 case 17:
50983 case 77:
50984 case 133:
50985 Place3x2(i, j, (ushort)num, style);
50986 SquareTileFrame(i, j);
50987 break;
50988 case 207:
50989 Place2xX(i, j, (ushort)num, style);
50990 SquareTileFrame(i, j);
50991 break;
50992 case 410:
50993 case 480:
50994 case 509:
50995 case 657:
50996 case 658:
50997 Place2xX(i, j, (ushort)num, style);
50998 SquareTileFrame(i, j);
50999 break;
51000 case 465:
51001 case 531:
51002 case 591:
51003 case 592:
51004 Place2xX(i, j, (ushort)num, style);
51005 SquareTileFrame(i, j);
51006 break;
51007 default:
51008 if (TileID.Sets.BasicChest[num])
51009 {
51010 PlaceChest(i, j, (ushort)num, notNearOtherChests: false, style);
51011 SquareTileFrame(i, j);
51012 break;
51013 }
51014 switch (num)
51015 {
51016 case 91:
51017 PlaceBanner(i, j, (ushort)num, style);
51018 SquareTileFrame(i, j);
51019 break;
51020 case 419:
51021 case 420:
51022 case 423:
51023 case 424:
51024 case 429:
51025 case 445:
51026 PlaceLogicTiles(i, j, num, style);
51027 SquareTileFrame(i, j);
51028 break;
51029 case 36:
51030 case 135:
51031 case 141:
51032 case 144:
51033 case 210:
51034 case 239:
51035 case 324:
51036 case 476:
51037 case 494:
51038 Place1x1(i, j, num, style);
51039 SquareTileFrame(i, j);
51040 break;
51041 case 101:
51042 case 102:
51043 case 463:
51044 Place3x4(i, j, (ushort)num, style);
51045 SquareTileFrame(i, j);
51046 break;
51047 case 464:
51048 case 466:
51049 Place5x4(i, j, (ushort)num, style);
51050 SquareTileFrame(i, j);
51051 break;
51052 case 27:
51053 PlaceSunflower(i, j, 27);
51054 SquareTileFrame(i, j);
51055 break;
51056 case 28:
51057 PlacePot(i, j, 28, genRand.Next(4));
51058 SquareTileFrame(i, j);
51059 break;
51060 case 42:
51061 case 270:
51062 case 271:
51063 Place1x2Top(i, j, (ushort)num, style);
51064 SquareTileFrame(i, j);
51065 break;
51066 case 55:
51067 case 425:
51068 case 510:
51069 case 511:
51070 PlaceSign(i, j, (ushort)num, style);
51071 break;
51072 case 85:
51073 case 376:
51074 Place2x2Horizontal(i, j, (ushort)num, style);
51075 break;
51076 default:
51077 if (Main.tileAlch[num])
51078 {
51079 PlaceAlch(i, j, style);
51080 break;
51081 }
51082 switch (num)
51083 {
51084 case 94:
51085 case 95:
51086 case 97:
51087 case 98:
51088 case 99:
51089 case 100:
51090 case 125:
51091 case 126:
51092 case 172:
51093 case 173:
51094 case 287:
51095 Place2x2(i, j, (ushort)num, style);
51096 break;
51097 case 96:
51098 Place2x2Style(i, j, (ushort)num, style);
51099 break;
51100 case 79:
51101 case 90:
51102 {
51103 int direction = 1;
51104 if (plr > -1)
51105 {
51106 direction = Main.player[plr].direction;
51107 }
51108 Place4x2(i, j, (ushort)num, direction, style);
51109 break;
51110 }
51111 case 209:
51112 PlaceCannon(i, j, (ushort)num, style);
51113 break;
51114 case 81:
51115 tile.frameX = (short)(26 * genRand.Next(6));
51116 tile.active(active: true);
51117 tile.type = (ushort)num;
51118 break;
51119 case 19:
51120 tile.frameY = (short)(18 * style);
51121 tile.active(active: true);
51122 tile.type = (ushort)num;
51123 break;
51124 case 380:
51125 tile.frameY = (short)(18 * style);
51126 tile.active(active: true);
51127 tile.type = (ushort)num;
51128 break;
51129 case 314:
51130 Minecart.PlaceTrack(tile, style);
51131 break;
51132 default:
51133 tile.active(active: true);
51134 tile.type = (ushort)num;
51135 if (Main.tenthAnniversaryWorld && !Main.remixWorld && (num == 53 || num == 396 || num == 397))
51136 {
51137 tile.color(7);
51138 }
51139 break;
51140 }
51141 break;
51142 }
51143 break;
51144 }
51145 }
51146 if (tile.active())
51147 {
51149 {
51150 SquareWallFrame(i, j);
51151 }
51152 SquareTileFrame(i, j);
51153 result = true;
51154 if (!mute)
51155 {
51156 switch (num)
51157 {
51158 case 127:
51159 SoundEngine.PlaySound(SoundID.Item30, i * 16, j * 16);
51160 break;
51161 case 314:
51162 SoundEngine.PlaySound(SoundID.Item52, i * 16, j * 16);
51163 break;
51164 case 330:
51165 case 331:
51166 case 332:
51167 case 333:
51168 SoundEngine.PlaySound(18, i * 16, j * 16);
51169 break;
51170 default:
51171 SoundEngine.PlaySound(0, i * 16, j * 16);
51172 break;
51173 }
51174 if (num == 22 || num == 140)
51175 {
51176 for (int l = 0; l < 3; l++)
51177 {
51178 Dust.NewDust(new Vector2(i * 16, j * 16), 16, 16, 14);
51179 }
51180 }
51181 }
51182 }
51183 }
51184 }
51185 return result;
51186 }
static void PlaySound(int type, Vector2 position, int style=1)
static readonly LegacySoundStyle Item30
Definition SoundID.cs:474
static readonly LegacySoundStyle Item52
Definition SoundID.cs:518
static bool[] ResetsHalfBrickPlacementAttempt
Definition TileID.cs:111
static bool[] BreakableWhenPlacing
Definition TileID.cs:277
static bool[] IsBeam
Definition TileID.cs:161
static bool[] tileMossBrick
Definition TileID.cs:219
static bool[] BlocksWaterDrawingBehindSelf
Definition TileID.cs:259
static bool[] NotReallySolid
Definition TileID.cs:257
static bool[] BasicChest
Definition TileID.cs:223
static bool[] Platforms
Definition TileID.cs:163
static readonly ushort Count
Definition TileID.cs:1698
static bool[] AllowsPlantsToGrow
Definition WallID.cs:50
static readonly ushort Count
Definition WallID.cs:753
static void PlaceChand(int x, int y, ushort type, int style=0)
static void Place6x3(int x, int y, ushort type, int direction=-1, int style=0)
static bool IsTreeType(int tree)
static void Place2x3Wall(int x, int y, ushort type, int style)
static bool remixWorldGen
Definition WorldGen.cs:1148
static volatile bool gen
Definition WorldGen.cs:972
static void PlaceLogicTiles(int x, int y, int type, int style=0)
static bool TopEdgeCanBeAttachedTo(int i, int j)
static void Place3x2(int x, int y, ushort type, int style=0)
static bool HasValidGroundForGlowTulipBelowSpot(int x, int y)
static void PlaceUnderwaterPlant(ushort type, int x, int y)
static bool Place2x2Horizontal(int x, int y, ushort type, int Style=0)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void PlaceSunflower(int x, int y, ushort type=27)
static void Place1x2(int x, int y, ushort type, int style)
static bool PlaceLilyPad(int x, int j)
static void Place4x2(int x, int y, ushort type, int direction=-1, int style=0)
static void PlaceMB(int X, int y, ushort type, int style)
static void PlaceXmasTree(int x, int y, ushort type=171)
static void SquareWallFrame(int i, int j, bool resetFrame=true)
static Point PlaceCatTail(int x, int j)
static void Place3x2Wall(int x, int y, ushort type, int style)
static void Place1x1(int x, int y, int type, int style=0)
static void PlaceCannon(int x, int y, ushort type, int style=0)
static void PlaceJunglePlant(int X2, int Y2, ushort type, int styleX, int styleY)
static void Place2x1(int x, int y, ushort type, int style=0)
static void PlaceDye(int x, int y, int style)
static void PlaceGnome(int x, int y, int style)
static bool PlaceBamboo(int x, int y)
static void Place3x3Wall(int x, int y, ushort type, int style)
static void Place2x2(int x, int y, ushort type, int style)
static bool IsFitToPlaceFlowerIn(int x, int y, int typeAttemptedToPlace)
static bool HasValidGroundForAbigailsFlowerBelowSpot(int x, int y)
static bool PlacePot(int x, int y, ushort type=28, int style=0)
static void PlaceMan(int i, int j, int dir)
static void Place6x4Wall(int x, int y, ushort type, int style)
static bool PlantSeaOat(int x, int y)
static void Place1x2Top(int x, int y, ushort type, int style)
static void Place4x3Wall(int x, int y, ushort type, int style)
static void Place1xX(int x, int y, ushort type, int style=0)
static void Place3x1(int x, int y, ushort type, int style=0)
static void PlaceOnTable1x1(int x, int y, int type, int style=0)
static void Place3x3(int x, int y, ushort type, int style=0)
static bool PlaceObject(int x, int y, int type, bool mute=false, int style=0, int alternate=0, int random=-1, int direction=-1)
static bool PlaceDoor(int i, int j, int type, int style=0)
static bool PlaceAlch(int x, int y, int style)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static bool PlaceSign(int x, int y, ushort type, int Style=0)
static void Place3x4(int x, int y, ushort type, int style)
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static void Place5x4(int x, int y, ushort type, int style)
static void PlaceBanner(int x, int y, ushort type, int style=0)
static void PlaceTight(int x, int y, bool spiders=false)
static void Place2x2Style(int x, int y, ushort type, int style=0)
static void GrowCatTail(int x, int j)
static void Place2xX(int x, int y, ushort type, int style=0)
static int PlaceChest(int x, int y, ushort type=21, bool notNearOtherChests=false, int style=0)
static void PlaceWoman(int i, int j, int dir)

References Terraria.Tile.active(), Terraria.ID.WallID.Sets.AllowsPlantsToGrow, Terraria.ID.TileID.Sets.BasicChest, Terraria.ID.TileID.Sets.BlocksWaterDrawingBehindSelf, Terraria.ID.TileID.Sets.BreakableWhenPlacing, Terraria.Tile.checkingLiquid(), Terraria.Tile.color(), Terraria.ID.TileID.Count, Terraria.ID.WallID.Count, Terraria.Collision.EmptyTile(), Terraria.Tile.halfBrick(), Terraria.ID.TileID.Sets.IsBeam, Terraria.ID.SoundID.Item30, Terraria.ID.SoundID.Item52, Terraria.Tile.liquid, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Dust.NewDust(), Terraria.ID.TileID.Sets.NotReallySolid, Terraria.Minecart.PlaceTrack(), Terraria.ID.TileID.Sets.Platforms, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.remixWorld, Terraria.ID.TileID.Sets.ResetsHalfBrickPlacementAttempt, Terraria.Main.rockLayer, Terraria.Tile.slope(), Terraria.Enums.SolidTile, Terraria.Main.tenthAnniversaryWorld, Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileAlch, Terraria.Main.tileCut, Terraria.Main.tileFrameImportant, Terraria.Main.tileMoss, Terraria.ID.TileID.Sets.tileMossBrick, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, System.type, Terraria.Tile.type, Terraria.Tile.wall, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.

Referenced by Terraria.GameContent.Biomes.DeadMansChestBiome.ActuallyPlaceBoulderTrap(), Terraria.GameContent.Biomes.Desert.DesertHive.AddTileVariance(), Terraria.NPC.AI_003_Fighters(), Terraria.Projectile.AI_155_MysticSnakeCoil(), Terraria.GameContent.Generation.ActionGrass.Apply(), Terraria.GameContent.Generation.ActionPlaceStatue.Apply(), Terraria.WorldBuilding.Actions.PlaceTile.Apply(), Terraria.GameContent.Biomes.CaveHouse.HouseBuilder.FillRooms(), Terraria.WorldGen.Spread.Gem(), Terraria.WorldGen.GenerateWorld(), Terraria.MessageBuffer.GetData(), Terraria.Projectile.Kill(), Terraria.Liquid.LiquidCheck(), Terraria.WorldGen.mayanTrap(), Terraria.GameContent.Biomes.CampsiteBiome.Place(), Terraria.GameContent.Biomes.EnchantedSwordBiome.Place(), Terraria.GameContent.Biomes.MiningExplosivesBiome.Place(), Terraria.GameContent.MinecartDiggerHelper.PlaceATrack(), Terraria.GameContent.Biomes.CaveHouse.HouseBuilder.PlaceBiomeSpecificPriorityTool(), Terraria.GameContent.Biomes.CaveHouse.HouseBuilder.PlaceBiomeSpecificTool(), Terraria.GameContent.Biomes.CaveHouse.HouseBuilder.PlaceDoors(), Terraria.WorldGen.placeLavaTrap(), Terraria.WorldGen.PlaceLiquid(), Terraria.GameContent.Generation.TrackGenerator.PlacePath(), Terraria.WorldGen.PlaceStatueTrap(), Terraria.Player.PlaceThing_Tiles_PlaceIt(), Terraria.WorldGen.placeTNTBarrel(), Terraria.WorldGen.placeTrap(), Terraria.Projectile.SpawnWebs(), Terraria.WorldGen.Spread.Spider(), Terraria.DelegateMethods.SpreadDirt(), Terraria.WorldGen.Statue(), and Terraria.WorldGen.StonePatch().