Commit ab107f540b4d90695f2048ee16d7bab198c375d7
1 parent
5225abe9
implement onRenderWorld - closes #60
Showing
5 changed files
with
46 additions
and
7 deletions
java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java
@@ -2,6 +2,7 @@ package com.mumfrey.liteloader.client; | @@ -2,6 +2,7 @@ package com.mumfrey.liteloader.client; | ||
2 | 2 | ||
3 | import net.minecraft.client.Minecraft; | 3 | import net.minecraft.client.Minecraft; |
4 | import net.minecraft.client.entity.EntityClientPlayerMP; | 4 | import net.minecraft.client.entity.EntityClientPlayerMP; |
5 | +import net.minecraft.client.renderer.EntityRenderer; | ||
5 | import net.minecraft.client.renderer.OpenGlHelper; | 6 | import net.minecraft.client.renderer.OpenGlHelper; |
6 | import net.minecraft.client.shader.Framebuffer; | 7 | import net.minecraft.client.shader.Framebuffer; |
7 | import net.minecraft.entity.player.EntityPlayerMP; | 8 | import net.minecraft.entity.player.EntityPlayerMP; |
@@ -307,4 +308,9 @@ public class CallbackProxyClient | @@ -307,4 +308,9 @@ public class CallbackProxyClient | ||
307 | 308 | ||
308 | CallbackProxyClient.renderingFBO = false; | 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<Minecraft, IntegratedServer> | @@ -682,4 +682,13 @@ public class ClientEvents extends Events<Minecraft, IntegratedServer> | ||
682 | { | 682 | { |
683 | this.frameBufferListeners.all().postRenderFBO(framebuffer); | 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,22 +6,20 @@ import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer; | ||
6 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; | 6 | import com.mumfrey.liteloader.transformers.event.InjectionPoint; |
7 | import com.mumfrey.liteloader.transformers.event.MethodInfo; | 7 | import com.mumfrey.liteloader.transformers.event.MethodInfo; |
8 | import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke; | 8 | import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke; |
9 | +import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke; | ||
9 | import com.mumfrey.liteloader.transformers.event.inject.MethodHead; | 10 | import com.mumfrey.liteloader.transformers.event.inject.MethodHead; |
10 | 11 | ||
12 | +import static com.mumfrey.liteloader.core.runtime.Methods.*; | ||
13 | + | ||
11 | public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer | 14 | public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer |
12 | { | 15 | { |
13 | @Override | 16 | @Override |
14 | protected void addEvents() | 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 | InjectionPoint methodHead = new MethodHead(); | 19 | InjectionPoint methodHead = new MethodHead(); |
23 | InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender); | 20 | InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender); |
24 | InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture); | 21 | InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture); |
22 | + InjectionPoint beforePickProfiler = new BeforeStringInvoke("pick", endStartSection); | ||
25 | 23 | ||
26 | this.addEvent(Event.getOrCreate("sendChatMessage", true), sendChatMessage, methodHead) | 24 | this.addEvent(Event.getOrCreate("sendChatMessage", true), sendChatMessage, methodHead) |
27 | .addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat")); | 25 | .addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat")); |
@@ -37,5 +35,8 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform | @@ -37,5 +35,8 @@ public class LiteLoaderEventInjectionTransformer extends EventInjectionTransform | ||
37 | 35 | ||
38 | this.addEvent(Event.getOrCreate("postRenderFBO", false), runGameLoop, InjectionPoint.after(beforeFBORender)) | 36 | this.addEvent(Event.getOrCreate("postRenderFBO", false), runGameLoop, InjectionPoint.after(beforeFBORender)) |
39 | .addListener(new MethodInfo(Obf.CallbackProxyClient, "postRenderFBO"));; | 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,7 +322,7 @@ public class LiteLoaderTweaker implements ITweaker | ||
322 | @Override | 322 | @Override |
323 | public void injectIntoClassLoader(LaunchClassLoader classLoader) | 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 | LiteLoaderTweaker.instance.transformerManager.injectUpstreamTransformers(classLoader); | 327 | LiteLoaderTweaker.instance.transformerManager.injectUpstreamTransformers(classLoader); |
328 | 328 |