use of net.runelite.cache.definitions.loaders.ItemLoader in project runelite by runelite.
the class CacheController method getItem.
@RequestMapping("item/{itemId}")
public ItemDefinition getItem(@PathVariable int itemId) throws IOException {
ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM);
ArchiveFiles archiveFiles = cacheService.getArchiveFiles(archiveEntry);
if (archiveFiles == null) {
throw new NotFoundException();
}
FSFile file = archiveFiles.findFile(itemId);
if (file == null) {
throw new NotFoundException();
}
ItemDefinition itemdef = new ItemLoader().load(itemId, file.getContents());
return itemdef;
}
use of net.runelite.cache.definitions.loaders.ItemLoader in project runelite by runelite.
the class ItemManager method load.
public void load() throws IOException {
ItemLoader loader = new ItemLoader();
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.ITEM.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile f : files.getFiles()) {
ItemDefinition def = loader.load(f.getFileId(), f.getContents());
items.put(f.getFileId(), def);
}
}
Aggregations