Java Code Examples for net.minecraft.client.resources.IResourcePack

The following examples show how to use net.minecraft.client.resources.IResourcePack. These examples are extracted from open source projects. 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
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
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());
}