mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 23:25:10 +01:00
- Merge #48 (Split rotation speed in X and Y, thanks to @ronniedude) - Merge #47 (Korean translations by @gyular) - Fix #50 (Stack pick-up problems in survival mode) - Add some compatibility measures for EMI (Will likely be improved further in the future) - Remove all REI-related code (not working anyway, EMI is better) - Possibly fix #41 (Random crashes when changing keybinds)
71 lines
2.0 KiB
Java
71 lines
2.0 KiB
Java
/*
|
|
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
*
|
|
* This file is part of midnightcontrols.
|
|
*
|
|
* Licensed under the MIT license. For more information,
|
|
* see the LICENSE file.
|
|
*/
|
|
|
|
package eu.midnightdust.midnightcontrols.client.compat;
|
|
|
|
import net.fabricmc.loader.api.FabricLoader;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.objectweb.asm.tree.ClassNode;
|
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* This plugin is only present for the conditional mixins.
|
|
*
|
|
* @author LambdAurora
|
|
* @version 1.5.0
|
|
* @since 1.2.0
|
|
*/
|
|
public class MidnightControlsMixinPlugin implements IMixinConfigPlugin {
|
|
private final HashMap<String, Boolean> conditionalMixins = new HashMap<>();
|
|
|
|
public MidnightControlsMixinPlugin() {
|
|
this.putConditionalMixin("SodiumOptionsGUIAccessor", FabricLoader.getInstance().isModLoaded("sodium"));
|
|
}
|
|
|
|
private void putConditionalMixin(@NotNull String path, boolean condition) {
|
|
this.conditionalMixins.put("eu.midnightdust.midnightcontrols.client.compat.mixin." + path, condition);
|
|
}
|
|
|
|
@Override
|
|
public void onLoad(String mixinPackage) {
|
|
}
|
|
|
|
@Override
|
|
public String getRefMapperConfig() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
|
return this.conditionalMixins.getOrDefault(mixinClassName, Boolean.TRUE);
|
|
}
|
|
|
|
@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) {
|
|
}
|
|
}
|