mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-28 23:39:37 +00:00
Stop the baubles load on any Postea migration failure
This commit is contained in:
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 {
|
||||
|
||||
Reference in new issue
Block a user