diff options
| author | isXander <xander@isxander.dev> | 2024-05-29 22:42:46 +0100 |
|---|---|---|
| committer | isXander <xander@isxander.dev> | 2024-05-29 22:42:46 +0100 |
| commit | 646c7bac69dba476b3f9171568091eb23a86edaa (patch) | |
| tree | 83727744315b956120fb573f9ecd883837b63099 /src/main/java/dev/isxander/yacl3/config | |
| parent | 41253828df7c2066b5df29a32aa8e512f34ad85a (diff) | |
| download | YetAnotherConfigLib-646c7bac69dba476b3f9171568091eb23a86edaa.tar.gz YetAnotherConfigLib-646c7bac69dba476b3f9171568091eb23a86edaa.tar.bz2 YetAnotherConfigLib-646c7bac69dba476b3f9171568091eb23a86edaa.zip | |
1.21 compat
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/config')
| -rw-r--r-- | src/main/java/dev/isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java | 5 | ||||
| -rw-r--r-- | src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java b/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java index f7d807f..bbb878d 100644 --- a/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java +++ b/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java @@ -9,6 +9,7 @@ import dev.isxander.yacl3.config.v2.impl.FieldBackedBinding; import dev.isxander.yacl3.config.v2.impl.autogen.AutoGenUtils; import dev.isxander.yacl3.config.v2.impl.autogen.EmptyCustomImageFactory; import dev.isxander.yacl3.config.v2.impl.autogen.YACLAutoGenException; +import dev.isxander.yacl3.platform.YACLPlatform; import net.minecraft.client.Minecraft; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; @@ -90,7 +91,7 @@ public abstract class SimpleOptionFactory<A extends Annotation, T> implements Op builder.customImage(imageFactory.createImage(value, field, storage).thenApply(Optional::of)); } else if (!imageOverride.value().isEmpty()) { String path = imageOverride.value(); - ResourceLocation imageLocation = new ResourceLocation(field.parent().id().getNamespace(), path); + ResourceLocation imageLocation = YACLPlatform.rl(field.parent().id().getNamespace(), path); String extension = path.substring(path.lastIndexOf('.') + 1); switch (extension) { @@ -105,7 +106,7 @@ public abstract class SimpleOptionFactory<A extends Annotation, T> implements Op } else { String imagePath = "textures/yacl3/" + field.parent().id().getPath() + "/" + field.access().name() + ".webp"; imagePath = imagePath.toLowerCase().replaceAll("[^a-z0-9/._:-]", "_"); - ResourceLocation imageLocation = new ResourceLocation(field.parent().id().getNamespace(), imagePath); + ResourceLocation imageLocation = YACLPlatform.rl(field.parent().id().getNamespace(), imagePath); if (Minecraft.getInstance().getResourceManager().getResource(imageLocation).isPresent()) { builder.webpImage(imageLocation); } diff --git a/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java b/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java index f78d4ba..022d56e 100644 --- a/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java +++ b/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java @@ -8,6 +8,7 @@ import dev.isxander.yacl3.config.v2.api.autogen.ListGroup; import dev.isxander.yacl3.config.v2.api.autogen.OptionFactory; import dev.isxander.yacl3.config.v2.api.autogen.OptionAccess; import dev.isxander.yacl3.config.v2.impl.FieldBackedBinding; +import dev.isxander.yacl3.platform.YACLPlatform; import net.minecraft.client.Minecraft; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; @@ -56,7 +57,7 @@ public class ListGroupImpl<T> implements OptionFactory<ListGroup, List<T>> { String imagePath = "textures/yacl3/" + field.parent().id().getPath() + "/" + field.access().name() + ".webp"; imagePath = imagePath.toLowerCase().replaceAll("[^a-z0-9/._:-]", "_"); - ResourceLocation imageLocation = new ResourceLocation(field.parent().id().getNamespace(), imagePath); + ResourceLocation imageLocation = YACLPlatform.rl(field.parent().id().getNamespace(), imagePath); if (Minecraft.getInstance().getResourceManager().getResource(imageLocation).isPresent()) { builder.webpImage(imageLocation); } |
