From d688ddbeb0fca97445158509e37746d3a43a6bc8 Mon Sep 17 00:00:00 2001 From: quat1024 Date: Thu, 31 Aug 2023 21:54:32 -0400 Subject: [PATCH] Plug Indium in the 'no frapi' error --- .../cottonmc/templates/TemplatesClient.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/cottonmc/templates/TemplatesClient.java b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java index 4a41c00..ca03217 100644 --- a/src/main/java/io/github/cottonmc/templates/TemplatesClient.java +++ b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java @@ -11,6 +11,7 @@ import net.fabricmc.fabric.api.renderer.v1.Renderer; import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.resource.ResourceManager; @@ -19,14 +20,23 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.ChunkSectionPos; import org.jetbrains.annotations.NotNull; -import java.util.Objects; - public class TemplatesClient implements ClientModInitializer { //2.2 note: Yes, this wasn't final before, but it should have been public static final TemplatesModelProvider provider = new TemplatesModelProvider(); public static @NotNull Renderer getFabricRenderer() { - return Objects.requireNonNull(RendererAccess.INSTANCE.getRenderer(), "A Fabric Rendering API implementation is required to use Templates!"); + Renderer obj = RendererAccess.INSTANCE.getRenderer(); + if(obj != null) return obj; + + //Welp, not much more we can do, this mod heavily relies on frapi + String msg = "A Fabric Rendering API implementation is required to use Templates 2!"; + + if(!FabricLoader.getInstance().isModLoaded("fabric-renderer-indigo")) + msg += "\nI noticed you don't have Indigo installed, which is a part of the complete Fabric API package."; + if(FabricLoader.getInstance().isModLoaded("sodium")) + msg += "\nI noticed you have Sodium installed - consider also installing Indium to provide a compatible renderer implementation."; + + throw new NullPointerException(msg); } @Override