public override void PlaceInWorld(int i, int j, Item item) { BEPlayer mp = Main.LocalPlayer.GetModPlayer <BEPlayer>(); HelperMethods.MirrorPlacement(i, j, item.type); if (!mp.PlacementAnywhere) { return; } //I'm hardcoding this since vanilla also hardcodes their shitty frameX changes int[] directionFraming = new int[] { TileID.Chairs, TileID.Bathtubs, TileID.Beds, TileID.Mannequin, TileID.Womannequin //+ any other tile that mirrors with player direction }; Tile tile = Framing.GetTileSafely(i, j); TileObjectData data = TileObjectData.GetTileData(tile); if (directionFraming.Contains(item.createTile)) { HelperMethods.ChangeTileFraming(i, j, Main.LocalPlayer.direction == 1); } }
internal static Tile PlaceTile(int i, int j, ItemTypes itemTypes, int type, bool forced = false, bool sync = true, int placeStyle = -1) { if (type == 0 || !ValidTileCoordinates(i, j) || Framing.GetTileSafely(i, j).active()) { return(new Tile()); } Item item = new Item(); item.SetDefaults(type); Tile tile = Framing.GetTileSafely(i, j); TileObjectData data = TileObjectData.GetTileData(item.createTile, item.placeStyle); if (data != null) { return(PlaceMultiTile(i, j, type, forced, sync, placeStyle)); } if ((itemTypes == HelperMethods.ItemTypes.Tile && tile.active() && tile.collisionType != -1) || (itemTypes == HelperMethods.ItemTypes.Wall && tile.wall != 0) || !CanReduceItemStack(type, reduceStack: false)) { return(new Tile()); } if (forced && tile.collisionType == -1 && tile.type != TileID.DemonAltar && tile.type != 21) { RemoveTile(i, j, dropItem: false); } CanReduceItemStack(type); //We know it's true since it passed the condition above switch (itemTypes) { case ItemTypes.Air: break; case ItemTypes.Tile: if (placeStyle == -1) { placeStyle = item.placeStyle; } WorldGen.PlaceTile(i, j, item.createTile, forced: forced, style: placeStyle); break; case ItemTypes.Wall: WorldGen.PlaceWall(i, j, item.createWall); break; } if (sync && Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendTileSquare(-1, i, j, 1); } //Attempts to mirror it in case there's a mirror wand selection HelperMethods.MirrorPlacement(i, j, item.type); //TODO: Compensate for vanilla's wall auto placement? (might want to make a separate PlaceWall for that) return(Framing.GetTileSafely(i, j)); }
public override void PlaceInWorld(int i, int j, int type, Item item) { item.consumable = !Main.LocalPlayer.GetModPlayer <BEPlayer>().InfinitePlacement; HelperMethods.MirrorPlacement(i, j, item.type); }