Commit ab107f540b4d90695f2048ee16d7bab198c375d7

Authored by Mumfrey
1 parent 5225abe9

implement onRenderWorld - closes #60

java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java
... ... @@ -2,6 +2,7 @@ package com.mumfrey.liteloader.client;
2 2  
3 3 import net.minecraft.client.Minecraft;
4 4 import net.minecraft.client.entity.EntityClientPlayerMP;
  5 +import net.minecraft.client.renderer.EntityRenderer;
5 6 import net.minecraft.client.renderer.OpenGlHelper;
6 7 import net.minecraft.client.shader.Framebuffer;
7 8 import net.minecraft.entity.player.EntityPlayerMP;
... ... @@ -307,4 +308,9 @@ public class CallbackProxyClient
307 308  
308 309 CallbackProxyClient.renderingFBO = false;
309 310 }
  311 +
  312 + public static void onRenderWorld(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
  313 + {
  314 + CallbackProxyClient.events.onRenderWorld(partialTicks, timeSlice);
  315 + }
310 316 }
... ...
java/client/com/mumfrey/liteloader/client/ClientEvents.java
... ... @@ -682,4 +682,13 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
682 682 {
683 683 this.frameBufferListeners.all().postRenderFBO(framebuffer);
684 684 }
  685 +
  686 + /**
  687 + * @param partialTicks
  688 + * @param timeSlice
  689 + */
  690 + public void onRenderWorld(float partialTicks, long timeSlice)
  691 + {
  692 + this.renderListeners.all().onRenderWorld();
  693 + }
685 694 }
... ...
java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java
... ... @@ -6,22 +6,20 @@ import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
6 6 import com.mumfrey.liteloader.transformers.event.InjectionPoint;
7 7 import com.mumfrey.liteloader.transformers.event.MethodInfo;
8 8 import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
  9 +import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke;
9 10 import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
10 11  
  12 +import static com.mumfrey.liteloader.core.runtime.Methods.*;
  13 +
11 14 public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer
12 15 {
13 16 @Override
14 17 protected void addEvents()
15 18 {
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 19 InjectionPoint methodHead = new MethodHead();
23 20 InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender);
24 21 InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture);
  22 + InjectionPoint beforePickProfiler = new BeforeStringInvoke("pick", endStartSection);
25 23  
26 24 this.addEvent(Event.getOrCreate("sendChatMessage", true), sendChatMessage, methodHead)
27 25 .addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat"));
... ... @@ -37,5 +35,8 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform
37 35  
38 36 this.addEvent(Event.getOrCreate("postRenderFBO", false), runGameLoop, InjectionPoint.after(beforeFBORender))
39 37 .addListener(new MethodInfo(Obf.CallbackProxyClient, "postRenderFBO"));;
  38 +
  39 + this.addEvent(Event.getOrCreate("onRenderWorld", false), renderWorld, beforePickProfiler)
  40 + .addListener(new MethodInfo(Obf.CallbackProxyClient, "onRenderWorld"));;
40 41 }
41 42 }
... ...
java/common/com/mumfrey/liteloader/core/runtime/Methods.java 0 → 100644
  1 +package com.mumfrey.liteloader.core.runtime;
  2 +
  3 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  4 +
  5 +/**
  6 + *
  7 + * @author Adam Mummery-Smith
  8 + */
  9 +public abstract class Methods
  10 +{
  11 + public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
  12 + public static final MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
  13 + public static final MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
  14 + public static final MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
  15 + public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityClientPlayerMP, Obf.sendChatMessage, Void.TYPE, String.class);
  16 + public static final MethodInfo renderWorld = new MethodInfo(Obf.EntityRenderer, Obf.renderWorld, Void.TYPE, Float.TYPE, Long.TYPE);
  17 +
  18 + public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class);
  19 + public static final MethodInfo endSection = new MethodInfo(Obf.Profiler, Obf.endSection, Void.TYPE);
  20 + public static final MethodInfo endStartSection = new MethodInfo(Obf.Profiler, Obf.endStartSection, Void.TYPE, String.class);
  21 +
  22 + private Methods() {}
  23 +}
... ...
java/common/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
... ... @@ -322,7 +322,7 @@ public class LiteLoaderTweaker implements ITweaker
322 322 @Override
323 323 public void injectIntoClassLoader(LaunchClassLoader classLoader)
324 324 {
325   - classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.");
  325 + classLoader.addClassLoaderExclusion("com.mumfrey.liteloader.core.runtime.Obf");
326 326  
327 327 LiteLoaderTweaker.instance.transformerManager.injectUpstreamTransformers(classLoader);
328 328  
... ...