public static BlockTexture ReadBlockTexture(string path) { if (_cachedTextures.TryGetValue(path, out var tex)) { return(tex); } tex = BlockTextureManager.LoadTexture(ReadTextureData(path)); _cachedTextures.Add(path, tex); return(tex); }
private void Work(bool reload) { if (!reload) { //Add plugins in "Plugins" dir var pluginsDir = new DirectoryInfo("Plugins"); foreach (var dir in pluginsDir.EnumerateDirectories()) { PluginManager.AddPlugin(new FileSystemRaw(dir)); } foreach (var file in pluginsDir.EnumerateFiles()) { PluginManager.AddPlugin(new FileSystemCompressed(file)); } } //Load resources PluginManager.LoadResources( (total, state, plugin) => { _progress = (int)(total * 50); _text = $"{I18N.Get(state)} {plugin} ({_progress}%)"; Logger.Debug($"{I18N.GetOrdinal(state)} {plugin} ({_progress}%)"); }); _progress = 50; _text = $"{I18N.Get("system.loading.resources.uploadTextures")} ({_progress}%)"; Logger.Debug($"{I18N.GetOrdinal("system.loading.resources.uploadTextures")} ({_progress}%)"); BlockTextureManager.Upload(); if (!reload) { //Load plugins PluginManager.LoadPlugins( (total, state, plugin) => { _progress = (int)(total * 50) + 50; _text = $"{I18N.Get(state)} {plugin} ({_progress}%)"; Logger.Debug($"{I18N.GetOrdinal(state)} {plugin} ({_progress}%)"); }); } }