Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/main/java/com/lambda/mixin/OptionalModMixinPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2026 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.mixin;

import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class OptionalModMixinPlugin implements IMixinConfigPlugin {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (targetClassName.startsWith("net.caffeinemc.mods.sodium.")) {
return FabricLoader.getInstance().isModLoaded("sodium");
}
if (targetClassName.startsWith("net.fabricmc.fabric.impl.client.indigo.")) {
return FabricLoader.getInstance().isModLoaded("fabric-renderer-indigo");
}
return true;
}

@Override
public void onLoad(String mixinPackage) {}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@Mixin(SodiumWorldRenderer.class)
public class SodiumWorldRendererMixin {
@Unique
private final FogParameters NO_FOG = new FogParameters(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
private final FogParameters NO_FOG = new FogParameters(0f, 0f, 0f, 0f, Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);

@ModifyExpressionValue(method = "drawChunkLayer(Lnet/minecraft/client/render/BlockRenderLayerGroup;Lnet/caffeinemc/mods/sodium/client/render/chunk/ChunkRenderMatrices;DDDLnet/minecraft/client/gl/GpuSampler;)V", at = @At(value = "FIELD", target = "Lnet/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer;lastFogParameters:Lnet/caffeinemc/mods/sodium/client/util/FogParameters;", opcode = Opcodes.GETFIELD))
private FogParameters modifyFogParameters(FogParameters original) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lambda.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.lambda.mixin",
"plugin": "com.lambda.mixin.OptionalModMixinPlugin",
"compatibilityLevel": "JAVA_21",
"client": [
"CrashReportMixin",
Expand Down