From ec0e647597a4012c6062a579b048ba5c6482a1c3 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 20 Sep 2024 01:07:02 +0300 Subject: [PATCH] change export directory and bump ver --- gradle.properties | 2 +- .../java/com/adamcalculator/cheststofox/ChestsToFox.java | 7 +++---- .../java/com/adamcalculator/cheststofox/Command.java | 2 +- src/client/java/com/adamcalculator/cheststofox/Config.java | 7 ++++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 596d8a7..ea918b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10 loader_version=0.15.3 # Mod Properties -mod_version=1.2 +mod_version=1.2.1 maven_group=com.adamcalculator.pawville archives_base_name=cheststofox diff --git a/src/client/java/com/adamcalculator/cheststofox/ChestsToFox.java b/src/client/java/com/adamcalculator/cheststofox/ChestsToFox.java index 8c7ace2..0f3bfda 100644 --- a/src/client/java/com/adamcalculator/cheststofox/ChestsToFox.java +++ b/src/client/java/com/adamcalculator/cheststofox/ChestsToFox.java @@ -30,13 +30,12 @@ import java.util.TimerTask; public class ChestsToFox implements ClientModInitializer { - public static final int CHESTS_TO_FOX_VERSION_BUILD = 25; - public static final String CHESTS_TO_FOX_VERSION_NAME = "1.2"; + public static final int CHESTS_TO_FOX_VERSION_BUILD = 26; + public static final String CHESTS_TO_FOX_VERSION_NAME = "1.2.1"; public static final Logger LOGGER = LoggerFactory.getLogger("ChestsToFox"); public static final ContainerLinker CONTAINER_LINKER = new ContainerLinker(); - public static final String DIR = "config/cheststofox"; private static final Timer timer = new Timer(); @@ -102,7 +101,7 @@ private ActionResult clickedToBlock(World world, BlockHitResult hitResult) { } public static File getExportsDir() { - return new File(MinecraftClient.getInstance().runDirectory, DIR); + return new File(Config.CONFIG.workdir.replace("%MINECRAFT%", MinecraftClient.getInstance().runDirectory.getAbsolutePath())); } public static String getCurrentNameOfExportFile() { diff --git a/src/client/java/com/adamcalculator/cheststofox/Command.java b/src/client/java/com/adamcalculator/cheststofox/Command.java index 7a7e5fb..dcf671c 100644 --- a/src/client/java/com/adamcalculator/cheststofox/Command.java +++ b/src/client/java/com/adamcalculator/cheststofox/Command.java @@ -156,7 +156,7 @@ private static void genericExport(CommandContext cont final String filename = ChestsToFox.getCurrentNameOfExportFile(); final File file = new File(ChestsToFox.getExportsDir(), filename); Files.writeFile(file, exportedString); - Text filetext = Text.literal(ChestsToFox.DIR + "/" + file.getName()) + Text filetext = Text.literal(Config.CONFIG.workdir.replace("%MINECRAFT%", ".minecraft") + "/" + file.getName()) .formatted(Formatting.UNDERLINE, Formatting.ITALIC, Formatting.DARK_GREEN) .styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, ChestsToFox.getExportsDir().getAbsolutePath()))); diff --git a/src/client/java/com/adamcalculator/cheststofox/Config.java b/src/client/java/com/adamcalculator/cheststofox/Config.java index 70eb087..6bda5c7 100644 --- a/src/client/java/com/adamcalculator/cheststofox/Config.java +++ b/src/client/java/com/adamcalculator/cheststofox/Config.java @@ -20,7 +20,12 @@ public class Config { @SerializedName("auto_close_guis") public boolean autoCloseWhenSaving = false; - public transient int autoCloseWhenSavingDelay = 200; + + @SerializedName("auto_close_delay") + public int autoCloseWhenSavingDelay = 200; + + @SerializedName("work_dir") + public String workdir = "%MINECRAFT%/config/cheststofox"; public boolean isSaving() { return savingEnable;