diff --git a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java index 0132b8a863..98d3bae1aa 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java @@ -1094,4 +1094,8 @@ public static boolean isInTranslucentBlockOutlinePass(Level level, BlockPos pos, ChunkRenderTypeSet renderTypes = model.getRenderTypes(state, OUTLINE_PASS_RANDOM, level.getModelData(pos)); return renderTypes.contains(RenderType.TRANSLUCENT) || renderTypes.contains(RenderType.TRIPWIRE); } + + public static void reloadRenderer() { + Minecraft.getInstance().levelRenderer.allChanged(); + } } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java index 91a232a8ae..696fa0728d 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java @@ -8,6 +8,7 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.Logging; import net.neoforged.fml.event.config.ModConfigEvent; +import net.neoforged.neoforge.client.ClientHooks; import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue; import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; import org.apache.commons.lang3.tuple.Pair; @@ -84,6 +85,7 @@ public static class Common { */ public static class Client { public final BooleanValue experimentalForgeLightPipelineEnabled; + boolean experimentalPipelineActive; public final BooleanValue showLoadWarnings; @@ -134,11 +136,23 @@ public static class Client { @SubscribeEvent public static void onLoad(final ModConfigEvent.Loading configEvent) { LogManager.getLogger().debug(Logging.FORGEMOD, "Loaded NeoForge config file {}", configEvent.getConfig().getFileName()); + + if (configEvent.getConfig().getSpec() == clientSpec) { + CLIENT.experimentalPipelineActive = CLIENT.experimentalForgeLightPipelineEnabled.getAsBoolean(); + } } @SubscribeEvent public static void onFileChange(final ModConfigEvent.Reloading configEvent) { LogManager.getLogger().debug(Logging.FORGEMOD, "NeoForge config just got changed on the file system!"); + + if (configEvent.getConfig().getSpec() == clientSpec) { + boolean experimentalPipelineActive = CLIENT.experimentalForgeLightPipelineEnabled.getAsBoolean(); + if (experimentalPipelineActive != CLIENT.experimentalPipelineActive) { + CLIENT.experimentalPipelineActive = experimentalPipelineActive; + ClientHooks.reloadRenderer(); + } + } } //General