diff --git a/ExampleConfiguration.cfg b/ExampleConfiguration.cfg index 1e31581..9c28321 100644 --- a/ExampleConfiguration.cfg +++ b/ExampleConfiguration.cfg @@ -49,6 +49,12 @@ general { # Max: 240 I:HudCachingFPSLimit=20 + # Disable HudCaching in specified dimension IDs. + # Example: 0 for Overworld, -1 for Nether, 1 for The End. + # Use this to avoid render issues in dimensions with custom rendering. + I:HudCachingDimensionBlacklist < + > + # (Client Performance) Modify the data structure of ModelBlock's textures map to improve performance and reduce memory usage. # This feature requires CensoredASM mod. # Known to be incompatible with DynamicTrees. diff --git a/src/main/java/github/kasuminova/stellarcore/client/hudcaching/HUDCaching.java b/src/main/java/github/kasuminova/stellarcore/client/hudcaching/HUDCaching.java index 35467c5..735e9c4 100644 --- a/src/main/java/github/kasuminova/stellarcore/client/hudcaching/HUDCaching.java +++ b/src/main/java/github/kasuminova/stellarcore/client/hudcaching/HUDCaching.java @@ -48,6 +48,14 @@ public static void renderCachedHud(EntityRenderer renderer, GuiIngame ingame, fl ingame.renderGameOverlay(partialTicks); return; } + + if (isCurrentDimensionBlacklisted()) { + dirty = true; + ingame.renderGameOverlay(partialTicks); + renderIGIOverlayIfRequiredWhenBypassed(partialTicks); + return; + } + GlStateManager.enableDepth(); ScaledResolution resolution = new ScaledResolution(MC); int width = resolution.getScaledWidth(); @@ -107,6 +115,31 @@ public static void renderCachedHud(EntityRenderer renderer, GuiIngame ingame, fl } } + private static void renderIGIOverlayIfRequiredWhenBypassed(float partialTicks) { + if (StellarCoreConfig.PERFORMANCE.vanilla.hudCaching && Loader.isModLoaded("ingameinfoxml") && StellarCoreConfig.PERFORMANCE.inGameInfoXML.hudFrameBuffer) { + renderIGIOverlay(partialTicks); + } + } + + private static boolean isCurrentDimensionBlacklisted() { + if (MC.world == null || MC.world.provider == null) { + return false; + } + + int currentDim = MC.world.provider.getDimension(); + int[] blacklist = StellarCoreConfig.PERFORMANCE.vanilla.hudCachingDimensionBlacklist; + if (blacklist == null || blacklist.length == 0) { + return false; + } + + for (int dimId : blacklist) { + if (dimId == currentDim) { + return true; + } + } + return false; + } + @Optional.Method(modid = "ingameinfoxml") private static void renderIGIOverlay(float partialTicks) { igiRendering = true; diff --git a/src/main/java/github/kasuminova/stellarcore/common/config/category/Performance.java b/src/main/java/github/kasuminova/stellarcore/common/config/category/Performance.java index 9a338ab..99ad9a0 100644 --- a/src/main/java/github/kasuminova/stellarcore/common/config/category/Performance.java +++ b/src/main/java/github/kasuminova/stellarcore/common/config/category/Performance.java @@ -134,6 +134,14 @@ public static class Vanilla { @Config.Name("HudCachingFPSLimit") public int hudCachingFPSLimit = 20; + @Config.Comment({ + "Disable HudCaching in specified dimension IDs.", + "Example: 0 for Overworld, -1 for Nether, 1 for The End.", + "Use this to avoid render issues in dimensions with custom rendering." + }) + @Config.Name("HudCachingDimensionBlacklist") + public int[] hudCachingDimensionBlacklist = {}; + @Config.Comment({ "(Client Performance | Experimental) A feature that helps speed up game loading by modifying the model loader's code to enable parallel loading capabilities (5s ~ 40s faster).", "Incompatible with some mod's models because they use their own model loader, if you encounter a missing model, please report it to the StellarCore author for manual compatibility.",