diff --git a/api/src/main/java/com/seibel/distanthorizons/api/enums/config/ELodShading.java b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/ELodShading.java new file mode 100644 index 000000000..2c14a8874 --- /dev/null +++ b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/ELodShading.java @@ -0,0 +1,37 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 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.api.enums.config; + +/** + * MINECRAFT
+ * OLD_LIGHTING
+ * NONE
+ */ +public enum ELodShading +{ + // Reminder: + // when adding items up the API minor version + // when removing items up the API major version + + MINECRAFT, + OLD_LIGHTING, + NONE; + +} 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 de463329d..4a8bba8af 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 @@ -586,6 +586,20 @@ public class Config + "If set to 0 the mod wont overwrite vanilla's default (which so happens to also be 0)") .build(); + public static ConfigEntry lodShading = new ConfigEntry.Builder() + .set(ELodShading.MINECRAFT) + .comment("" + + "How should LODs be shaded? \n" + + "\n" + + ELodShading.MINECRAFT + ": Uses the same side shading as vanilla Minecraft blocks. \n" + + ELodShading.OLD_LIGHTING + ": Simulates Minecraft's block shading for LODs. \n" + + " Can be used to force LOD shading when using some shaders. \n" + + ELodShading.NONE + ": All LOD sides will be rendered with the same brightness. \n" + + "") + .setPerformance(EConfigEntryPerformance.NONE) + .addListener(RenderCacheConfigEventHandler.INSTANCE) + .build(); + } } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/RenderCacheConfigEventHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/RenderCacheConfigEventHandler.java index a88979cf2..8bbca7f0c 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/RenderCacheConfigEventHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/RenderCacheConfigEventHandler.java @@ -1,6 +1,7 @@ package com.seibel.distanthorizons.core.config.eventHandlers; import com.seibel.distanthorizons.api.DhApi; +import com.seibel.distanthorizons.api.enums.config.ELodShading; import com.seibel.distanthorizons.api.enums.config.EMaxHorizontalResolution; import com.seibel.distanthorizons.api.enums.config.EVerticalQuality; import com.seibel.distanthorizons.core.config.listeners.IConfigListener; @@ -22,6 +23,7 @@ public class RenderCacheConfigEventHandler implements IConfigListener // previous values used to check if a watched setting was actually modified private EVerticalQuality previousVerticalQualitySetting = null; private EMaxHorizontalResolution previousHorizontalResolution = null; + private ELodShading lodShading = null; /** how long to wait in milliseconds before applying the config changes */ private static final long TIMEOUT_IN_MS = 400L; @@ -54,6 +56,13 @@ public class RenderCacheConfigEventHandler implements IConfigListener refreshRenderData = true; } + ELodShading newLodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get(); + if (this.lodShading != newLodShading) + { + this.lodShading = newLodShading; + refreshRenderData = true; + } + if (refreshRenderData)