@@ -8,7 +8,6 @@ import lime.utils.AssetLibrary;
88import haxe .ds .Map ;
99
1010class AssetsLibraryList extends AssetLibrary {
11-
1211 public var libraries : Array <AssetLibrary > = [];
1312 public var cleanLibraries (get , never ): Array <AssetLibrary >;
1413 function get_cleanLibraries (): Array <AssetLibrary > {
@@ -32,6 +31,7 @@ class AssetsLibraryList extends AssetLibrary {
3231 #end
3332
3433 private var cachePaths : Map <String , AssetLibrary > = [];
34+ private var cacheNonExistentPaths : Map <String , Int > = [];
3535
3636 public function removeLibrary (lib : AssetLibrary ) {
3737 if (lib != null ) {
@@ -58,18 +58,27 @@ class AssetsLibraryList extends AssetLibrary {
5858 return true ;
5959
6060 // There's a mod that heavily relies on addons and that can causes lags just to get a path.
61- if (cachePaths .exists (id )) {
61+ final sec = Date .now ().getSeconds ();
62+ if (cacheNonExistentPaths .exists (id ) && sec - 10 < cacheNonExistentPaths .get (id )) {
63+ return false ;
64+ }
65+ else if (cachePaths .exists (id )) {
6266 if (cachePaths .get (id ).exists (id , type )) return true ;
6367 else cachePaths .remove (id );
6468 }
6569
70+
6671 for (k => l in libraries ) {
6772 if (shouldSkipLib (l , source )) continue ;
6873 if (l .exists (id , type )) {
74+ // trace("EXISTS", id, type, source);
6975 cachePaths .set (id , l );
7076 return true ;
7177 }
7278 }
79+
80+ // trace("DOESNT EXISTS", id, type, source);
81+ cacheNonExistentPaths .set (id , sec );
7382 return false ;
7483 }
7584 public override inline function exists (id : String , type : String ): Bool
0 commit comments