/** * Registers domains to resource manager from resource listeners. * @param novousLogger */ private static void handleResourceManager(Logger novousLogger) { novousLogger.info("Registering resource manager test..."); ResourceLinker.REGISTERED_RESOURCE_LINKERS.add(new TestResourceLinker()); novousLogger.info("Registering abstract resource linked manager..."); PairedRegistry<String, FallbackResourceManager> resourceManagerRegistry = (PairedRegistry<String, FallbackResourceManager>) Minecraft .getMinecraft().getResourceManager(); for (ResourceLinker linker : ResourceLinker.REGISTERED_RESOURCE_LINKERS) { linker.getLinkedDomains().forEach((domain) -> resourceManagerRegistry.register (domain, new LinkedResourceManager())); } novousLogger.info("Testing resource linked manager..."); TestResourceLinker.checkTestSuccess(); }
@Override public void register(String s, FallbackResourceManager fallbackResourceManager) { domainResourceManagers.put(s, fallbackResourceManager); }
@Override public Pair<String, FallbackResourceManager>[] getRegistrationPairs() { List<Pair<String, FallbackResourceManager>> pairs = new ArrayList<>(); domainResourceManagers.forEach((key, fallbackManager) -> pairs.add(Pair.of(key, fallbackManager))); return pairs.toArray(new Pair[pairs.size()]); }