From 450dbad49b72b37cdeef9b1358a59da1d66076c9 Mon Sep 17 00:00:00 2001 From: isxander Date: Fri, 8 Dec 2023 19:59:09 +0000 Subject: extreme image preloading hackery --- .../main/java/dev/isxander/yacl3/impl/OptionDescriptionImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'common/src/main/java/dev/isxander/yacl3/impl') diff --git a/common/src/main/java/dev/isxander/yacl3/impl/OptionDescriptionImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/OptionDescriptionImpl.java index 3a3008c..67fa6a6 100644 --- a/common/src/main/java/dev/isxander/yacl3/impl/OptionDescriptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl3/impl/OptionDescriptionImpl.java @@ -88,7 +88,13 @@ public record OptionDescriptionImpl(Component text, CompletableFuture completedImage = ImageRendererManager.getImage(image); + if (completedImage.isPresent()) { + this.image = CompletableFuture.completedFuture(completedImage); + } else { + this.image = ImageRendererManager.registerImage(image, AnimatedDynamicTextureImage.createWEBPFromTexture(image)).thenApply(Optional::of); + } + imageUnset = false; return this; } -- cgit