use of com.almuradev.almura.asm.mixin.accessors.client.resources.ResourcePackRepositoryAccessor in project Almura by AlmuraDev.
the class AlmuraSettings method applyPack.
protected static void applyPack(String pack) {
final GameSettings settings = Minecraft.getMinecraft().gameSettings;
final ClientConfiguration configuration = configAdapter.get();
if (!settings.resourcePacks.contains(pack)) {
settings.resourcePacks.add(pack);
}
settings.saveOptions();
final ResourcePackRepository resourcepackrepository = Minecraft.getMinecraft().getResourcePackRepository();
final Iterator<String> iterator = settings.resourcePacks.iterator();
while (iterator.hasNext()) {
String name = iterator.next();
for (ResourcePackRepository.Entry resourcepackrepository$entry : ((ResourcePackRepositoryAccessor) resourcepackrepository).accessor$getRepositoryEntriesAll()) {
if (resourcepackrepository$entry.getResourcePackName().equals(name)) {
if (resourcepackrepository$entry.getPackFormat() == 3 || settings.incompatibleResourcePacks.contains(resourcepackrepository$entry.getResourcePackName())) {
if (!((ResourcePackRepositoryAccessor) resourcepackrepository).accessor$getRepositoryEntries().contains(resourcepackrepository$entry)) {
((ResourcePackRepositoryAccessor) resourcepackrepository).accessor$getRepositoryEntries().add(resourcepackrepository$entry);
}
break;
}
iterator.remove();
}
}
}
}
Aggregations