Search in sources :

Example 1 with ForgeRedirectedResourcePack

use of biomesoplenty.client.texture.ForgeRedirectedResourcePack 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);
    }
}
Also used : ForgeRedirectedResourcePack(biomesoplenty.client.texture.ForgeRedirectedResourcePack) FMLClientHandler(net.minecraftforge.fml.client.FMLClientHandler) LegacyV2Adapter(net.minecraft.client.resources.LegacyV2Adapter) IResourcePack(net.minecraft.client.resources.IResourcePack)

Aggregations

ForgeRedirectedResourcePack (biomesoplenty.client.texture.ForgeRedirectedResourcePack)1 IResourcePack (net.minecraft.client.resources.IResourcePack)1 LegacyV2Adapter (net.minecraft.client.resources.LegacyV2Adapter)1 FMLClientHandler (net.minecraftforge.fml.client.FMLClientHandler)1