Files
EndlessIDs/src/main/java/com/falsepattern/endlessids/IEPlugin.java
T

59 lines
1.9 KiB
Java
Raw Normal View History

2022-03-17 15:21:30 +01:00
package com.falsepattern.endlessids;
import com.falsepattern.endlessids.asm.IETransformer;
2022-07-04 18:37:15 +02:00
import lombok.SneakyThrows;
import lombok.val;
2022-07-02 20:21:50 +02:00
2022-07-04 18:37:15 +02:00
import net.minecraft.launchwrapper.LaunchClassLoader;
2022-03-17 15:21:30 +01:00
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
2022-07-02 20:21:50 +02:00
import java.util.Map;
2022-07-04 18:37:15 +02:00
import java.util.Set;
2022-07-02 20:21:50 +02:00
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn;
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.Name;
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
2022-06-15 22:28:46 +02:00
@MCVersion("1.7.10")
@Name(Tags.MODID)
2022-07-02 20:21:50 +02:00
@TransformerExclusions({"com.falsepattern.endlessids.asm"})
2022-06-15 22:28:46 +02:00
@DependsOn("falsepatternlib")
2022-07-02 20:21:50 +02:00
public class IEPlugin implements IFMLLoadingPlugin {
2022-03-17 15:21:30 +01:00
public IEPlugin() {
super();
}
2022-07-02 20:21:50 +02:00
2022-07-04 18:37:15 +02:00
@SneakyThrows
2022-03-17 15:21:30 +01:00
public String[] getASMTransformerClass() {
2022-07-11 00:04:59 +02:00
val cl = ((LaunchClassLoader) this.getClass().getClassLoader());
2022-07-04 18:37:15 +02:00
val field = cl.getClass().getDeclaredField("transformerExceptions");
field.setAccessible(true);
val exceptions = (Set<String>) field.get(cl);
if (exceptions.contains("code.elix_x.coremods")) {
2022-07-10 23:06:24 +02:00
IETransformer.logger.info("AntiIDConflict detected!");
IETransformer.logger.info("Removing ASM protections so that we can fix its code.");
2022-07-04 18:37:15 +02:00
exceptions.remove("code.elix_x.coremods");
exceptions.add("code.elix_x.coremods.antiidconflict.core");
exceptions.add("code.elix_x.coremods.antiidconflict.ByteCodeTester");
}
2022-07-02 20:21:50 +02:00
return new String[]{IETransformer.class.getName()};
2022-03-17 15:21:30 +01:00
}
2022-07-02 20:21:50 +02:00
2022-03-17 15:21:30 +01:00
public String getModContainerClass() {
return null;
}
2022-07-02 20:21:50 +02:00
2022-03-17 15:21:30 +01:00
public String getSetupClass() {
return null;
}
2022-07-02 20:21:50 +02:00
2022-03-17 15:21:30 +01:00
public void injectData(final Map<String, Object> data) {
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
}
2022-07-02 20:21:50 +02:00
2022-03-17 15:21:30 +01:00
public String getAccessTransformerClass() {
return null;
}
}