QuickMath/src/main/java/io/gitlab/jfronny/quickmeth/MixinPlugin.java

58 lines
1.7 KiB
Java
Raw Normal View History

2020-08-07 11:02:13 +02:00
package io.gitlab.jfronny.quickmeth;
2021-05-29 15:54:38 +02:00
import io.gitlab.jfronny.quickmeth.mixin.*;
2020-08-07 11:02:13 +02:00
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.Objects;
import java.util.Set;
public class MixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
}
@Override
public String getRefMapperConfig() {
return null;
}
@SuppressWarnings("ReferenceToMixin")
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (Objects.equals(mixinClassName, MathHelperMixin.class.getName()))
2021-05-19 15:12:49 +02:00
return Cfg.corruptGenericMath;
2021-05-29 15:54:38 +02:00
else if (Objects.equals(mixinClassName, MathHelperMixin2.class.getName()))
return Cfg.corruptGenericMath2;
2020-08-07 11:02:13 +02:00
else if (Objects.equals(mixinClassName, MixinPerlinNoiseSampler.class.getName()))
2021-05-19 15:12:49 +02:00
return Cfg.corruptPerlinNoise;
2020-08-07 11:02:13 +02:00
else if (Objects.equals(mixinClassName, MixinSimplexNoiseSampler.class.getName()))
2021-05-19 15:12:49 +02:00
return Cfg.corruptSimplexNoise;
2020-08-07 11:02:13 +02:00
else
throw new IllegalStateException("Unrecognized mixin! 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) {
}
}