From 47315c14527a4e017bc857f376906cd00f821355 Mon Sep 17 00:00:00 2001 From: Abel Date: Sun, 15 Dec 2024 21:52:43 +0100 Subject: [PATCH] add little road data setup --- .../mojangmaps/common/MojangMaps.java | 6 ++++-- .../mojangmaps/common/config/roads/RoadData.java | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/MojangMaps.java b/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/MojangMaps.java index 9d53911..5a7b92b 100644 --- a/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/MojangMaps.java +++ b/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/MojangMaps.java @@ -20,6 +20,7 @@ import java.util.List; import net.minecraft.DetectedVersion; +import nl.abelkrijgtalles.mojangmaps.common.config.roads.RoadData; import nl.abelkrijgtalles.mojangmaps.common.platform.LoaderInfo; import nl.abelkrijgtalles.mojangmaps.common.platform.config.ConfigItem; import nl.abelkrijgtalles.mojangmaps.common.platform.config.ConfigObject; @@ -35,9 +36,10 @@ public class MojangMaps { public static void init(LoaderInfo loaderInfo) { MojangMaps.loaderInfo = loaderInfo; - LOGGER.info("Running Mojang Maps on Minecraft version {}.", DetectedVersion.tryDetectVersion().getName()); - LOGGER.info(loaderInfo.getConfig().get("message")); + + RoadData roadData = new RoadData(); + if (!loaderInfo.isRunningTests()) roadData.setupRoadData(); } diff --git a/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/config/roads/RoadData.java b/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/config/roads/RoadData.java index 4f98666..88ce5a4 100644 --- a/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/config/roads/RoadData.java +++ b/common/src/main/java/nl/abelkrijgtalles/mojangmaps/common/config/roads/RoadData.java @@ -322,4 +322,16 @@ private byte[] convertByteListToArray(List byteList) { } + public List setupRoadData() { + + if (FILE_PATH.toFile().exists()) return readRoadData(); + else { + + generateRoadData(new ArrayList<>()); + return new ArrayList<>(); + + } + + } + }