Commit a2baddb779f760709d2110b9bdeef0a0c1620794

Authored by Mumfrey
1 parent 7299229f

minor tweaks to EventInjectionTransformer

java/common/com/mumfrey/liteloader/transformers/event/EventInjectionTransformer.java
... ... @@ -19,6 +19,7 @@ import org.objectweb.asm.util.CheckClassAdapter;
19 19  
20 20 import com.mumfrey.liteloader.core.runtime.Obf;
21 21 import com.mumfrey.liteloader.transformers.ClassTransformer;
  22 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
22 23  
23 24 /**
24 25 * EventInjectionTransformer is the spiritual successor to the CallbackInjectionTransformer and is a more advanced
... ... @@ -226,6 +227,8 @@ public abstract class EventInjectionTransformer extends ClassTransformer
226 227  
227 228 Event head = events.iterator().next();
228 229 MethodNode handler = head.inject(insn, cancellable, this.globalEventID);
  230 +
  231 + LiteLoaderLogger.info("Injecting event %s with %d handlers in method %s in class %s", head.getName(), events.size(), method.name, classNode.name.replace('/', '.'));
229 232  
230 233 for (Event event : events)
231 234 event.addToHandler(handler);
... ...
java/common/com/mumfrey/liteloader/transformers/event/InjectionPoint.java
... ... @@ -205,4 +205,15 @@ public abstract class InjectionPoint
205 205 {
206 206 return new InjectionPoint.Shift(point, -1);
207 207 }
  208 +
  209 + /**
  210 + * Returns an injection point which returns all insns offset by the specified "count" from insns from the supplied injection point
  211 + *
  212 + * @param point
  213 + * @return
  214 + */
  215 + public static InjectionPoint shift(InjectionPoint point, int count)
  216 + {
  217 + return new InjectionPoint.Shift(point, count);
  218 + }
208 219 }
... ...