use of riskyken.armourersWorkshop.common.library.LibraryFileList in project Armourers-Workshop by RiskyKen.
the class GuiSkinLibrary method fileExists.
private boolean fileExists(String path, String name) {
LibraryFileList fileList = getFileList(fileSwitchType);
ArrayList<LibraryFile> files = fileList.getFileList();
for (int i = 0; i < files.size(); i++) {
LibraryFile file = files.get(i);
if (file.getFullName().equalsIgnoreCase(path + name)) {
return true;
}
}
return false;
}
use of riskyken.armourersWorkshop.common.library.LibraryFileList in project Armourers-Workshop by RiskyKen.
the class EntitySkinHandler method getRandomSkinOfType.
public LibraryFile getRandomSkinOfType(ISkinType skinType) {
ILibraryManager libraryManager = ArmourersWorkshop.getProxy().libraryManager;
LibraryFileList fileList = null;
if (ArmourersWorkshop.isDedicated()) {
fileList = libraryManager.getServerPublicFileList();
} else {
fileList = libraryManager.getClientPublicFileList();
}
ArrayList<LibraryFile> typeList = fileList.getCachedFileListForSkinType(skinType);
if (typeList == null) {
return null;
}
ArrayList<LibraryFile> validFiles = new ArrayList<LibraryFile>();
for (int i = 0; i < typeList.size(); i++) {
if (typeList.get(i).filePath.startsWith(ConfigHandler.enitiySpawnSkinTargetPath)) {
validFiles.add(typeList.get(i));
}
}
// touhou
Random random = new Random();
if (!validFiles.isEmpty()) {
return validFiles.get(random.nextInt(validFiles.size()));
}
return null;
}
Aggregations