From 8829b00d238ff42fba6e1ad3eee3f570c84e08b6 Mon Sep 17 00:00:00 2001 From: isXander Date: Sat, 27 May 2023 20:45:02 +0100 Subject: add custom image provider to OptionDescription --- .../main/java/dev/isxander/yacl/api/OptionDescription.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common/src/main/java/dev/isxander/yacl/api') diff --git a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java index c233309..fbae4c2 100644 --- a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java @@ -122,6 +122,19 @@ public interface OptionDescription { */ Builder webpImage(Path path, ResourceLocation uniqueLocation); + /** + * Sets a custom image renderer to display with the description. + * This is useful for rendering other abstract things relevant to your mod. + *

+ * However, THIS IS NOT API SAFE! As part of the gui package, things + * may change that could break compatibility with future versions of YACL. + * A helpful utility (that is also not API safe) is {@link ImageRenderer#getOrMakeAsync(ResourceLocation, Supplier)} + * which will cache the image renderer for the whole game lifecycle and construct it asynchronously to the render thread. + * @param image the image renderer to display + * @return this builder + */ + Builder customImage(CompletableFuture> image); + /** * Sets an animated GIF image to display with the description. This is backed by a regular minecraft resource * in your mod's /assets folder. -- cgit