Commit c24f0490ade7c568cc5bc0aa346626fcd9e32dc6

Authored by Mumfrey
1 parent e7914a05

replacing all CallbackInjectionTransformer hooks with EventInjectionTransformer hooks

debug/obfuscation.properties
1 field_71424_I=mcProfiler 1 field_71424_I=mcProfiler
2 field_78729_o=entityRenderMap field_110546_b=reloadListeners 2 field_78729_o=entityRenderMap field_110546_b=reloadListeners
3 func_148833_a=processPacket func_71411_J=runGameLoop func_71407_l=runTick func_78480_b=updateCameraAndRender func_78471_a=renderWorld func_73830_a=renderGameOverlay func_76320_a=startSection func_76319_b=endSection func_76318_c=endStartSection 3 func_148833_a=processPacket func_71411_J=runGameLoop func_71407_l=runTick func_78480_b=updateCameraAndRender func_78471_a=renderWorld func_73830_a=renderGameOverlay func_76320_a=startSection func_76319_b=endSection func_76318_c=endStartSection
4 -func_72368_a=recreatePlayerEntity func_72355_a=initializeConnectionToPlayer func_72377_c=playerLoggedIn func_72367_e=playerLoggedOut 4 +func_72368_a=respawnPlayer func_72355_a=initializeConnectionToPlayer func_72377_c=playerLoggedIn func_72367_e=playerLoggedOut
5 func_71384_a=startGame 5 func_71384_a=startGame
6 func_71197_b=startServer 6 func_71197_b=startServer
7 func_71256_s=startServerThread 7 func_71256_s=startServerThread
@@ -16,4 +16,5 @@ field_147559_m=mapSpecialRenderers @@ -16,4 +16,5 @@ field_147559_m=mapSpecialRenderers
16 field_145855_i=nameToClassMap 16 field_145855_i=nameToClassMap
17 field_145853_j=classToNameMap 17 field_145853_j=classToNameMap
18 func_147615_c=framebufferRender 18 func_147615_c=framebufferRender
19 -func_147612_c=bindFramebufferTexture  
20 \ No newline at end of file 19 \ No newline at end of file
  20 +func_147612_c=bindFramebufferTexture
  21 +func_146230_a=drawChat
21 \ No newline at end of file 22 \ No newline at end of file
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.gui.GuiIngame;
5 import net.minecraft.client.renderer.EntityRenderer; 6 import net.minecraft.client.renderer.EntityRenderer;
6 import net.minecraft.client.renderer.OpenGlHelper; 7 import net.minecraft.client.renderer.OpenGlHelper;
7 import net.minecraft.client.shader.Framebuffer; 8 import net.minecraft.client.shader.Framebuffer;
@@ -26,6 +27,7 @@ import com.mumfrey.liteloader.core.ClientPluginChannels; @@ -26,6 +27,7 @@ import com.mumfrey.liteloader.core.ClientPluginChannels;
26 import com.mumfrey.liteloader.core.LiteLoader; 27 import com.mumfrey.liteloader.core.LiteLoader;
27 import com.mumfrey.liteloader.core.ServerPluginChannels; 28 import com.mumfrey.liteloader.core.ServerPluginChannels;
28 import com.mumfrey.liteloader.transformers.event.EventInfo; 29 import com.mumfrey.liteloader.transformers.event.EventInfo;
  30 +import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
29 31
30 /** 32 /**
31 * Proxy class which handles the redirected calls from the injected callbacks and routes them to the 33 * Proxy class which handles the redirected calls from the injected callbacks and routes them to the
@@ -124,7 +126,7 @@ public class CallbackProxyClient @@ -124,7 +126,7 @@ public class CallbackProxyClient
124 pluginChannels.onPluginChannelMessage((INetHandlerPlayServer)netHandler, packet); 126 pluginChannels.onPluginChannelMessage((INetHandlerPlayServer)netHandler, packet);
125 } 127 }
126 128
127 - public static void onStartupComplete(int ref, Minecraft minecraft) 129 + public static void onStartupComplete(EventInfo<Minecraft> e)
128 { 130 {
129 CallbackProxyClient.events = ClientEvents.getInstance(); 131 CallbackProxyClient.events = ClientEvents.getInstance();
130 132
@@ -136,138 +138,95 @@ public class CallbackProxyClient @@ -136,138 +138,95 @@ public class CallbackProxyClient
136 CallbackProxyClient.events.onStartupComplete(); 138 CallbackProxyClient.events.onStartupComplete();
137 } 139 }
138 140
139 - public static void onTimerUpdate(int ref) 141 + public static void onTimerUpdate(EventInfo<Minecraft> e)
140 { 142 {
141 CallbackProxyClient.events.onTimerUpdate(); 143 CallbackProxyClient.events.onTimerUpdate();
142 } 144 }
143 145
144 - public static void onAnimateTick(int ref) 146 + public static void newTick(EventInfo<Minecraft> e)
145 { 147 {
146 CallbackProxyClient.clock = true; 148 CallbackProxyClient.clock = true;
147 } 149 }
148 150
149 - public static void onTick(int ref) 151 + public static void onTick(EventInfo<Minecraft> e)
150 { 152 {
151 - if (ref == 2)  
152 - {  
153 - CallbackProxyClient.events.onTick(CallbackProxyClient.clock);  
154 - CallbackProxyClient.clock = false;  
155 - } 153 + CallbackProxyClient.events.onTick(CallbackProxyClient.clock);
  154 + CallbackProxyClient.clock = false;
156 } 155 }
157 156
158 - public static void onRender(int ref) 157 + public static void onRender(EventInfo<Minecraft> e)
159 { 158 {
160 CallbackProxyClient.events.onRender(); 159 CallbackProxyClient.events.onRender();
161 } 160 }
162 161
163 - public static void preRenderGUI(int ref) 162 + public static void preRenderGUI(EventInfo<EntityRenderer> e, float partialTicks)
164 { 163 {
165 - if (ref == 1)  
166 - {  
167 - CallbackProxyClient.events.preRenderGUI(ref);  
168 - } 164 + CallbackProxyClient.events.preRenderGUI(partialTicks);
169 } 165 }
170 166
171 - public static void onSetupCameraTransform(int ref) 167 + public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
172 { 168 {
173 - CallbackProxyClient.events.onSetupCameraTransform(); 169 + CallbackProxyClient.events.onSetupCameraTransform(partialTicks, timeSlice);
174 } 170 }
175 171
176 - public static void postRenderEntities(int ref) 172 + public static void postRenderEntities(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
177 { 173 {
178 - CallbackProxyClient.events.postRenderEntities(); 174 + CallbackProxyClient.events.postRenderEntities(partialTicks, timeSlice);
179 } 175 }
180 176
181 - public static void postRender(int ref) 177 + public static void postRender(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
182 { 178 {
183 - CallbackProxyClient.events.postRender(); 179 + CallbackProxyClient.events.postRender(partialTicks, timeSlice);
184 } 180 }
185 181
186 - public static void onRenderHUD(int ref) 182 + public static void onRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
187 { 183 {
188 - CallbackProxyClient.events.onRenderHUD(); 184 + CallbackProxyClient.events.onRenderHUD(partialTicks);
189 } 185 }
190 186
191 - public static void onRenderChat(int ref) 187 + public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks, boolean guiActive, int mouseX, int mouseY)
192 { 188 {
193 - CallbackProxyClient.events.onRenderChat(); 189 + CallbackProxyClient.events.onRenderChat(e.getSource().getChatGUI(), partialTicks, guiActive, mouseX, mouseY);
194 } 190 }
195 191
196 - public static void postRenderChat(int ref) 192 + public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks, boolean guiActive, int mouseX, int mouseY)
197 { 193 {
198 - if (ref == 10)  
199 - {  
200 - CallbackProxyClient.events.postRenderChat();  
201 - } 194 + CallbackProxyClient.events.postRenderChat(e.getSource().getChatGUI(), partialTicks, guiActive, mouseX, mouseY);
202 } 195 }
203 196
204 - public static void postRenderHUDandGUI(int ref) 197 + public static void postRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
205 { 198 {
206 - if (ref == 2)  
207 - {  
208 - CallbackProxyClient.events.postRenderHUD();  
209 - CallbackProxyClient.events.preRenderGUI(ref);  
210 - } 199 + CallbackProxyClient.events.postRenderHUD(partialTicks);
211 } 200 }
212 201
213 - public static void IntegratedServerCtor(int ref, IntegratedServer instance, Minecraft minecraft, String folderName, String worldName, WorldSettings worldSettings) 202 + public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName, WorldSettings worldSettings)
214 { 203 {
215 - if (ref == 0)  
216 - {  
217 - CallbackProxyClient.events.onStartServer(instance, folderName, worldName, worldSettings);  
218 - } 204 + CallbackProxyClient.events.onStartServer(e.getSource(), folderName, worldName, worldSettings);
219 } 205 }
220 206
221 - public static void onInitializePlayerConnection(int ref, ServerConfigurationManager scm, NetworkManager netManager, EntityPlayerMP player) 207 + public static void onInitializePlayerConnection(EventInfo<ServerConfigurationManager> e, NetworkManager netManager, EntityPlayerMP player)
222 { 208 {
223 - if (ref == 0)  
224 - {  
225 - CallbackProxyClient.events.onInitializePlayerConnection(scm, netManager, player);  
226 - } 209 + CallbackProxyClient.events.onInitializePlayerConnection(e.getSource(), netManager, player);
227 } 210 }
228 211
229 - public static void onPlayerLogin(int ref, ServerConfigurationManager scm, EntityPlayerMP player) 212 + public static void onPlayerLogin(EventInfo<ServerConfigurationManager> e, EntityPlayerMP player)
230 { 213 {
231 - if (ref == 0)  
232 - {  
233 - CallbackProxyClient.events.onPlayerLogin(scm, player);  
234 - } 214 + CallbackProxyClient.events.onPlayerLogin(e.getSource(), player);
235 } 215 }
236 216
237 - public static void onPlayerLogout(int ref, ServerConfigurationManager scm, EntityPlayerMP player) 217 + public static void onPlayerLogout(EventInfo<ServerConfigurationManager> e, EntityPlayerMP player)
238 { 218 {
239 - if (ref == 0)  
240 - {  
241 - CallbackProxyClient.events.onPlayerLogout(scm, player);  
242 - } 219 + CallbackProxyClient.events.onPlayerLogout(e.getSource(), player);
243 } 220 }
244 221
245 - public static EntityPlayerMP onSpawnPlayer(EntityPlayerMP returnValue, int ref, ServerConfigurationManager scm, GameProfile profile) 222 + public static void onSpawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, GameProfile profile)
246 { 223 {
247 - if (ref == 0)  
248 - {  
249 - CallbackProxyClient.events.onSpawnPlayer(scm, returnValue, profile);  
250 - }  
251 -  
252 - return returnValue; 224 + CallbackProxyClient.events.onSpawnPlayer(e.getSource(), e.getReturnValue(), profile);
253 } 225 }
254 226
255 - public static EntityPlayerMP onRespawnPlayer(EntityPlayerMP returnValue, int ref, ServerConfigurationManager scm, EntityPlayerMP oldPlayer, int dimension, boolean won) 227 + public static void onRespawnPlayer(ReturnEventInfo<ServerConfigurationManager, EntityPlayerMP> e, EntityPlayerMP oldPlayer, int dimension, boolean won)
256 { 228 {
257 - if (ref == 0)  
258 - {  
259 - CallbackProxyClient.events.onRespawnPlayer(scm, returnValue, oldPlayer, dimension, won);  
260 - }  
261 -  
262 - return returnValue;  
263 - }  
264 -  
265 - public static void onOutboundChat(int ref, C01PacketChatMessage packet, String message)  
266 - {  
267 - if (ref == 0)  
268 - {  
269 - CallbackProxyClient.events.onSendChatMessage(packet, message);  
270 - } 229 + CallbackProxyClient.events.onRespawnPlayer(e.getSource(), e.getReturnValue(), oldPlayer, dimension, won);
271 } 230 }
272 231
273 public static void onOutboundChat(EventInfo<EntityClientPlayerMP> e, String message) 232 public static void onOutboundChat(EventInfo<EntityClientPlayerMP> e, String message)
java/client/com/mumfrey/liteloader/client/ClientEvents.java
@@ -401,8 +401,11 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt; @@ -401,8 +401,11 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
401 401
402 /** 402 /**
403 * Callback from the tick hook, post render entities 403 * Callback from the tick hook, post render entities
  404 + *
  405 + * @param timeSlice
  406 + * @param partialTicks2
404 */ 407 */
405 - void postRenderEntities() 408 + void postRenderEntities(float partialTicks2, long timeSlice)
406 { 409 {
407 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F; 410 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F;
408 this.postRenderListeners.all().onPostRenderEntities(partialTicks); 411 this.postRenderListeners.all().onPostRenderEntities(partialTicks);
@@ -410,8 +413,11 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt; @@ -410,8 +413,11 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
410 413
411 /** 414 /**
412 * Callback from the tick hook, post render 415 * Callback from the tick hook, post render
  416 + *
  417 + * @param timeSlice
  418 + * @param partialTicks2
413 */ 419 */
414 - void postRender() 420 + void postRender(float partialTicks2, long timeSlice)
415 { 421 {
416 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F; 422 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F;
417 this.postRenderListeners.all().onPostRender(partialTicks); 423 this.postRenderListeners.all().onPostRender(partialTicks);
@@ -420,37 +426,40 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt; @@ -420,37 +426,40 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
420 /** 426 /**
421 * Called immediately before the current GUI is rendered 427 * Called immediately before the current GUI is rendered
422 */ 428 */
423 - void preRenderGUI(int ref) 429 + void preRenderGUI(float partialTicks)
424 { 430 {
425 - Minecraft minecraft = this.engine.getClient();  
426 -  
427 - if (!minecraft.skipRenderWorld && ref == (minecraft.theWorld == null ? 1 : 2))  
428 - {  
429 - this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen());  
430 - } 431 + this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen());
431 } 432 }
432 433
433 /** 434 /**
434 * Called immediately after the world/camera transform is initialised 435 * Called immediately after the world/camera transform is initialised
  436 + *
  437 + * @param timeSlice
  438 + * @param partialTicks
435 */ 439 */
436 - void onSetupCameraTransform() 440 + void onSetupCameraTransform(float partialTicks, long timeSlice)
437 { 441 {
438 this.renderListeners.all().onSetupCameraTransform(); 442 this.renderListeners.all().onSetupCameraTransform();
439 } 443 }
440 444
441 /** 445 /**
442 * Called immediately before the chat log is rendered 446 * Called immediately before the chat log is rendered
  447 + *
  448 + * @param chatGui
  449 + * @param mouseY
  450 + * @param mouseX
  451 + * @param guiActive
  452 + * @param partialTicks
443 */ 453 */
444 - void onRenderChat() 454 + void onRenderChat(GuiNewChat chatGui, float partialTicks, boolean guiActive, int mouseX, int mouseY)
445 { 455 {
446 - GuiNewChat chat = this.engineClient.getChatGUI();  
447 - this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chat); 456 + this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui);
448 } 457 }
449 458
450 /** 459 /**
451 * Called immediately after the chat log is rendered 460 * Called immediately after the chat log is rendered
452 */ 461 */
453 - void postRenderChat() 462 + void postRenderChat(GuiNewChat chatGui, float partialTicks, boolean guiActive, int mouseX, int mouseY)
454 { 463 {
455 GuiNewChat chat = this.engineClient.getChatGUI(); 464 GuiNewChat chat = this.engineClient.getChatGUI();
456 this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat); 465 this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat);
@@ -459,23 +468,17 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt; @@ -459,23 +468,17 @@ public class ClientEvents extends Events&lt;Minecraft, IntegratedServer&gt;
459 /** 468 /**
460 * Callback when about to render the HUD 469 * Callback when about to render the HUD
461 */ 470 */
462 - void onRenderHUD() 471 + void onRenderHUD(float partialTicks)
463 { 472 {
464 - if (!this.engineClient.hideGUI() || this.engineClient.getCurrentScreen() != null)  
465 - {  
466 - this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight);  
467 - } 473 + this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight);
468 } 474 }
469 475
470 /** 476 /**
471 * Callback when the HUD has just been rendered 477 * Callback when the HUD has just been rendered
472 */ 478 */
473 - void postRenderHUD() 479 + void postRenderHUD(float partialTicks)
474 { 480 {
475 - if (!this.engineClient.hideGUI() || this.engineClient.getCurrentScreen() != null)  
476 - {  
477 - this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight);  
478 - } 481 + this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight);
479 } 482 }
480 483
481 /** 484 /**
java/client/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java
@@ -32,7 +32,6 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI @@ -32,7 +32,6 @@ public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
32 }; 32 };
33 33
34 private static final String[] requiredDownstreamTransformers = { 34 private static final String[] requiredDownstreamTransformers = {
35 - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderCallbackInjectionTransformer",  
36 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer", 35 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",
37 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftOverlayTransformer" 36 LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftOverlayTransformer"
38 }; 37 };
java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderCallbackInjectionTransformer.java deleted 100644 โ†’ 0
1 -package com.mumfrey.liteloader.client.transformers;  
2 -  
3 -import org.objectweb.asm.Type;  
4 -  
5 -import com.mumfrey.liteloader.core.runtime.Obf;  
6 -import com.mumfrey.liteloader.transformers.Callback;  
7 -import com.mumfrey.liteloader.transformers.CallbackInjectionTransformer;  
8 -import com.mumfrey.liteloader.transformers.Callback.CallbackType;  
9 -  
10 -/**  
11 - * Transformer which injects method calls in place of the old profiler hook  
12 - *  
13 - * @author Adam Mummery-Smith  
14 - */  
15 -public final class LiteLoaderCallbackInjectionTransformer extends CallbackInjectionTransformer  
16 -{  
17 - /**  
18 - * Add mappings  
19 - */  
20 - @Override  
21 - protected void addCallbacks()  
22 - {  
23 - this.addCallbacks(Obf.MCP); // @MCPONLY  
24 - this.addCallbacks(Obf.SRG);  
25 - this.addCallbacks(Obf.OBF);  
26 - }  
27 -  
28 - private void addCallbacks(int type)  
29 - {  
30 - this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_STARTSECTION, "onTimerUpdate", Obf.CallbackProxyClient.ref, "tick", type));  
31 - this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onRender", Obf.CallbackProxyClient.ref, "gameRenderer", type));  
32 - this.addCallback(type, Obf.Minecraft, Obf.runTick, "()V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onAnimateTick", Obf.CallbackProxyClient.ref, "animateTick", type));  
33 - this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_ENDSECTION, "onTick", Obf.CallbackProxyClient.ref, "", type)); // ref 2  
34 - this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSECTION, "preRenderGUI", Obf.CallbackProxyClient.ref, "", type)); // ref 1  
35 - this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRenderHUDandGUI", Obf.CallbackProxyClient.ref, "", type)); // ref 2  
36 - this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onRenderHUD", Obf.CallbackProxyClient.ref, "gui", type));  
37 - this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onSetupCameraTransform", Obf.CallbackProxyClient.ref, "frustrum", type));  
38 - this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "postRenderEntities", Obf.CallbackProxyClient.ref, "litParticles", type));  
39 - this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRender", Obf.CallbackProxyClient.ref, "", type));  
40 - this.addCallback(type, Obf.GuiIngame, Obf.renderGameOverlay, "(FZII)V", new Callback(CallbackType.PROFILER_STARTSECTION, "onRenderChat", Obf.CallbackProxyClient.ref, "chat", type));  
41 - this.addCallback(type, Obf.GuiIngame, Obf.renderGameOverlay, "(FZII)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRenderChat", Obf.CallbackProxyClient.ref, "", type)); // ref 10  
42 -  
43 - String integratedServerCtorDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings);  
44 - String initPlayerConnectionDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.NetworkManager, Obf.EntityPlayerMP);  
45 - String playerLoggedInOutDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.EntityPlayerMP);  
46 - String spawnPlayerDescriptor = Callback.generateDescriptor(type, Obf.EntityPlayerMP, Obf.GameProfile);  
47 - String respawnPlayerDescriptor = Callback.generateDescriptor(type, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Type.INT_TYPE, Type.BOOLEAN_TYPE);  
48 -  
49 - this.addCallback(type, Obf.IntegratedServer, Obf.constructor, integratedServerCtorDescriptor, new Callback(CallbackType.RETURN, "IntegratedServerCtor", Obf.CallbackProxyClient.ref));  
50 - this.addCallback(type, Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, initPlayerConnectionDescriptor, new Callback(CallbackType.RETURN, "onInitializePlayerConnection", Obf.CallbackProxyClient.ref));  
51 - this.addCallback(type, Obf.ServerConfigurationManager, Obf.playerLoggedIn, playerLoggedInOutDescriptor, new Callback(CallbackType.RETURN, "onPlayerLogin", Obf.CallbackProxyClient.ref));  
52 - this.addCallback(type, Obf.ServerConfigurationManager, Obf.playerLoggedOut, playerLoggedInOutDescriptor, new Callback(CallbackType.RETURN, "onPlayerLogout", Obf.CallbackProxyClient.ref));  
53 - this.addCallback(type, Obf.ServerConfigurationManager, Obf.spawnPlayer, spawnPlayerDescriptor, new Callback(CallbackType.RETURN, "onSpawnPlayer", Obf.CallbackProxyClient.ref));  
54 - this.addCallback(type, Obf.ServerConfigurationManager, Obf.respawnPlayer, respawnPlayerDescriptor, new Callback(CallbackType.RETURN, "onRespawnPlayer", Obf.CallbackProxyClient.ref));  
55 -// this.addCallback(type, Obf.C01PacketChatMessage, Obf.constructor, "(Ljava/lang/String;)V", new Callback(CallbackType.RETURN, "onOutboundChat", Obf.CallbackProxyClient.ref));  
56 - this.addCallback(type, Obf.Minecraft, Obf.startGame, "()V", new Callback(CallbackType.RETURN, "onStartupComplete", Obf.CallbackProxyClient.ref));  
57 - }  
58 -  
59 - /**  
60 - * @param type  
61 - * @param className  
62 - * @param methodName  
63 - * @param methodSignature  
64 - * @param invokeMethod  
65 - * @param section  
66 - * @param callback  
67 - */  
68 - private void addCallback(int type, Obf className, Obf methodName, String methodSignature, Callback callback)  
69 - {  
70 - this.addCallback(className.names[type], methodName.names[type], methodSignature, callback);  
71 - }  
72 -}  
java/client/com/mumfrey/liteloader/client/transformers/LiteLoaderEventInjectionTransformer.java
@@ -6,37 +6,88 @@ import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer; @@ -6,37 +6,88 @@ 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.BeforeReturn;
9 import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke; 10 import com.mumfrey.liteloader.transformers.event.inject.BeforeStringInvoke;
10 import com.mumfrey.liteloader.transformers.event.inject.MethodHead; 11 import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
11 12
12 import static com.mumfrey.liteloader.core.runtime.Methods.*; 13 import static com.mumfrey.liteloader.core.runtime.Methods.*;
  14 +import static com.mumfrey.liteloader.transformers.event.InjectionPoint.after;
13 15
14 public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer 16 public class LiteLoaderEventInjectionTransformer extends EventInjectionTransformer
15 { 17 {
16 @Override 18 @Override
17 protected void addEvents() 19 protected void addEvents()
18 { 20 {
19 - InjectionPoint methodHead = new MethodHead();  
20 - InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender);  
21 - InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture);  
22 - InjectionPoint beforePickProfiler = new BeforeStringInvoke("pick", endStartSection); 21 + Event onOutboundChat = Event.getOrCreate("onOutboundChat", true);
  22 + Event onResize = Event.getOrCreate("updateFramebufferSize", false);
  23 + Event preRenderFBO = Event.getOrCreate("preRenderFBO", false);
  24 + Event renderFBO = Event.getOrCreate("renderFBO", false);
  25 + Event postRenderFBO = Event.getOrCreate("postRenderFBO", false);
  26 + Event onRenderWorld = Event.getOrCreate("onRenderWorld", false);
  27 + Event onTimerUpdate = Event.getOrCreate("onTimerUpdate", false);
  28 + Event onRender = Event.getOrCreate("onRender", false);
  29 + Event newTick = Event.getOrCreate("newTick", false);
  30 + Event onTick = Event.getOrCreate("onTick", false);
  31 + Event preRenderGUI = Event.getOrCreate("preRenderGUI", false);
  32 + Event onRenderHUD = Event.getOrCreate("onRenderHUD", false);
  33 + Event postRenderHUD = Event.getOrCreate("postRenderHUD", false);
  34 + Event onSetupCameraTransform = Event.getOrCreate("onSetupCameraTransform", false);
  35 + Event postRenderEntities = Event.getOrCreate("postRenderEntities", false);
  36 + Event postRender = Event.getOrCreate("postRender", false);
  37 + Event onRenderChat = Event.getOrCreate("onRenderChat", false);
  38 + Event postRenderChat = Event.getOrCreate("postRenderChat", false);
  39 + Event onCreateIntegratedServer = Event.getOrCreate("onCreateIntegratedServer", false);
  40 + Event onInitializePlayerConnection = Event.getOrCreate("onInitializePlayerConnection", false);
  41 + Event onPlayerLogin = Event.getOrCreate("onPlayerLogin", false);
  42 + Event onPlayerLogout = Event.getOrCreate("onPlayerLogout", false);
  43 + Event onSpawnPlayer = Event.getOrCreate("onSpawnPlayer", false);
  44 + Event onRespawnPlayer = Event.getOrCreate("onRespawnPlayer", false);
  45 + Event onStartupComplete = Event.getOrCreate("onStartupComplete", false);
23 46
24 - this.addEvent(Event.getOrCreate("sendChatMessage", true), sendChatMessage, methodHead)  
25 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "onOutboundChat")); 47 + InjectionPoint methodHead = new MethodHead();
  48 + InjectionPoint methodReturn = new BeforeReturn();
  49 + InjectionPoint beforeGlClear = new BeforeInvoke(glClear);
  50 + InjectionPoint beforeFBORender = new BeforeInvoke(framebufferRender);
  51 + InjectionPoint beforeRenderHUD = new BeforeInvoke(renderGameOverlay);
  52 + InjectionPoint beforeBindFBOTex = new BeforeInvoke(bindFramebufferTexture);
  53 + InjectionPoint beforeRender = new BeforeInvoke(updateCameraAndRender);
  54 + InjectionPoint beforeDrawChat = new BeforeInvoke(drawChat);
  55 + InjectionPoint beforeEndProfiler = new BeforeInvoke(endSection);
  56 + InjectionPoint beforeTickProfiler = new BeforeStringInvoke("tick", startSection);
  57 + InjectionPoint beforePickProfiler = new BeforeStringInvoke("pick", endStartSection);
  58 + InjectionPoint beforeRenderProfiler = new BeforeStringInvoke("gameRenderer", endStartSection);
  59 + InjectionPoint beforeFrustumProfiler = new BeforeStringInvoke("frustrum", endStartSection);
  60 + InjectionPoint beforeParticlesProfiler = new BeforeStringInvoke("litParticles", endStartSection);
26 61
27 - this.addEvent(Event.getOrCreate("updateFramebufferSize", false), updateFramebufferSize, methodHead)  
28 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "onResize"));  
29 -  
30 - this.addEvent(Event.getOrCreate("preRenderFBO", false), runGameLoop, beforeFBORender)  
31 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "preRenderFBO"));  
32 -  
33 - this.addEvent(Event.getOrCreate("renderFBO", false), framebufferRender, beforeBindFBOTex)  
34 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "renderFBO"));  
35 -  
36 - this.addEvent(Event.getOrCreate("postRenderFBO", false), runGameLoop, InjectionPoint.after(beforeFBORender))  
37 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "postRenderFBO"));;  
38 -  
39 - this.addEvent(Event.getOrCreate("onRenderWorld", false), renderWorld, beforePickProfiler)  
40 - .addListener(new MethodInfo(Obf.CallbackProxyClient, "onRenderWorld"));; 62 + this.add(onOutboundChat, sendChatMessage, (methodHead), "onOutboundChat");
  63 + this.add(onResize, updateFramebufferSize, (methodHead), "onResize");
  64 + this.add(preRenderFBO, runGameLoop, (beforeFBORender), "preRenderFBO");
  65 + this.add(renderFBO, framebufferRender, (beforeBindFBOTex), "renderFBO");
  66 + this.add(postRenderFBO, runGameLoop, after(beforeFBORender), "postRenderFBO");
  67 + this.add(onRenderWorld, renderWorld, (beforePickProfiler), "onRenderWorld");
  68 + this.add(onTimerUpdate, runGameLoop, (beforeTickProfiler), "onTimerUpdate");
  69 + this.add(onRender, runGameLoop, (beforeRenderProfiler), "onRender");
  70 + this.add(newTick, runTick, (methodHead), "newTick");
  71 + this.add(onTick, runGameLoop, after(beforeRender), "onTick");
  72 + this.add(preRenderGUI, updateCameraAndRender, after(beforeGlClear), "preRenderGUI");
  73 + this.add(onRenderHUD, updateCameraAndRender, (beforeRenderHUD), "onRenderHUD");
  74 + this.add(postRenderHUD, updateCameraAndRender, after(beforeRenderHUD), "postRenderHUD");
  75 + this.add(onSetupCameraTransform, renderWorld, (beforeFrustumProfiler), "onSetupCameraTransform");
  76 + this.add(postRenderEntities, renderWorld, (beforeParticlesProfiler), "postRenderEntities");
  77 + this.add(postRender, renderWorld, (beforeEndProfiler), "postRender");
  78 + this.add(onRenderChat, renderGameOverlay, (beforeDrawChat), "onRenderChat");
  79 + this.add(postRenderChat, renderGameOverlay, after(beforeDrawChat), "postRenderChat");
  80 + this.add(onCreateIntegratedServer, integratedServerCtor, (methodReturn), "IntegratedServerCtor");
  81 + this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection");
  82 + this.add(onPlayerLogin, playerLoggedIn, (methodReturn), "onPlayerLogin");
  83 + this.add(onPlayerLogout, playerLoggedOut, (methodReturn), "onPlayerLogout");
  84 + this.add(onSpawnPlayer, spawnPlayer, (methodReturn), "onSpawnPlayer");
  85 + this.add(onRespawnPlayer, respawnPlayer, (methodReturn), "onRespawnPlayer");
  86 + this.add(onStartupComplete, startGame, (methodReturn), "onStartupComplete");
  87 + }
  88 +
  89 + protected final Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback)
  90 + {
  91 + return this.addEvent(event, targetMethod, injectionPoint).addListener(new MethodInfo(Obf.CallbackProxyClient, callback));
41 } 92 }
42 } 93 }
java/common/com/mumfrey/liteloader/core/runtime/Methods.java
@@ -8,16 +8,29 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo; @@ -8,16 +8,29 @@ import com.mumfrey.liteloader.transformers.event.MethodInfo;
8 */ 8 */
9 public abstract class Methods 9 public abstract class Methods
10 { 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); 11 + public static final MethodInfo startGame = new MethodInfo(Obf.Minecraft, Obf.startGame, Void.TYPE);
  12 + public static final MethodInfo runGameLoop = new MethodInfo(Obf.Minecraft, Obf.runGameLoop, Void.TYPE);
  13 + public static final MethodInfo runTick = new MethodInfo(Obf.Minecraft, Obf.runTick, Void.TYPE);
  14 + public static final MethodInfo updateFramebufferSize = new MethodInfo(Obf.Minecraft, Obf.updateFramebufferSize, Void.TYPE);
  15 + public static final MethodInfo framebufferRender = new MethodInfo(Obf.FrameBuffer, Obf.framebufferRender, Void.TYPE, Integer.TYPE, Integer.TYPE);
  16 + public static final MethodInfo bindFramebufferTexture = new MethodInfo(Obf.FrameBuffer, Obf.bindFramebufferTexture, Void.TYPE);
  17 + public static final MethodInfo sendChatMessage = new MethodInfo(Obf.EntityClientPlayerMP, Obf.sendChatMessage, Void.TYPE, String.class);
  18 + public static final MethodInfo renderWorld = new MethodInfo(Obf.EntityRenderer, Obf.renderWorld, Void.TYPE, Float.TYPE, Long.TYPE);
  19 + public static final MethodInfo updateCameraAndRender = new MethodInfo(Obf.EntityRenderer, Obf.updateCameraAndRender, Void.TYPE, Float.TYPE);
  20 + public static final MethodInfo renderGameOverlay = new MethodInfo(Obf.GuiIngame, Obf.renderGameOverlay, Void.TYPE, Float.TYPE, Boolean.TYPE, Integer.TYPE, Integer.TYPE);
  21 + public static final MethodInfo drawChat = new MethodInfo(Obf.GuiNewChat, Obf.drawChat, Void.TYPE, Integer.TYPE);
  22 + public static final MethodInfo integratedServerCtor = new MethodInfo(Obf.IntegratedServer, Obf.constructor, Void.TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings);
  23 + public static final MethodInfo initPlayerConnection = new MethodInfo(Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, Void.TYPE, Obf.NetworkManager, Obf.EntityPlayerMP);
  24 + public static final MethodInfo playerLoggedIn = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedIn, Void.TYPE, Obf.EntityPlayerMP);
  25 + public static final MethodInfo playerLoggedOut = new MethodInfo(Obf.ServerConfigurationManager, Obf.playerLoggedOut, Void.TYPE, Obf.EntityPlayerMP);
  26 + public static final MethodInfo spawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.spawnPlayer, Obf.EntityPlayerMP, Obf.GameProfile);
  27 + public static final MethodInfo respawnPlayer = new MethodInfo(Obf.ServerConfigurationManager, Obf.respawnPlayer, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Integer.TYPE, Boolean.TYPE);
17 28
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); 29 + public static final MethodInfo startSection = new MethodInfo(Obf.Profiler, Obf.startSection, Void.TYPE, String.class);
  30 + public static final MethodInfo endSection = new MethodInfo(Obf.Profiler, Obf.endSection, Void.TYPE);
  31 + public static final MethodInfo endStartSection = new MethodInfo(Obf.Profiler, Obf.endStartSection, Void.TYPE, String.class);
  32 +
  33 + public static final MethodInfo glClear = new MethodInfo(Obf.GL11, "glClear", "(I)V");
21 34
22 private Methods() {} 35 private Methods() {}
23 } 36 }
java/common/com/mumfrey/liteloader/core/runtime/Obf.java
@@ -23,6 +23,7 @@ public class Obf @@ -23,6 +23,7 @@ public class Obf
23 public static final Obf GameProfile = new Obf("com.mojang.authlib.GameProfile" ); 23 public static final Obf GameProfile = new Obf("com.mojang.authlib.GameProfile" );
24 public static final Obf MinecraftMain = new Obf("net.minecraft.client.main.Main" ); 24 public static final Obf MinecraftMain = new Obf("net.minecraft.client.main.Main" );
25 public static final Obf MinecraftServer = new Obf("net.minecraft.server.MinecraftServer" ); 25 public static final Obf MinecraftServer = new Obf("net.minecraft.server.MinecraftServer" );
  26 + public static final Obf GL11 = new Obf("org.lwjgl.opengl.GL11" );
26 public static final Obf constructor = new Obf("<init>" ); 27 public static final Obf constructor = new Obf("<init>" );
27 28
28 // Classes 29 // Classes
@@ -49,6 +50,7 @@ public class Obf @@ -49,6 +50,7 @@ public class Obf
49 public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "ajn" ); 50 public static final Obf Blocks = new Obf("net.minecraft.init.Blocks", "ajn" );
50 public static final Obf Items = new Obf("net.minecraft.init.Items", "ade" ); 51 public static final Obf Items = new Obf("net.minecraft.init.Items", "ade" );
51 public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "bmg" ); 52 public static final Obf FrameBuffer = new Obf("net.minecraft.client.shader.Framebuffer", "bmg" );
  53 + public static final Obf GuiNewChat = new Obf("net.minecraft.client.gui.GuiNewChat", "bcc" );
52 54
53 // Fields 55 // Fields
54 // ----------------------------------------------------------------------------------------- 56 // -----------------------------------------------------------------------------------------
@@ -87,6 +89,7 @@ public class Obf @@ -87,6 +89,7 @@ public class Obf
87 public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "an" ); 89 public static final Obf updateFramebufferSize = new Obf("func_147119_ah", "an" );
88 public static final Obf framebufferRender = new Obf("func_147615_c", "c" ); 90 public static final Obf framebufferRender = new Obf("func_147615_c", "c" );
89 public static final Obf bindFramebufferTexture = new Obf("func_147612_c", "c" ); 91 public static final Obf bindFramebufferTexture = new Obf("func_147612_c", "c" );
  92 + public static final Obf drawChat = new Obf("func_146230_a", "a" );
90 93
91 public static final int MCP = 0; 94 public static final int MCP = 0;
92 public static final int SRG = 1; 95 public static final int SRG = 1;