mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-15 17:14:51 +00:00
Client-side cache is now cleared when leaving or joining worlds
This commit is contained in:
1 parent
54b46129a9
commit
6470c8317b
9 files changed
+56
-43
No files matched your search
@@ -1,12 +1,23 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.AnimationData;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.util.CacheHashMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ClientCacheHandler {
|
||||
private static final CacheHashMap<String, CacheHashMap.CachedObject<ImageData>> imageDataCache = new CacheHashMap<>((long) ConfigClient.CacheLife * 60 * 1000);
|
||||
public static OverlayQuestTracking questTrackingOverlay = null;
|
||||
public static HashMap<Integer, OverlayCustom> customOverlays = new HashMap<>();
|
||||
public static HashMap<UUID, HashMap<Integer, SkinOverlay>> skinOverlays = new HashMap<>();
|
||||
public static HashMap<UUID, AnimationData> playerAnimations = new HashMap<>();
|
||||
|
||||
public static ImageData getImageData(String directory) {
|
||||
synchronized (imageDataCache) {
|
||||
@@ -25,4 +36,12 @@ public class ClientCacheHandler {
|
||||
return imageDataCache.get(resource.getResourcePath()).getObject();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
ClientCacheHandler.imageDataCache.clear();
|
||||
ClientCacheHandler.questTrackingOverlay = null;
|
||||
ClientCacheHandler.customOverlays.clear();
|
||||
ClientCacheHandler.skinOverlays.clear();
|
||||
ClientCacheHandler.playerAnimations.clear();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user