aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/io')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
index d7c10dc1..3a7c69be 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
@@ -29,6 +29,7 @@ import io.github.moulberry.notenoughupdates.util.Utils
import io.github.moulberry.notenoughupdates.util.kotlin.KSerializable
import io.github.moulberry.notenoughupdates.util.stripControlCodes
import net.minecraft.inventory.ContainerChest
+import net.minecraft.util.EnumChatFormatting
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.io.File
@@ -51,7 +52,12 @@ object MuseumTooltipManager {
var data = MuseumData()
if (file.exists()) {
val content = file.readText()
- data = Gson().fromJson(content, MuseumData::class.java)
+ val loadedData = Gson().fromJson(content, MuseumData::class.java)
+ if (loadedData != null) {
+ data = loadedData
+ } else {
+ Utils.addChatMessage("${EnumChatFormatting.RED}${EnumChatFormatting.BOLD}[NEU] Error while reading existing museum data, resetting.")
+ }
} else {
file.createNewFile()
file.writeText(Gson().toJson(data))