55 lines
1.7 KiB
Java
55 lines
1.7 KiB
Java
package io.gitlab.jfronny.translater.mixin;
|
|
|
|
import io.gitlab.jfronny.libjf.LibJf;
|
|
import io.gitlab.jfronny.translater.Translater;
|
|
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 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) {
|
|
LibJf.setup();
|
|
if (Objects.equals(mixinClassName, LanguageMixin.class.getName())
|
|
|| Objects.equals(mixinClassName, TranslationStorageAccessor.class.getName()))
|
|
return true;
|
|
else if (Objects.equals(mixinClassName, MinecraftClientAccessor.class.getName()))
|
|
return Translater.progressUIEnabled();
|
|
else if (Objects.equals(mixinClassName, SplashScreenMixin.class.getName()))
|
|
return Translater.progressUIEnabled();
|
|
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) {
|
|
}
|
|
}
|