Stop the baubles load on any Postea migration failure

This commit is contained in:
Ruling-0 committed 2026-11-24 15:54:19 -06:00
1 parent 3c349544a5
commit b3c98b60be
1 file changed
+13 -1
@@ -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 {