From 646c7bac69dba476b3f9171568091eb23a86edaa Mon Sep 17 00:00:00 2001 From: isXander Date: Wed, 29 May 2024 22:42:46 +0100 Subject: 1.21 compat --- .../isxander/yacl3/config/v2/api/autogen/SimpleOptionFactory.java | 5 +++-- .../dev/isxander/yacl3/config/v2/impl/autogen/ListGroupImpl.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java/dev/isxander/yacl3/config') 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 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 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 implements OptionFactory> { 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); } -- cgit