Commit bbee82bbc47ddf5a5718c4776bbe64590c7e4ec6

Authored by Mumfrey
1 parent 1b43bca7

improve readability of LiteLoaderEventInjectionTransformer

java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java
... ... @@ -13,27 +13,29 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
13 13 @Override
14 14 protected void addEvents()
15 15 {
16   - InjectionPoint head = new MethodHead();
17   -
18   - Event sendChatMessage = Event.getOrCreate("sendChatMessage", true);
19   - MethodInfo sendChatMessageTarget = new MethodInfo(Obf.EntityClientPlayerMP, Obf.sendChatMessage, Void.TYPE, String.class);
20   - this.addEvent(sendChatMessage, sendChatMessageTarget, head).addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat"));
  16 + MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
  17 + MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
  18 + MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
  19 + MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
  20 + MethodInfo sendChatMessage = new MethodInfo(Obf.EntityClientPlayerMP, Obf.sendChatMessage, Void.TYPE, String.class);
  21 +
  22 + InjectionPoint methodHead = new MethodHead();
  23 + InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender);
  24 + InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture);
21 25  
22   - Event updateFramebufferSize = Event.getOrCreate("updateFramebufferSize", false);
23   - MethodInfo updateFramebufferSizeTarget = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
24   - this.addEvent(updateFramebufferSize, updateFramebufferSizeTarget, head).addListener(new MethodInfo(Obf.CallbackProxyClient, "onResize"));
  26 + this.addEvent(Event.getOrCreate("sendChatMessage", true), sendChatMessage, methodHead)
  27 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat"));
25 28  
26   - MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, "(II)V");
27   - BeforeInvoke beforeFramebufferRender = new BeforeInvoke(framebufferRender);
  29 + this.addEvent(Event.getOrCreate("updateFramebufferSize", false), updateFramebufferSize, methodHead)
  30 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "onResize"));
28 31  
29   - Event preRenderFBO = Event.getOrCreate("preRenderFBO", false);
30   - MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
31   - this.addEvent(preRenderFBO, runGameLoop, beforeFramebufferRender).addListener(new MethodInfo(Obf.CallbackProxyClient, "preRenderFBO"));
  32 + this.addEvent(Event.getOrCreate("preRenderFBO", false), runGameLoop, beforeFBORender)
  33 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "preRenderFBO"));
32 34  
33   - Event renderFBO = Event.getOrCreate("renderFBO", false);
34   - this.addEvent(renderFBO, framebufferRender, new BeforeInvoke(new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE))).addListener(new MethodInfo(Obf.CallbackProxyClient, "renderFBO"));
  35 + this.addEvent(Event.getOrCreate("renderFBO", false), framebufferRender, beforeBindFBOTex)
  36 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "renderFBO"));
35 37  
36   - Event postRenderFBO = Event.getOrCreate("postRenderFBO", false);
37   - this.addEvent(postRenderFBO, runGameLoop, InjectionPoint.after(beforeFramebufferRender)).addListener(new MethodInfo(Obf.CallbackProxyClient, "postRenderFBO"));;
  38 + this.addEvent(Event.getOrCreate("postRenderFBO", false), runGameLoop, InjectionPoint.after(beforeFBORender))
  39 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "postRenderFBO"));;
38 40 }
39 41 }
... ...