From 5ca754d2ac1e65c4b800194a9fd1350232d5ab2c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 6 Dec 2025 09:18:34 -0600 Subject: [PATCH] Fix world gen progress config resetting on reboot --- .../distanthorizons/core/config/Config.java | 6 +- ...howWorldGenProgressConfigEventHandler.java | 66 ------------------- 2 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/QuickShowWorldGenProgressConfigEventHandler.java diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index 6b7e8d58d..ef7851f9d 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -103,10 +103,7 @@ public class Config public static ConfigUiLinkedEntry quickEnableWorldGenerator = new ConfigUiLinkedEntry(Common.WorldGenerator.enableDistantGeneration); - public static ConfigEntry quickShowWorldGenProgress = new ConfigEntry.Builder() - .set(false) // TODO should be set by the underlying world gen progress button, not a static default - .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) - .build(); + public static ConfigUiLinkedEntry quickShowWorldGenProgress = new ConfigUiLinkedEntry(Common.WorldGenerator.showGenerationProgress); public static ConfigUiLinkedEntry quickLodCloudRendering = new ConfigUiLinkedEntry(Advanced.Graphics.GenericRendering.enableCloudRendering); @@ -1835,7 +1832,6 @@ public class Config ThreadPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); RenderQualityPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); QuickRenderToggleConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); - QuickShowWorldGenProgressConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); } catch (Exception e) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/QuickShowWorldGenProgressConfigEventHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/QuickShowWorldGenProgressConfigEventHandler.java deleted file mode 100644 index 9d80e9c1b..000000000 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/QuickShowWorldGenProgressConfigEventHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.core.config.eventHandlers.presets; - -import com.seibel.distanthorizons.api.enums.rendering.EDhApiRendererMode; -import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGeneratorProgressDisplayLocation; -import com.seibel.distanthorizons.core.config.Config; -import com.seibel.distanthorizons.core.config.listeners.ConfigChangeListener; - -public class QuickShowWorldGenProgressConfigEventHandler -{ - public static QuickShowWorldGenProgressConfigEventHandler INSTANCE = new QuickShowWorldGenProgressConfigEventHandler(); - - private final ConfigChangeListener quickChangeListener; - private final ConfigChangeListener fullChangeListener; - - - - /** private since we only ever need one handler at a time */ - private QuickShowWorldGenProgressConfigEventHandler() - { - this.quickChangeListener = new ConfigChangeListener<>(Config.Client.quickShowWorldGenProgress, - (val) -> - { - boolean quickShowProgress = Config.Client.quickShowWorldGenProgress.get(); - Config.Common.WorldGenerator.showGenerationProgress.set( - quickShowProgress - ? EDhApiDistantGeneratorProgressDisplayLocation.OVERLAY - : EDhApiDistantGeneratorProgressDisplayLocation.DISABLED); - }); - this.fullChangeListener = new ConfigChangeListener<>(Config.Common.WorldGenerator.showGenerationProgress, - (val) -> - { - boolean showProgress = Config.Common.WorldGenerator.showGenerationProgress.get() != EDhApiDistantGeneratorProgressDisplayLocation.DISABLED; - Config.Client.quickShowWorldGenProgress.setWithoutFiringEvents(showProgress); - }); - } - - /** - * Set the UI only config based on what is set in the file.
- * This should only be called once. - */ - public void setUiOnlyConfigValues() - { - boolean showProgress = Config.Common.WorldGenerator.showGenerationProgress.get() != EDhApiDistantGeneratorProgressDisplayLocation.DISABLED; - Config.Client.quickShowWorldGenProgress.set(showProgress); - } - -}