diff options
| author | Linnea Gräf <nea@nea.moe> | 2024-03-17 16:55:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-17 16:55:09 +0100 |
| commit | cde383d3af47532b62bd8aa13b57f962b43ad55d (patch) | |
| tree | 269c668fb5683e2cfc03103c4484319bec692921 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java | |
| parent | 7ce1b9dce8785fbe6a52ccc3030bf9afd1753fb4 (diff) | |
| download | notenoughupdates-cde383d3af47532b62bd8aa13b57f962b43ad55d.tar.gz notenoughupdates-cde383d3af47532b62bd8aa13b57f962b43ad55d.tar.bz2 notenoughupdates-cde383d3af47532b62bd8aa13b57f962b43ad55d.zip | |
Add /ec warning to storage overlay (#1053)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 985ed11a..48968e29 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -175,15 +175,20 @@ public class StorageManager { } private static void fixPetInfo(ItemStack src) { - if (src.getTagCompound() == null || !src.getTagCompound().hasKey("ExtraAttributes") || !src.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("petInfo")) return; - PetInfo oldPetInfo = GSON.fromJson(src.getTagCompound().getCompoundTag("ExtraAttributes").getString("petInfo"), PetInfo.class); + if (src.getTagCompound() == null || !src.getTagCompound().hasKey("ExtraAttributes") || + !src.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("petInfo")) return; + PetInfo oldPetInfo = GSON.fromJson( + src.getTagCompound().getCompoundTag("ExtraAttributes").getString("petInfo"), + PetInfo.class + ); src.getTagCompound().getCompoundTag("ExtraAttributes").removeTag("petInfo"); try { src.getTagCompound().getCompoundTag("ExtraAttributes").setTag( "petInfo", JsonToNBT.getTagFromJson(oldPetInfo.toString()) ); - } catch (NBTException | NullPointerException ignored) {} + } catch (NBTException | NullPointerException ignored) { + } } private static JsonElement loadJson(NBTBase tag) { |
