Commit cf21b1b3149fa5a5eb4fbb5e471c55f724e8ac7b
1 parent
1012613a
PreRenderListener, deprecates some of RenderListener
Showing
8 changed files
with
138 additions
and
4 deletions
debug/obfuscation.properties
... | ... | @@ -63,4 +63,7 @@ func_175087_a=handleAnimation |
63 | 63 | func_147345_a=processPlayerDigging |
64 | 64 | func_71190_q=updateTimeLightAndEntities |
65 | 65 | func_180031_a=checkThreadAndEnqueue |
66 | -func_147347_a=processPlayer | |
67 | 66 | \ No newline at end of file |
67 | +func_147347_a=processPlayer | |
68 | +func_174976_a=renderSky | |
69 | +func_180437_a=renderCloudsCheck | |
70 | +func_78468_a=setupFog | |
68 | 71 | \ No newline at end of file | ... | ... |
java/client/com/mumfrey/liteloader/PreRenderListener.java
0 → 100644
1 | +package com.mumfrey.liteloader; | |
2 | + | |
3 | +import net.minecraft.client.renderer.RenderGlobal; | |
4 | + | |
5 | +/** | |
6 | + * Render callbacks that get called before certain render events | |
7 | + * | |
8 | + * @author Adam Mummery-Smith | |
9 | + */ | |
10 | +public interface PreRenderListener extends LiteMod | |
11 | +{ | |
12 | + /** | |
13 | + * Called immediately before rendering of the world (including the sky) is started. | |
14 | + * | |
15 | + * @param partialTicks | |
16 | + */ | |
17 | + public abstract void onRenderWorld(float partialTicks); | |
18 | + | |
19 | + /** | |
20 | + * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled | |
21 | + * | |
22 | + * @param partialTicks | |
23 | + * @param pass | |
24 | + * @param timeSlice | |
25 | + */ | |
26 | + public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice); | |
27 | + | |
28 | + /** | |
29 | + * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled | |
30 | + * | |
31 | + * @param partialTicks | |
32 | + * @param pass | |
33 | + */ | |
34 | + public abstract void onRenderSky(float partialTicks, int pass); | |
35 | + | |
36 | + /** | |
37 | + * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled | |
38 | + * | |
39 | + * @param renderGlobal | |
40 | + * @param partialTicks | |
41 | + * @param pass | |
42 | + */ | |
43 | + public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal); | |
44 | + | |
45 | + /** | |
46 | + * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled | |
47 | + * | |
48 | + * @param partialTicks | |
49 | + * @param pass | |
50 | + */ | |
51 | + public abstract void onRenderTerrain(float partialTicks, int pass); | |
52 | +} | ... | ... |
java/client/com/mumfrey/liteloader/RenderListener.java
... | ... | @@ -23,7 +23,10 @@ public interface RenderListener extends LiteMod |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Called when the world is rendered |
26 | + * | |
27 | + * @deprecated Use PreRenderListener::onRenderWorld(F)V instead | |
26 | 28 | */ |
29 | + @Deprecated | |
27 | 30 | public abstract void onRenderWorld(); |
28 | 31 | |
29 | 32 | /** | ... | ... |
java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java
... | ... | @@ -8,6 +8,7 @@ import net.minecraft.client.entity.EntityPlayerSP; |
8 | 8 | import net.minecraft.client.gui.GuiIngame; |
9 | 9 | import net.minecraft.client.renderer.EntityRenderer; |
10 | 10 | import net.minecraft.client.renderer.OpenGlHelper; |
11 | +import net.minecraft.client.renderer.RenderGlobal; | |
11 | 12 | import net.minecraft.client.renderer.entity.Render; |
12 | 13 | import net.minecraft.client.renderer.entity.RenderManager; |
13 | 14 | import net.minecraft.client.shader.Framebuffer; |
... | ... | @@ -81,7 +82,7 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon |
81 | 82 | |
82 | 83 | public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice) |
83 | 84 | { |
84 | - CallbackProxyClient.clientEventBroker.onSetupCameraTransform(partialTicks, timeSlice); | |
85 | + CallbackProxyClient.clientEventBroker.onSetupCameraTransform(pass, partialTicks, timeSlice); | |
85 | 86 | } |
86 | 87 | |
87 | 88 | public static void postRenderEntities(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice) |
... | ... | @@ -169,6 +170,21 @@ public abstract class CallbackProxyClient extends CallbackProxyCommon |
169 | 170 | CallbackProxyClient.clientEventBroker.onRenderWorld(partialTicks, timeSlice); |
170 | 171 | } |
171 | 172 | |
173 | + public static void onRenderSky(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice) | |
174 | + { | |
175 | + CallbackProxyClient.clientEventBroker.onRenderSky(partialTicks, pass, timeSlice); | |
176 | + } | |
177 | + | |
178 | + public static void onRenderClouds(EventInfo<EntityRenderer> e, RenderGlobal renderGlobalIn, float partialTicks, int pass) | |
179 | + { | |
180 | + CallbackProxyClient.clientEventBroker.onRenderClouds(partialTicks, pass, renderGlobalIn); | |
181 | + } | |
182 | + | |
183 | + public static void onRenderTerrain(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice) | |
184 | + { | |
185 | + CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice); | |
186 | + } | |
187 | + | |
172 | 188 | public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height, Framebuffer fbo) |
173 | 189 | { |
174 | 190 | CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo); | ... | ... |
java/client/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
... | ... | @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft; |
4 | 4 | import net.minecraft.client.entity.EntityPlayerSP; |
5 | 5 | import net.minecraft.client.gui.GuiNewChat; |
6 | 6 | import net.minecraft.client.gui.ScaledResolution; |
7 | +import net.minecraft.client.renderer.RenderGlobal; | |
7 | 8 | import net.minecraft.client.renderer.entity.Render; |
8 | 9 | import net.minecraft.client.renderer.entity.RenderManager; |
9 | 10 | import net.minecraft.client.resources.IResourceManager; |
... | ... | @@ -67,6 +68,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft |
67 | 68 | private FastIterableDeque<Tickable> tickListeners; |
68 | 69 | private FastIterableDeque<GameLoopListener> loopListeners = new HandlerList<GameLoopListener>(GameLoopListener.class); |
69 | 70 | private FastIterableDeque<RenderListener> renderListeners = new HandlerList<RenderListener>(RenderListener.class); |
71 | + private FastIterableDeque<PreRenderListener> preRenderListeners = new HandlerList<PreRenderListener>(PreRenderListener.class); | |
70 | 72 | private FastIterableDeque<PostRenderListener> postRenderListeners = new HandlerList<PostRenderListener>(PostRenderListener.class); |
71 | 73 | private FastIterableDeque<HUDRenderListener> hudRenderListeners = new HandlerList<HUDRenderListener>(HUDRenderListener.class); |
72 | 74 | private FastIterableDeque<ChatRenderListener> chatRenderListeners = new HandlerList<ChatRenderListener>(ChatRenderListener.class); |
... | ... | @@ -111,6 +113,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft |
111 | 113 | delegate.registerInterface(Tickable.class); |
112 | 114 | delegate.registerInterface(GameLoopListener.class); |
113 | 115 | delegate.registerInterface(RenderListener.class); |
116 | + delegate.registerInterface(PreRenderListener.class); | |
114 | 117 | delegate.registerInterface(PostRenderListener.class); |
115 | 118 | delegate.registerInterface(HUDRenderListener.class); |
116 | 119 | delegate.registerInterface(ChatRenderListener.class); |
... | ... | @@ -164,6 +167,14 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft |
164 | 167 | } |
165 | 168 | |
166 | 169 | /** |
170 | + * @param preRenderListener | |
171 | + */ | |
172 | + public void addPreRenderListener(PreRenderListener preRenderListener) | |
173 | + { | |
174 | + this.preRenderListeners.add(preRenderListener); | |
175 | + } | |
176 | + | |
177 | + /** | |
167 | 178 | * @param postRenderListener |
168 | 179 | */ |
169 | 180 | public void addPostRenderListener(PostRenderListener postRenderListener) |
... | ... | @@ -320,12 +331,14 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft |
320 | 331 | /** |
321 | 332 | * Called immediately after the world/camera transform is initialised |
322 | 333 | * |
334 | + * @param pass | |
323 | 335 | * @param timeSlice |
324 | 336 | * @param partialTicks |
325 | 337 | */ |
326 | - void onSetupCameraTransform(float partialTicks, long timeSlice) | |
338 | + void onSetupCameraTransform(int pass, float partialTicks, long timeSlice) | |
327 | 339 | { |
328 | 340 | this.renderListeners.all().onSetupCameraTransform(); |
341 | + this.preRenderListeners.all().onSetupCameraTransform(partialTicks, pass, timeSlice); | |
329 | 342 | } |
330 | 343 | |
331 | 344 | /** |
... | ... | @@ -466,10 +479,41 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft |
466 | 479 | */ |
467 | 480 | void onRenderWorld(float partialTicks, long timeSlice) |
468 | 481 | { |
482 | + this.preRenderListeners.all().onRenderWorld(partialTicks); | |
469 | 483 | this.renderListeners.all().onRenderWorld(); |
470 | 484 | } |
471 | 485 | |
472 | 486 | /** |
487 | + * @param partialTicks | |
488 | + * @param pass | |
489 | + * @param timeSlice | |
490 | + */ | |
491 | + void onRenderSky(float partialTicks, int pass, long timeSlice) | |
492 | + { | |
493 | + this.preRenderListeners.all().onRenderSky(partialTicks, pass); | |
494 | + } | |
495 | + | |
496 | + /** | |
497 | + * @param partialTicks | |
498 | + * @param pass | |
499 | + * @param renderGlobal | |
500 | + */ | |
501 | + void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal) | |
502 | + { | |
503 | + this.preRenderListeners.all().onRenderClouds(partialTicks, pass, renderGlobal); | |
504 | + } | |
505 | + | |
506 | + /** | |
507 | + * @param partialTicks | |
508 | + * @param pass | |
509 | + * @param timeSlice | |
510 | + */ | |
511 | + void onRenderTerrain(float partialTicks, int pass, long timeSlice) | |
512 | + { | |
513 | + this.preRenderListeners.all().onRenderTerrain(partialTicks, pass); | |
514 | + } | |
515 | + | |
516 | + /** | |
473 | 517 | * @param e |
474 | 518 | * @param name |
475 | 519 | * @param width | ... | ... |
java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java
... | ... | @@ -38,6 +38,9 @@ public class LiteLoaderEventInjectionTransformer extends LiteLoaderEventTransfor |
38 | 38 | Event renderFBO = Event.getOrCreate("renderFBO", false); |
39 | 39 | Event postRenderFBO = Event.getOrCreate("postRenderFBO", false); |
40 | 40 | Event onRenderWorld = Event.getOrCreate("onRenderWorld", false); |
41 | + Event onRenderSky = Event.getOrCreate("onRenderSky", false); | |
42 | + Event onRenderClouds = Event.getOrCreate("onRenderClouds", false); | |
43 | + Event onRenderTerrain = Event.getOrCreate("onRenderTerrain", false); | |
41 | 44 | Event onTimerUpdate = Event.getOrCreate("onTimerUpdate", false); |
42 | 45 | Event onRender = Event.getOrCreate("onRender", false); |
43 | 46 | Event newTick = Event.getOrCreate("newTick", false); |
... | ... | @@ -73,6 +76,9 @@ public class LiteLoaderEventInjectionTransformer extends LiteLoaderEventTransfor |
73 | 76 | InjectionPoint beforeStopRealsmFetcher = new BeforeInvoke(realmsStopFetcher).setCaptureLocals(true); |
74 | 77 | InjectionPoint beforeTickProfiler = new BeforeStringInvoke("tick", startSection); |
75 | 78 | InjectionPoint beforeCenterProfiler = new BeforeStringInvoke("center", startSection); |
79 | + InjectionPoint beforeSkyProfiler = new BeforeStringInvoke("sky", endStartSection); | |
80 | + InjectionPoint beforeCloudsProfiler = new BeforeStringInvoke("clouds", endStartSection); | |
81 | + InjectionPoint beforeTerrainProfiler = new BeforeStringInvoke("terrain", endStartSection); | |
76 | 82 | InjectionPoint beforeRenderProfiler = new BeforeStringInvoke("gameRenderer", endStartSection); |
77 | 83 | InjectionPoint beforeFrustumProfiler = new BeforeStringInvoke("frustum", endStartSection); |
78 | 84 | InjectionPoint beforeParticlesProfiler = new BeforeStringInvoke("litParticles", endStartSection); |
... | ... | @@ -85,6 +91,9 @@ public class LiteLoaderEventInjectionTransformer extends LiteLoaderEventTransfor |
85 | 91 | this.add(renderFBO, framebufferRenderExt, (beforeBindFBOTex), "renderFBO"); |
86 | 92 | this.add(postRenderFBO, runGameLoop, after(beforeFBORender), "postRenderFBO"); |
87 | 93 | this.add(onRenderWorld, renderWorld, (beforeCenterProfiler), "onRenderWorld"); |
94 | + this.add(onRenderSky, renderWorldPass, (beforeSkyProfiler), "onRenderSky"); | |
95 | + this.add(onRenderClouds, renderCloudsCheck, (beforeCloudsProfiler), "onRenderClouds"); | |
96 | + this.add(onRenderTerrain, renderWorldPass, (beforeTerrainProfiler), "onRenderTerrain"); | |
88 | 97 | this.add(onTimerUpdate, runGameLoop, (beforeTickProfiler), "onTimerUpdate"); |
89 | 98 | this.add(onRender, runGameLoop, (beforeRenderProfiler), "onRender"); |
90 | 99 | this.add(newTick, runTick, (methodHead), "newTick"); | ... | ... |
java/common/com/mumfrey/liteloader/core/runtime/Methods.java
... | ... | @@ -50,6 +50,9 @@ public abstract class Methods |
50 | 50 | public static final MethodInfo serverJobs = new MethodInfo(Obf.MinecraftServer, Obf.updateTimeLightAndEntities, Void.TYPE); |
51 | 51 | public static final MethodInfo checkThreadAndEnqueue = new MethodInfo(Obf.PacketThreadUtil, Obf.checkThreadAndEnqueue); |
52 | 52 | public static final MethodInfo processPlayer = new MethodInfo(Obf.NetHandlerPlayServer, Obf.processPlayer, Void.TYPE, Packets.C03PacketPlayer); |
53 | + public static final MethodInfo renderSky = new MethodInfo(Obf.RenderGlobal, Obf.renderSky, Void.TYPE, Float.TYPE, Integer.TYPE); | |
54 | + public static final MethodInfo renderCloudsCheck = new MethodInfo(Obf.EntityRenderer, Obf.renderCloudsCheck, Void.TYPE, Obf.RenderGlobal, Float.TYPE, Integer.TYPE); | |
55 | + public static final MethodInfo setupFog = new MethodInfo(Obf.EntityRenderer, Obf.setupFog, Void.TYPE, Integer.TYPE, Float.TYPE); | |
53 | 56 | |
54 | 57 | // Profiler |
55 | 58 | public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class); | ... | ... |
java/common/com/mumfrey/liteloader/core/runtime/Obf.java
... | ... | @@ -79,6 +79,7 @@ public class Obf |
79 | 79 | public static final Obf World = new Obf("net.minecraft.world.World", "aqu" ); |
80 | 80 | public static final Obf ItemStack = new Obf("net.minecraft.item.ItemStack", "amj" ); |
81 | 81 | public static final Obf PacketThreadUtil = new Obf("net.minecraft.network.PacketThreadUtil", "ig" ); |
82 | + public static final Obf RenderGlobal = new Obf("net.minecraft.client.renderer.RenderGlobal", "ckn" ); | |
82 | 83 | |
83 | 84 | // Fields |
84 | 85 | // ----------------------------------------------------------------------------------------- |
... | ... | @@ -152,7 +153,10 @@ public class Obf |
152 | 153 | public static final Obf updateTimeLightAndEntities = new Obf("func_71190_q", "z" ); |
153 | 154 | public static final Obf checkThreadAndEnqueue = new Obf("func_180031_a", "a" ); |
154 | 155 | public static final Obf processPlayer = new Obf("func_147347_a", "a" ); |
155 | - | |
156 | + public static final Obf renderSky = new Obf("func_174976_a", "a" ); | |
157 | + public static final Obf renderCloudsCheck = new Obf("func_180437_a", "a" ); | |
158 | + public static final Obf setupFog = new Obf("func_78468_a", "a" ); | |
159 | + | |
156 | 160 | public static final int MCP = 0; |
157 | 161 | public static final int SRG = 1; |
158 | 162 | public static final int OBF = 2; | ... | ... |