From b3c98b60be6404aa44815834c3f1b380cd1067cd Mon Sep 17 00:00:00 2001 From: Ruling-0 <47913168+Ruling-0@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:54:19 -0600 Subject: [PATCH] Stop the baubles load on any Postea migration failure --- .../java/baubles/common/lib/PlayerHandler.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/baubles/common/lib/PlayerHandler.java b/src/main/java/baubles/common/lib/PlayerHandler.java index 688c37e..200b3cb 100644 --- a/src/main/java/baubles/common/lib/PlayerHandler.java +++ b/src/main/java/baubles/common/lib/PlayerHandler.java @@ -12,6 +12,7 @@ import com.google.common.io.Files; import baubles.common.Baubles; import baubles.common.container.InventoryBaubles; +import net.minecraft.crash.CrashReport; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; @@ -139,7 +140,7 @@ public class PlayerHandler { } if(data != null) { - PosteaCompat.transform("baubles:" + player.getCommandSenderName(), data); + migrate(player.getCommandSenderName(), data); InventoryBaubles inventory = new InventoryBaubles(player); inventory.readNBT(data); inventory.savedStamps = PosteaCompat.savedStamps(data); @@ -158,6 +159,17 @@ public class PlayerHandler { } } + /// Runs a player's bauble root through Postea, turning any failure into a [ReportedException]. + private static void migrate(String playerName, NBTTagCompound data) { + try { + PosteaCompat.transform("baubles:" + playerName, data); + } catch (ReportedException migrationException) { + throw migrationException; + } catch (RuntimeException migrationException) { + throw new ReportedException(CrashReport.makeCrashReport(migrationException, "Migrating baubles of " + playerName)); + } + } + public static void savePlayerBaubles(EntityPlayer player, File mainFile, File backupFile) { if(player != null && !player.worldObj.isRemote && !failedMigrations.contains(player.getCommandSenderName())) { try {