Fix compatibility with Optifine 1.12.2 E1

Optifine has changed some package names, this commit deals with that.
This commit is contained in:
Jonas Herzig
2018-07-20 11:05:21 +02:00
parent 8314803cda
commit ad9c82c991
3 changed files with 20 additions and 8 deletions

View File

@@ -27,7 +27,13 @@ public class OptifineReflection {
public static void reloadLang() {
try {
Class.forName("Lang").getDeclaredMethod("resourcesReloaded").invoke(null);
Class<?> langClass;
try {
langClass = Class.forName("Lang"); // Pre Optifine 1.12.2 E1
} catch (ClassNotFoundException ignore) {
langClass = Class.forName("net.optifine.Lang"); // Post Optifine 1.12.2 E1
}
langClass.getDeclaredMethod("resourcesReloaded").invoke(null);
} catch (ClassNotFoundException ignore) {
// no optifine installed
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {