From a49d74763a1862df7c252980b5f89116333bfe45 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 7 Jan 2025 20:30:29 -0600 Subject: [PATCH] Add quick config to show/hide world gen progress --- .../distanthorizons/core/config/Config.java | 6 ++ ...howWorldGenProgressConfigEventHandler.java | 62 +++++++++++++++++++ .../assets/distanthorizons/lang/en_us.json | 5 ++ 3 files changed, 73 insertions(+) create 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 4990778d3..deb53f228 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 @@ -106,6 +106,11 @@ public class Config public static ConfigUiLinkedEntry quickEnableWorldGenerator = new ConfigUiLinkedEntry(Common.WorldGenerator.enableDistantGeneration); + public static ConfigEntry quickShowWorldGenProgress = new ConfigEntry.Builder() + .set(true) + .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) + .build(); + public static ConfigUiLinkedEntry quickLodCloudRendering = new ConfigUiLinkedEntry(Advanced.Graphics.GenericRendering.enableCloudRendering); public static ConfigEntry showDhOptionsButtonInMinecraftUi = new ConfigEntry.Builder() @@ -1653,6 +1658,7 @@ public class Config ThreadPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); RenderQualityPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); QuickRenderToggleConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); + QuickShowWorldGenProgressConfigEventHandler.INSTANCE.setUiOnlyConfigValues(); RenderCacheConfigEventHandler.getInstance(); } 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 new file mode 100644 index 000000000..ece8c5ff0 --- /dev/null +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/QuickShowWorldGenProgressConfigEventHandler.java @@ -0,0 +1,62 @@ +/* + * This file is part of the Distant Horizons mod + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2023 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) -> + { + Config.Common.WorldGenerator.showGenerationProgress.set(Config.Client.quickShowWorldGenProgress.get() + ? Config.Common.WorldGenerator.showGenerationProgress.getDefaultValue() + : EDhApiDistantGeneratorProgressDisplayLocation.DISABLED); + }); + this.fullChangeListener = new ConfigChangeListener<>(Config.Common.WorldGenerator.showGenerationProgress, + (val) -> + { + Config.Client.quickShowWorldGenProgress.set(Config.Common.WorldGenerator.showGenerationProgress.get() != EDhApiDistantGeneratorProgressDisplayLocation.DISABLED); + }); + } + + /** + * Set the UI only config based on what is set in the file.
+ * This should only be called once. + */ + public void setUiOnlyConfigValues() + { + Config.Client.quickEnableRendering.set(Config.Common.WorldGenerator.showGenerationProgress.get() != EDhApiDistantGeneratorProgressDisplayLocation.DISABLED); + } + +} diff --git a/core/src/main/resources/assets/distanthorizons/lang/en_us.json b/core/src/main/resources/assets/distanthorizons/lang/en_us.json index f98ef3b3e..c1580d8b2 100644 --- a/core/src/main/resources/assets/distanthorizons/lang/en_us.json +++ b/core/src/main/resources/assets/distanthorizons/lang/en_us.json @@ -60,6 +60,11 @@ "distanthorizons.config.client.quickEnableRendering.@tooltip": "Determines if Distant Horizons Renders LODs.", + "distanthorizons.config.client.quickShowWorldGenProgress": + "Show LOD Gen/Import Progress", + "distanthorizons.config.client.quickShowWorldGenProgress.@tooltip": + "If true then the world gen/importing progress will be displayed on the screen when running.", + "distanthorizons.config.client.qualityPresetSetting": "Quality Preset", "distanthorizons.config.client.qualityPresetSetting.@tooltip":