From e7126210ff61ee308b9cf95a5138829b3d60cf27 Mon Sep 17 00:00:00 2001 From: MrJulsen Date: Sat, 12 Oct 2024 18:57:43 +0200 Subject: [PATCH] Fixed exception --- .vscode/settings.json | 3 ++- .../main/java/de/mrjulsen/crn/registry/ModAccessorTypes.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1b6c0dc1..a1deeb97 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "commentTranslate.hover.enabled": false, - "java.compile.nullAnalysis.mode": "disabled" + "java.compile.nullAnalysis.mode": "disabled", + "java.configuration.updateBuildConfiguration": "automatic" } \ No newline at end of file diff --git a/common/src/main/java/de/mrjulsen/crn/registry/ModAccessorTypes.java b/common/src/main/java/de/mrjulsen/crn/registry/ModAccessorTypes.java index 17d2146a..cb7d3940 100644 --- a/common/src/main/java/de/mrjulsen/crn/registry/ModAccessorTypes.java +++ b/common/src/main/java/de/mrjulsen/crn/registry/ModAccessorTypes.java @@ -862,6 +862,9 @@ public static record DeparturesData(UUID stationTagId, UUID trainId) {} return new DeparturesData(nbt.getUUID("Tag"), nbt.getUUID("Train")); }, (player, in, temp, nbt, iteration) -> { try { + if (!GlobalSettings.getInstance().stationTagExists(in.stationTagId())) { + return false; + } StationTag tag = GlobalSettings.getInstance().getStationTag(in.stationTagId()).get(); ListTag list = new ListTag(); list.addAll(TrainUtils.getDeparturesAt(tag, in.trainId()).stream().map(x -> x.toNbt(true)).toList()); @@ -871,7 +874,7 @@ public static record DeparturesData(UUID stationTagId, UUID trainId) {} } return false; }, (hasMore, data, iteration, nbt) -> { - return nbt.getList(DataAccessorType.DEFAULT_NBT_DATA, Tag.TAG_COMPOUND).stream().map(x -> (ClientTrainStop)ClientTrainStop.fromNbt((CompoundTag)x)).toList(); + return nbt.contains(DataAccessorType.DEFAULT_NBT_DATA) ? nbt.getList(DataAccessorType.DEFAULT_NBT_DATA, Tag.TAG_COMPOUND).stream().map(x -> (ClientTrainStop)ClientTrainStop.fromNbt((CompoundTag)x)).toList() : List.of(); } ));