use of net.minecraftforge.fml.client.FMLClientHandler in project GregTech by GregTechCE.
the class ResourcePackFix method setModResourcePack.
private static void setModResourcePack(String modid, AbstractResourcePack newPack) {
FMLClientHandler clientHandler = FMLClientHandler.instance();
IResourcePack oldPack = clientHandler.getResourcePackFor(modid);
Map<String, IResourcePack> resourcePackMap = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, clientHandler, "resourcePackMap");
resourcePackMap.put(modid, newPack);
List<IResourcePack> resourcePackList = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, clientHandler, "resourcePackList");
resourcePackList.remove(oldPack);
resourcePackList.add(newPack);
}
use of net.minecraftforge.fml.client.FMLClientHandler in project BiomesOPlenty by Glitchfiend.
the class ClientProxy method replaceForgeResources.
private static void replaceForgeResources() {
if (MiscConfigurationHandler.overrideForgeBuckets) {
FMLClientHandler clientHandler = FMLClientHandler.instance();
List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(FMLClientHandler.class, clientHandler, "resourcePackList");
Map<String, IResourcePack> resourcePackMap = ReflectionHelper.getPrivateValue(FMLClientHandler.class, clientHandler, "resourcePackMap");
LegacyV2Adapter resourcePack = (LegacyV2Adapter) clientHandler.getResourcePackFor("forge");
// Remove the old resource pack from the registry
resourcePackList.remove(resourcePack);
resourcePackMap.remove("forge");
// Replace Forge's resource pack with our modified version
ForgeRedirectedResourcePack redirectedResourcePack = new ForgeRedirectedResourcePack(FMLCommonHandler.instance().findContainerFor("forge"));
// Add our new resource pack in its place
resourcePackList.add(redirectedResourcePack);
resourcePackMap.put("forge", redirectedResourcePack);
}
}
Aggregations