Skip to content

Commit

Permalink
修正与 mek 等模组导致的冲突问题
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Nov 18, 2024
1 parent 9cea8f5 commit c8002ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -26,7 +27,12 @@ public class RenderTypeMixin implements RenderTypeExtension {

@WrapOperation(method = "<clinit>", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;CHUNK_BUFFER_LAYERS:Lcom/google/common/collect/ImmutableList;"))
private static void modifyChunkBufferLayers(ImmutableList<RenderType> value, Operation<Void> 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
Expand Down

0 comments on commit c8002ea

Please sign in to comment.