mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
Access Transformer
This commit is contained in:
parent
d430104e06
commit
06ee455342
BIN
libs/asm-5.0.3.jar
Normal file
BIN
libs/asm-5.0.3.jar
Normal file
Binary file not shown.
@ -0,0 +1,90 @@
|
|||||||
|
package net.silentclient.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.launchwrapper.IClassTransformer;
|
||||||
|
import net.silentclient.client.Client;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.MethodVisitor;
|
||||||
|
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
|
public class SilentClientTransformer implements IClassTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transform(String name, String transformedName, byte[] bytes) {
|
||||||
|
if (bytes == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transformedName.equals("bfl$e")) {
|
||||||
|
Client.logger.info("Transforming class: " + transformedName);
|
||||||
|
ClassReader classreader = new ClassReader(bytes);
|
||||||
|
ClassWriter classwriter = new ClassWriter(1);
|
||||||
|
SilentClientTransformer.AccessTransformerVisitor visitor = new SilentClientTransformer.AccessTransformerVisitor(262144, classwriter);
|
||||||
|
classreader.accept(visitor, 0);
|
||||||
|
return classwriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transformedName.equals("bfl$r")) {
|
||||||
|
Client.logger.info("Transforming class: " + transformedName);
|
||||||
|
ClassReader classreader = new ClassReader(bytes);
|
||||||
|
ClassWriter classwriter = new ClassWriter(1);
|
||||||
|
SilentClientTransformer.AccessTransformerVisitor visitor = new SilentClientTransformer.AccessTransformerVisitor(262144, classwriter);
|
||||||
|
classreader.accept(visitor, 0);
|
||||||
|
return classwriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transformedName.equals("bnm$a")) {
|
||||||
|
Client.logger.info("Transforming class: " + transformedName);
|
||||||
|
ClassReader classreader = new ClassReader(bytes);
|
||||||
|
ClassWriter classwriter = new ClassWriter(1);
|
||||||
|
SilentClientTransformer.AccessTransformerVisitor visitor = new SilentClientTransformer.AccessTransformerVisitor(262144, classwriter);
|
||||||
|
classreader.accept(visitor, 0);
|
||||||
|
return classwriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transformedName.equals("ajd$a")) {
|
||||||
|
Client.logger.info("Transforming class: " + transformedName);
|
||||||
|
ClassReader classreader = new ClassReader(bytes);
|
||||||
|
ClassWriter classwriter = new ClassWriter(1);
|
||||||
|
SilentClientTransformer.AccessTransformerVisitor visitor = new SilentClientTransformer.AccessTransformerVisitor(262144, classwriter);
|
||||||
|
classreader.accept(visitor, 0);
|
||||||
|
return classwriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transformedName.equals("bha$a")) {
|
||||||
|
Client.logger.info("Transforming class: " + transformedName);
|
||||||
|
ClassReader classreader = new ClassReader(bytes);
|
||||||
|
ClassWriter classwriter = new ClassWriter(1);
|
||||||
|
SilentClientTransformer.AccessTransformerVisitor visitor = new SilentClientTransformer.AccessTransformerVisitor(262144, classwriter);
|
||||||
|
classreader.accept(visitor, 0);
|
||||||
|
return classwriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AccessTransformerVisitor extends ClassVisitor {
|
||||||
|
|
||||||
|
public AccessTransformerVisitor(int api, ClassVisitor cv) {
|
||||||
|
super(api, cv);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitInnerClass(String name, String outerName, String innerName, int access) {
|
||||||
|
super.visitInnerClass(name, outerName, innerName, Modifier.PUBLIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||||
|
super.visit(version, Modifier.PUBLIC, name, signature, superName, interfaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||||
|
return super.visitMethod(Modifier.PUBLIC, name, desc, signature, exceptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,7 @@ public class SilentClientTweaker implements ITweaker {
|
|||||||
environment.setObfuscationContext("notch");
|
environment.setObfuscationContext("notch");
|
||||||
}
|
}
|
||||||
environment.setSide(MixinEnvironment.Side.CLIENT);
|
environment.setSide(MixinEnvironment.Side.CLIENT);
|
||||||
|
classLoader.registerTransformer("net.silentclient.client.mixin.SilentClientTransformer");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user