Fix Optifine language data missing when localization extra is enabled (fixes #109)
This commit is contained in:
@@ -3,6 +3,7 @@ package com.replaymod.compat.optifine;
|
|||||||
import net.minecraft.client.settings.GameSettings;
|
import net.minecraft.client.settings.GameSettings;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public class OptifineReflection {
|
public class OptifineReflection {
|
||||||
|
|
||||||
@@ -24,4 +25,14 @@ public class OptifineReflection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reloadLang() {
|
||||||
|
try {
|
||||||
|
Class.forName("Lang").getDeclaredMethod("resourcesReloaded").invoke(null);
|
||||||
|
} catch (ClassNotFoundException ignore) {
|
||||||
|
// no optifine installed
|
||||||
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.replaymod.extras;
|
package com.replaymod.extras;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.replaymod.compat.optifine.OptifineReflection;
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.IResourcePack;
|
import net.minecraft.client.resources.IResourcePack;
|
||||||
@@ -66,6 +67,8 @@ public class LocalizationExtra implements Extra {
|
|||||||
List<IResourcePack> defaultResourcePacks = mc.defaultResourcePacks;
|
List<IResourcePack> defaultResourcePacks = mc.defaultResourcePacks;
|
||||||
defaultResourcePacks.add(new LocalizedResourcePack(languages));
|
defaultResourcePacks.add(new LocalizedResourcePack(languages));
|
||||||
mc.getLanguageManager().onResourceManagerReload(mc.getResourceManager());
|
mc.getLanguageManager().onResourceManagerReload(mc.getResourceManager());
|
||||||
|
// Optifine does its own, additional language data loading
|
||||||
|
OptifineReflection.reloadLang();
|
||||||
LOGGER.debug("Added language files to resource packs and reloaded LanguageManager");
|
LOGGER.debug("Added language files to resource packs and reloaded LanguageManager");
|
||||||
});
|
});
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user