net.minecraft.client.resources.IResourcePack Java Examples

The following examples show how to use net.minecraft.client.resources.IResourcePack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourcePackFix.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #2
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void preinit(List<IResourcePack> defaultResourcePacks, DefaultResourcePack mcDefaultResourcePack) {
    Hyperium.INSTANCE.setLaunchTime(System.currentTimeMillis());
    EventBus.INSTANCE.register(Hyperium.INSTANCE);

    defaultResourcePacks.add(mcDefaultResourcePack);
    AddonBootstrap.getAddonResourcePacks().stream().map(file -> file == null ? new AddonWorkspaceResourcePack() :
        new FileResourcePack(file)).forEach(defaultResourcePacks::add);

    AddonMinecraftBootstrap.init();
    CTJS.loadIntoJVM();
    EventBus.INSTANCE.post(new PreInitializationEvent());
}