Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Mixins with Incompatible mods #11

Open
wants to merge 1 commit into
base: 1.20.4
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions src/main/java/net/kyrptonaught/lemclienthelper/LCHMixinPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package net.kyrptonaught.lemclienthelper;

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 final class LCHMixinPlugin implements IMixinConfigPlugin {

private static final String[] SMALLINV= {
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.HandledScreenMixin",
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.MinecraftClientMixin",
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.ScreenHandlerMixin",
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.invs.GenericContainerScreenMixin",
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.invs.InventoryScreenMixin",
"net.kyrptonaught.lemclienthelper.mixin.SmallInv.invs.MultipleScreenMixin"
};

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (FabricLoader.getInstance().isModLoaded("legacy")) {
for (String i : SMALLINV) {
if (mixinClassName.equals(i)) {
return false;
}
}
}
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
@@ -1,5 +1,7 @@
package net.kyrptonaught.lemclienthelper;

import org.apache.logging.log4j.LogManager;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.loader.api.FabricLoader;
Expand Down Expand Up @@ -36,6 +38,8 @@ public void onInitializeClient() {
// if (FabricLoader.getInstance().isModLoaded("lambdacontrols"))
if (FabricLoader.getInstance().isModLoaded("midnightcontrols"))
registerControllerKeys();
if(FabricLoader.getInstance().isModLoaded("legacy"))
LogManager.getLogger().warn("Legacy4J has been detected, one or more features may be disabled.");
//TODO: Implement this armor hud with config and or server integration
configManager.load();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lemclienthelper.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"required": true,
"package": "net.kyrptonaught.lemclienthelper.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "net.kyrptonaught.lemclienthelper.LCHMixinPlugin",
"client": [
"customWorldBorder.WorldBorderMixin",
"ResourcePreloader.ClientBuiltInResourcePackProviderMixin",
Expand Down
Loading