diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/sodium/SodiumCompat.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/sodium/SodiumCompat.java index 0c3722bfc..6f22daa9d 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/sodium/SodiumCompat.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/sodium/SodiumCompat.java @@ -12,12 +12,16 @@ public final class SodiumCompat { private static final String SODIUM_ID = "sodium"; private static final String EMBEDDIUM_ID = "embeddium"; + private static boolean IS_INIT = false; private static boolean SODIUM_INSTALLED; private static boolean EMBEDDIUM_INSTALLED; public static void init() { - SODIUM_INSTALLED = LoadingModList.get().getModFileById(SODIUM_ID) != null; - EMBEDDIUM_INSTALLED = LoadingModList.get().getModFileById(EMBEDDIUM_ID) != null; + if (!IS_INIT) { + SODIUM_INSTALLED = LoadingModList.get().getModFileById(SODIUM_ID) != null; + EMBEDDIUM_INSTALLED = LoadingModList.get().getModFileById(EMBEDDIUM_ID) != null; + IS_INIT = true; + } } public static RenderLevelStageEvent.Stage getCutoutRenderStage() { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/mixin/client/RenderTypeMixin.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/mixin/client/RenderTypeMixin.java index d7b053ca5..5078ca252 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/mixin/client/RenderTypeMixin.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/mixin/client/RenderTypeMixin.java @@ -1,7 +1,8 @@ package com.github.tartaricacid.touhoulittlemaid.mixin.client; -import com.github.tartaricacid.touhoulittlemaid.client.renderer.sections.events.SectionGeometryRenderTypeEvents; import com.github.tartaricacid.touhoulittlemaid.client.renderer.sections.RenderTypeExtension; +import com.github.tartaricacid.touhoulittlemaid.client.renderer.sections.events.SectionGeometryRenderTypeEvents; +import com.github.tartaricacid.touhoulittlemaid.compat.sodium.SodiumCompat; import com.google.common.collect.ImmutableList; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; @@ -26,7 +27,12 @@ public class RenderTypeMixin implements RenderTypeExtension { @WrapOperation(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;CHUNK_BUFFER_LAYERS:Lcom/google/common/collect/ImmutableList;")) private static void modifyChunkBufferLayers(ImmutableList value, Operation original) { - original.call(ImmutableList.builder().addAll(value).add(SectionGeometryRenderTypeEvents.getItemEntityTranslucentCull()).build()); + SodiumCompat.init(); + if (SodiumCompat.isInstalled()) { + original.call(value); + } else { + original.call(ImmutableList.builder().addAll(value).add(SectionGeometryRenderTypeEvents.getItemEntityTranslucentCull()).build()); + } } @Override