67 lines
2.5 KiB
Java
67 lines
2.5 KiB
Java
package io.gitlab.jfronny.yescheat;
|
|
|
|
import io.gitlab.jfronny.yescheat.mixin.*;
|
|
import io.gitlab.jfronny.yescheat.mixin.UncapEnchants;
|
|
import io.gitlab.jfronny.yescheat.mixin.UnlockMendingInfinity;
|
|
import org.objectweb.asm.tree.ClassNode;
|
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
|
|
|
import java.util.*;
|
|
|
|
public class Plugin implements IMixinConfigPlugin {
|
|
@Override
|
|
public void onLoad(String mixinPackage) {
|
|
}
|
|
|
|
@Override
|
|
public String getRefMapperConfig() {
|
|
return null;
|
|
}
|
|
|
|
@SuppressWarnings("ReferenceToMixin")
|
|
@Override
|
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
|
final String prefix = "io.gitlab.jfronny.yescheat.mixin.";
|
|
if (!mixinClassName.startsWith(prefix)) throw new IllegalArgumentException("Mixin in unexpected package: " + mixinClassName);
|
|
mixinClassName = mixinClassName.substring(prefix.length());
|
|
|
|
if (Objects.equals(mixinClassName, "UnblockChests"))
|
|
return Cfg.unblockChests;
|
|
else if (Objects.equals(mixinClassName, "UncapEnchants"))
|
|
return Cfg.uncapEnchants;
|
|
else if (Objects.equals(mixinClassName, "IgnoreEula"))
|
|
return true;
|
|
else if (Objects.equals(mixinClassName, "DistantContainers3x3")
|
|
|| Objects.equals(mixinClassName, "DistantContainerXx9"))
|
|
return Cfg.distantContainers;
|
|
else if (Objects.equals(mixinClassName, "UnlockMendingInfinity"))
|
|
return Cfg.unlockMending;
|
|
else if (Objects.equals(mixinClassName, "DistantBreaking"))
|
|
return Cfg.distantBreaking;
|
|
else if (Objects.equals(mixinClassName, "RemoveRubberbanding"))
|
|
return Cfg.antiRubberband;
|
|
else if (Objects.equals(mixinClassName, "VillagersFollowEmeralds"))
|
|
return Cfg.villagersFollowEmeralds;
|
|
else
|
|
throw new IllegalArgumentException("Unrecognized mixin: " + mixinClassName + "! This should never happen");
|
|
}
|
|
|
|
@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) {
|
|
}
|
|
}
|