use of net.minecraft.client.resources.LegacyV2Adapter in project MinecraftForge by MinecraftForge.
the class FMLClientHandler method addModAsResource.
@Override
public void addModAsResource(ModContainer container) {
Class<?> resourcePackType = container.getCustomResourcePackClass();
if (resourcePackType != null) {
try {
IResourcePack pack = (IResourcePack) resourcePackType.getConstructor(ModContainer.class).newInstance(container);
PackMetadataSection meta = (PackMetadataSection) pack.getPackMetadata(this.metaSerializer, "pack");
if (meta != null && meta.getPackFormat() == 2) {
pack = new LegacyV2Adapter(pack);
}
resourcePackList.add(pack);
resourcePackMap.put(container.getModId(), pack);
} catch (NoSuchMethodException e) {
FMLLog.log(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return;
} catch (Exception e) {
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
throw Throwables.propagate(e);
}
}
}
Aggregations