use of net.minecraft.client.resources.IResourcePack in project Client by Sol-Client.
the class MixinResourcePackRepository method postInit.
@Inject(method = "<init>", at = @At("RETURN"))
public void postInit(File dirResourcepacksIn, File dirServerResourcepacksIn, IResourcePack rprDefaultResourcePackIn, IMetadataSerializer rprMetadataSerializerIn, GameSettings settings, CallbackInfo callback) {
Map<File, ResourcePackRepository> repos = new HashMap<>();
Iterator<String> packIterator = settings.resourcePacks.iterator();
while (packIterator.hasNext()) {
String packName = packIterator.next();
File file = new File(dirResourcepacksIn, packName);
if (!file.exists()) {
continue;
}
File parent = file.getParentFile();
ResourcePackRepository applicableRepo;
if (packName.contains("/")) {
applicableRepo = repos.computeIfAbsent(parent, (ignored) -> {
ResourcePackRepository repo = new ResourcePackRepository(parent, dirServerResourcepacksIn, rprDefaultResourcePackIn, rprMetadataSerializerIn, settings);
repo.getRepositoryEntriesAll();
return repo;
});
} else {
applicableRepo = (ResourcePackRepository) (Object) this;
}
for (ResourcePackRepository.Entry entry : applicableRepo.getRepositoryEntriesAll()) {
if (entry.getResourcePackName().equals(packName)) {
if (entry.func_183027_f() == 1 || settings.incompatibleResourcePacks.contains(entry.getResourcePackName())) {
repositoryEntries.add(entry);
break;
}
packIterator.remove();
logger.warn("Removed selected resource pack {} because it\'s no longer compatible", entry.getResourcePackName());
}
}
}
}
Aggregations