getNPCTexture for ClientCache

This commit is contained in:
Kam committed 2023-06-02 04:22:00 -04:00
1 parent 6bc55e101f
commit 189692a090
3 files changed
+24 -9

No files matched your search

@@ -1,5 +1,6 @@
package noppes.npcs.client;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.renderer.ImageData;
import noppes.npcs.util.CacheHashMap;
@@ -14,4 +15,13 @@ public class ClientCacheHandler {
return imageDataCache.get(directory).getObject();
}
}
public static ImageData getNPCTexture(String directory, boolean x64, ResourceLocation resource) {
synchronized (imageDataCache) {
if (!imageDataCache.containsKey(resource.getResourcePath())) {
imageDataCache.put(resource.getResourcePath(), new CacheHashMap.CachedObject<>(new ImageData(directory, x64, resource)));
}
return imageDataCache.get(resource.getResourcePath()).getObject();
}
}
}