Commit 5274b27dab41fc649d0e08f222e0b27e74646bec

Authored by Mumfrey
1 parent d5149881

handle srg names in PacketTransformers so that we don't break when using FML

java/com/mumfrey/liteloader/transformers/PacketTransformer.java
@@ -111,13 +111,13 @@ public abstract class PacketTransformer implements IClassTransformer @@ -111,13 +111,13 @@ public abstract class PacketTransformer implements IClassTransformer
111 @Override 111 @Override
112 public final byte[] transform(String name, String transformedName, byte[] basicClass) 112 public final byte[] transform(String name, String transformedName, byte[] basicClass)
113 { 113 {
114 - if (this.packetClass.equals(name) || this.packetClassObf.equals(name)) 114 + if (this.packetClass.equals(transformedName) || this.packetClassObf.equals(transformedName))
115 { 115 {
116 LiteLoaderLogger.info("PacketTransformer: Running transformer %s for %s", this.getClass().getName(), name); 116 LiteLoaderLogger.info("PacketTransformer: Running transformer %s for %s", this.getClass().getName(), name);
117 117
118 try 118 try
119 { 119 {
120 - byte[] transformedClass = this.transformClass(name, basicClass); 120 + byte[] transformedClass = this.transformClass(transformedName, basicClass);
121 this.notifyInjected(); 121 this.notifyInjected();
122 return transformedClass; 122 return transformedClass;
123 } 123 }
@@ -143,10 +143,14 @@ public abstract class PacketTransformer implements IClassTransformer @@ -143,10 +143,14 @@ public abstract class PacketTransformer implements IClassTransformer
143 // Try and transform obfuscated first 143 // Try and transform obfuscated first
144 if (!this.tryTransformMethod(className, classNode, Obf.processPacket.obf, Obf.INetHandler.obf)) 144 if (!this.tryTransformMethod(className, classNode, Obf.processPacket.obf, Obf.INetHandler.obf))
145 { 145 {
146 - // Try to transform non-obf for use in dev env  
147 - if (!this.tryTransformMethod(className, classNode, Obf.processPacket.name, Obf.INetHandler.ref)) 146 + // Try to transform srg for use with fml
  147 + if (!this.tryTransformMethod(className, classNode, Obf.processPacket.srg, Obf.INetHandler.ref))
148 { 148 {
149 - LiteLoaderLogger.warning("PacketTransformer: failed transforming class '%s' (%s)", this.packetClass, this.packetClassObf); 149 + // Try to transform non-obf for use in dev env
  150 + if (!this.tryTransformMethod(className, classNode, Obf.processPacket.name, Obf.INetHandler.ref))
  151 + {
  152 + LiteLoaderLogger.warning("PacketTransformer: failed transforming class '%s' (%s)", this.packetClass, this.packetClassObf);
  153 + }
150 } 154 }
151 } 155 }
152 156