diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index de4c20721f..01b2d39e53 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { + // TODO -- WHY IS THIS IN PLACEABLES. IT IS A CRAFTING MATERIAL FIRST AND FOREMOST. public class AstralBar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; diff --git a/Tiles/AerialiteBarTile.cs b/Tiles/AerialiteBarTile.cs index 6c2bfd4cc5..afc5b1b830 100644 --- a/Tiles/AerialiteBarTile.cs +++ b/Tiles/AerialiteBarTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(141, 232, 246)); + this.SetUpBar(ModContent.ItemType(), new Color(141, 232, 246)); DustType = 187; } diff --git a/Tiles/AstralBar.cs b/Tiles/AstralBar.cs index 8cc8d6577d..afea8bce93 100644 --- a/Tiles/AstralBar.cs +++ b/Tiles/AstralBar.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(47, 66, 90)); + this.SetUpBar(ModContent.ItemType(), new Color(47, 66, 90)); DustType = ModContent.DustType(); } diff --git a/Tiles/AuricTeslaBar.cs b/Tiles/AuricTeslaBar.cs index 68b49adea4..f854b1b60f 100644 --- a/Tiles/AuricTeslaBar.cs +++ b/Tiles/AuricTeslaBar.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(255, 227, 81)); + this.SetUpBar(ModContent.ItemType(), new Color(255, 227, 81)); DustType = ModContent.DustType(); } diff --git a/Tiles/ChaoticBarPlaced.cs b/Tiles/ChaoticBarPlaced.cs index 9f33e3ba35..e1741bd4ac 100644 --- a/Tiles/ChaoticBarPlaced.cs +++ b/Tiles/ChaoticBarPlaced.cs @@ -1,15 +1,16 @@ +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Tiles { + // TODO -- this name is inconsistent with all other placed bars, and needs to be updated for Scoria public class ChaoticBarPlaced : ModTile { public override void SetStaticDefaults() { - this.SetUpBar(new Color(255, 165, 0)); + this.SetUpBar(ModContent.ItemType(), new Color(255, 165, 0)); DustType = 87; } diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs index 59ea44ac4e..ec0f584276 100644 --- a/Tiles/CosmiliteBarTile.cs +++ b/Tiles/CosmiliteBarTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(229, 141, 246)); + this.SetUpBar(ModContent.ItemType(), new Color(229, 141, 246)); DustType = ModContent.DustType(); } diff --git a/Tiles/CryonicBarTile.cs b/Tiles/CryonicBarTile.cs index dab99d2ce2..41266fdccb 100644 --- a/Tiles/CryonicBarTile.cs +++ b/Tiles/CryonicBarTile.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(138, 43, 226)); + this.SetUpBar(ModContent.ItemType(), new Color(138, 43, 226)); DustType = 44; } diff --git a/Tiles/PerennialBar.cs b/Tiles/PerennialBar.cs index 68a24439f2..2fb85c5bcc 100644 --- a/Tiles/PerennialBar.cs +++ b/Tiles/PerennialBar.cs @@ -1,7 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -using CalamityMod.Items.Materials; namespace CalamityMod.Tiles { @@ -9,7 +8,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(157, 255, 0)); + this.SetUpBar(ModContent.ItemType(), new Color(157, 255, 0)); DustType = 44; } diff --git a/Tiles/ShadowspecBarTile.cs b/Tiles/ShadowspecBarTile.cs index 914ca3ed70..ca459eab3e 100644 --- a/Tiles/ShadowspecBarTile.cs +++ b/Tiles/ShadowspecBarTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(128, 41, 149)); + this.SetUpBar(ModContent.ItemType(), new Color(128, 41, 149)); DustType = ModContent.DustType(); } diff --git a/Tiles/UelibloomBar.cs b/Tiles/UelibloomBar.cs index 288c3ec736..03cdef8a10 100644 --- a/Tiles/UelibloomBar.cs +++ b/Tiles/UelibloomBar.cs @@ -1,5 +1,4 @@ -using CalamityMod.Dusts.Furniture; -using CalamityMod.Items.Materials; +using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -10,7 +9,7 @@ namespace CalamityMod.Tiles { public override void SetStaticDefaults() { - this.SetUpBar(new Color(134, 209, 102)); + this.SetUpBar(ModContent.ItemType(), new Color(134, 209, 102)); DustType = ModContent.DustType(); } diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index af5a846ead..2a19019bc8 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -679,6 +679,32 @@ namespace CalamityMod } } + /// + /// Extension which initializes a ModTile to be a bar. + /// + /// The ModTile which is being initialized. + /// The ID of the item this tile drops when broken. + /// The color of the bar on the minimap. + /// Whether this tile is supposed to be immune to lava. Defaults to true like vanilla bars. + internal static void SetUpBar(this ModTile mt, int itemDropID, Color mapColor, bool lavaImmune = true) + { + mt.RegisterItemDrop(itemDropID); + + Main.tileShine[mt.Type] = 1100; + Main.tileSolid[mt.Type] = true; + Main.tileSolidTop[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; + TileObjectData.addTile(mt.Type); + + // Vanilla bars are labeled as "Metal Bar" on the minimap + mt.AddMapEntry(mapColor, Language.GetText("MapObject.MetalBar")); + } + /// /// Extension which initializes a ModTile to be a bathtub. /// @@ -1503,29 +1529,6 @@ namespace CalamityMod mt.AdjTiles = new int[] { TileID.WorkBenches }; } - /// - /// Extension which initializes a ModTile to be a bar. - /// - /// The ModTile which is being initialized. - /// The color of the bar on the minimap. - /// Whether this tile is supposed to be immune to lava. Defaults to true like vanilla bars. - internal static void SetUpBar(this ModTile mt, Color mapColor, bool lavaImmune = true) - { - Main.tileShine[mt.Type] = 1100; - Main.tileSolid[mt.Type] = true; - Main.tileSolidTop[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; - TileObjectData.addTile(mt.Type); - - // Vanilla bars are labeled as "Metal Bar" on the minimap - mt.AddMapEntry(mapColor, Language.GetText("MapObject.MetalBar")); - } - /// /// Extension which initializes a ModTile to be a trophy. ///