diff options
author | makamys <makamys@outlook.com> | 2024-01-20 13:49:13 +0100 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2024-01-20 13:49:13 +0100 |
commit | 3a842c2a02a69530a9886048281cfeaf1b513320 (patch) | |
tree | 41310ee70536b51d45f7c974e1bf248d7043ff7c | |
parent | 7da5fb9ed13688800e3ffd52f1dddeaba6d997cf (diff) | |
download | Neodymium-3a842c2a02a69530a9886048281cfeaf1b513320.tar.gz Neodymium-3a842c2a02a69530a9886048281cfeaf1b513320.tar.bz2 Neodymium-3a842c2a02a69530a9886048281cfeaf1b513320.zip |
Fix #44
-rw-r--r-- | src/main/java/makamys/neodymium/Compat.java | 29 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 5 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/Compat.java b/src/main/java/makamys/neodymium/Compat.java index 40feb47..452a187 100644 --- a/src/main/java/makamys/neodymium/Compat.java +++ b/src/main/java/makamys/neodymium/Compat.java @@ -27,6 +27,8 @@ public class Compat { private static boolean IS_RPLE_PRESENT; private static boolean IS_FALSE_TWEAKS_PRESENT; + + private static boolean IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED; private static boolean isShadersEnabled; @@ -44,6 +46,28 @@ public class Compat { if (Loader.isModLoaded("falsetweaks")) { IS_FALSE_TWEAKS_PRESENT = true; } + + IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED = checkIfHodgepodgeSpeedupAnimationsIsEnabled(); + } + + private static boolean checkIfHodgepodgeSpeedupAnimationsIsEnabled() { + boolean result = false; + if (Loader.isModLoaded("hodgepodge")) { + try { + Class<?> CommonCls = Class.forName("com.mitchej123.hodgepodge.Common"); + Object config = CommonCls.getField("config").get(null); + Class<?> configCls = config.getClass(); + boolean speedupAnimations = (Boolean)configCls.getField("speedupAnimations").get(config); + LOGGER.debug("Hodgepodge's speedupAnimations is set to " + speedupAnimations); + result = speedupAnimations; + } catch(Exception e) { + LOGGER.warn("Failed to determine if Hodgepodge's speedupAnimations is enabled, assuming false"); + } + } else { + LOGGER.debug("Hodgepodge is missing, treating speedupAnimations as false"); + } + LOGGER.debug("Compat fix will " + (result ? "" : "not") + " be enabled"); + return result; } public static boolean isRPLEModPresent() { @@ -53,7 +77,10 @@ public class Compat { public static boolean isFalseTweaksModPresent() { return IS_FALSE_TWEAKS_PRESENT; } - + + public static boolean isHodgepodgeSpeedupAnimationsEnabled() { + return IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED; + } public static boolean isOptiFineShadersEnabled() { return isShadersEnabled; diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index 8eb3e0e..3f45b61 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -5,6 +5,7 @@ import com.falsepattern.rple.api.client.RPLELightMapUtil; import com.falsepattern.rple.api.client.RPLEShaderConstants; import lombok.val; import makamys.neodymium.Compat; +import makamys.neodymium.Constants; import makamys.neodymium.Neodymium; import makamys.neodymium.config.Config; import makamys.neodymium.ducks.IWorldRenderer; @@ -205,6 +206,10 @@ public class NeoRenderer { for (int j = piCount[i].position() - meshes; j < piCount[i].position(); j++) { renderedQuads += piCount[i].get(j) / 4; } + if(Compat.isHodgepodgeSpeedupAnimationsEnabled() && !Constants.KEEP_RENDER_LIST_LOGIC) { + // Hodgepodge hooks this method to decide what animations to play, make sure it runs + wr.getGLCallListForPass(i); + } } } region.batchLimit[i] = piFirst[i].position(); |