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

下面列出了net.minecraft.util.profiler.Profiler#net.minecraft.resource.ResourceManager 实例代码,或者点击链接到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 项目: LibGui   文件: NinePatch.java
@Override
		protected void apply(Map<Identifier, Properties> meta, ResourceManager manager, Profiler profiler) {
			properties = new HashMap<>();
			for (Map.Entry<Identifier, Properties> entry : meta.entrySet()) {
				Identifier id = entry.getKey();
				Properties props = entry.getValue();

				Mode mode = TextureProperties.DEFAULT.getMode();
//				float cornerUv = TextureProperties.DEFAULT.getCornerUv();

				if (props.containsKey("mode")) {
					String modeStr = props.getProperty("mode");
					mode = Mode.fromString(modeStr);
					if (mode == null) {
						LibGuiClient.logger.error("Invalid mode '{}' in nine-patch metadata file for texture {}", modeStr, id);
						continue;
					}
				}

//				if (props.containsKey("cornerUv")) {
//					cornerUv = Float.parseFloat(props.getProperty("cornerUv"));
//				}

				TextureProperties texProperties = new TextureProperties(mode);
				properties.put(id, texProperties);
			}
		}
 
源代码3 项目: MineLittlePony   文件: PonyManager.java
@Override
public CompletableFuture<Void> reload(Synchronizer sync, ResourceManager sender,
        Profiler serverProfiler, Profiler clientProfiler,
        Executor serverExecutor, Executor clientExecutor) {

    sync.getClass();
    return sync.whenPrepared(null).thenRunAsync(() -> {
        clientProfiler.startTick();
        clientProfiler.push("Reloading all background ponies");
        poniesCache.invalidateAll();
        backgroundPonyList.reloadAll(sender);
        clientProfiler.pop();
        clientProfiler.endTick();
    }, clientExecutor);
}
 
private Identifier resolve(Identifier... resources) {
    // check resource packs for either texture.

    ResourceManager manager = MinecraftClient.getInstance().getResourceManager();

    for (Identifier i : resources) {
        if (manager.containsResource(i)) {
            return i;
        }
    }

    return resources[resources.length - 1];
}
 
源代码5 项目: multiconnect   文件: MixinTranslationStorage.java
@Inject(method = "load(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;)Lnet/minecraft/client/resource/language/TranslationStorage;",
        at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap;copyOf(Ljava/util/Map;)Lcom/google/common/collect/ImmutableMap;", remap = false),
        locals = LocalCapture.CAPTURE_FAILHARD)
private static void onLoad(ResourceManager resourceManager, List<LanguageDefinition> languages, CallbackInfoReturnable<TranslationStorage> ci, Map<String, String> translations) {
    OldLanguageManager.addExtraTranslations(languages.get(languages.size() - 1).getCode(), translations::put);
}
 
源代码6 项目: patchwork-api   文件: MixinSpriteAtlasTexture.java
@Inject(method = "stitch", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/SpriteAtlasTexture;loadSprites(Lnet/minecraft/resource/ResourceManager;Ljava/util/Set;)Ljava/util/Collection;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
private void onStitch(ResourceManager resourceManager, Iterable<Identifier> iterable, Profiler profiler, CallbackInfoReturnable<SpriteAtlasTexture.Data> cir, Set<Identifier> set) {
	RenderEvents.onTextureStitchPre((SpriteAtlasTexture) (Object) this, set);
}
 
源代码7 项目: patchwork-api   文件: ExistingFileHelper.java
private ResourceManager getManager(ResourceType type) {
	return type == ResourceType.CLIENT_RESOURCES ? clientResources : serverData;
}
 
源代码8 项目: MineLittlePony   文件: BackgroundPonyList.java
public void reloadAll(ResourceManager resourceManager) {
    backgroundPonyList.clear();
    backgroundPonyList.addAll(resourceManager.findResources("textures/entity/pony", path -> path.endsWith(".png")));
    MineLittlePony.logger.info("Detected {} background ponies installed.", backgroundPonyList.size());
}