From d33ebd69e877c5f71c5b6be5187c8463b4757bff Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Mon, 8 May 2023 19:17:00 -0400 Subject: [PATCH] Fix texture reload failing on second try --- .../mixin/perf/faster_texture_loading/TextureAtlasMixin.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java index f24add16..b605365b 100644 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java +++ b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java @@ -85,6 +85,11 @@ public abstract class TextureAtlasMixin { cir.getReturnValue().addAll(storedResults); } + @Inject(method = "prepareToStitch", at = @At("HEAD")) + private void initMap(CallbackInfoReturnable cir) { + loadedImages = new ConcurrentHashMap<>(); + } + @Inject(method = "prepareToStitch", at = @At("RETURN")) private void clearLoadedImages(CallbackInfoReturnable cir) { loadedImages = Collections.emptyMap();