From 37deed0892273984c78e6e3d4e95d8d34b80dca5 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 12 May 2025 15:12:57 -0400 Subject: [PATCH] Fixed vanilla bug of Gold Chests being able to have Meteorite Bars --- Systems/World/WorldgenManagementSystem.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index e357914007..5ac2aaec96 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -487,6 +487,20 @@ namespace CalamityMod.Systems } } + // Fix vanilla's stupidity with Gold Chests being able to have Meteorite Bars in them near the Underworld + if (isGoldChest) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].type == ItemID.MeteoriteBar) + { + int oldStack = chest.item[inventoryIndex].stack; + chest.item[inventoryIndex].SetDefaults(WorldGen.genRand.NextBool() ? ItemID.PlatinumBar : ItemID.GoldBar); + chest.item[inventoryIndex].stack = oldStack; + } + } + } + // Give Dead Man's Chests better loot. if (isDeadManChest) {