net.minecraft.util.profiler.Profiler#net.minecraft.resource.Resource源码实例Demo

下面列出了net.minecraft.util.profiler.Profiler#net.minecraft.resource.Resource 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LibGui   文件: NinePatch.java
@Override
protected Map<Identifier, Properties> prepare(ResourceManager manager, Profiler profiler) {
	Collection<Identifier> ids = manager.findResources("textures", s -> s.endsWith(SUFFIX));
	Map<Identifier, Properties> result = new HashMap<>();

	for (Identifier input : ids) {
		try (Resource resource = manager.getResource(input);
			 InputStream stream = resource.getInputStream()) {
			Properties props = new Properties();
			props.load(stream);
			Identifier textureId = new Identifier(input.getNamespace(), input.getPath().substring(0, input.getPath().length() - SUFFIX.length()));
			result.put(textureId, props);
		} catch (Exception e) {
			LibGuiClient.logger.error("Error while loading metadata file {}, skipping...", input, e);
		}
	}

	return result;
}
 
源代码2 项目: MineLittlePony   文件: NpcClothingFeature.java
private <K> VillagerResourceMetadata.HatType loadHatType(Map<K, HatType> cache, String type, DefaultedRegistry<K> registry, K key) {
    return cache.computeIfAbsent(key, k -> {
        try (Resource res = resourceManager.getResource(findTexture(type, registry.getId(k)))) {
            VillagerResourceMetadata meta = res.getMetadata(VillagerResourceMetadata.READER);
            if (meta != null) {
                return meta.getHatType();
            }
        } catch (IOException e) { }
        return HatType.NONE;
    });
}
 
源代码3 项目: patchwork-api   文件: ExistingFileHelper.java
@VisibleForTesting
public Resource getResource(Identifier identifier, ResourceType type, String pathSuffix, String pathPrefix) throws IOException {
	return getManager(type).getResource(getLocation(identifier, pathSuffix, pathPrefix));
}