diff options
Diffstat (limited to 'common/src/main')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/gui/ImageRenderer.java | 3 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/gui/ImageRenderer.java b/common/src/main/java/dev/isxander/yacl/gui/ImageRenderer.java index 26aacb7..25be791 100644 --- a/common/src/main/java/dev/isxander/yacl/gui/ImageRenderer.java +++ b/common/src/main/java/dev/isxander/yacl/gui/ImageRenderer.java @@ -3,6 +3,7 @@ package dev.isxander.yacl.gui; import com.mojang.blaze3d.Blaze3D; import com.mojang.blaze3d.platform.NativeImage; import com.twelvemonkeys.imageio.plugins.webp.WebPImageReaderSpi; +import dev.isxander.yacl.impl.utils.YACLConstants; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.texture.DynamicTexture; @@ -38,7 +39,7 @@ public interface ImageRenderer { Map<ResourceLocation, CompletableFuture<Optional<ImageRenderer>>> CACHE = new ConcurrentHashMap<>(); static CompletableFuture<Optional<ImageRenderer>> getOrMakeAsync(ResourceLocation id, Supplier<Optional<ImageRenderer>> factory) { - return CACHE.computeIfAbsent(id, key -> CompletableFuture.supplyAsync(factory)); + return CACHE.computeIfAbsent(id, key -> CompletableFuture.supplyAsync(factory, YACLConstants.SINGLE_THREAD_EXECUTOR)); } static CompletableFuture<Optional<ImageRenderer>> getOrMakeSync(ResourceLocation id, Supplier<Optional<ImageRenderer>> factory) { diff --git a/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java b/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java index 3d382d4..7b84ee1 100644 --- a/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java +++ b/common/src/main/java/dev/isxander/yacl/impl/utils/YACLConstants.java @@ -3,6 +3,11 @@ package dev.isxander.yacl.impl.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + public class YACLConstants { public static final Logger LOGGER = LoggerFactory.getLogger("YetAnotherConfigLib"); + + public static final ExecutorService SINGLE_THREAD_EXECUTOR = Executors.newSingleThreadExecutor(); } |