Commit 53881326bb43260c8bc710c8de49d289a988dccb

Authored by Mumfrey
1 parent af8f47e8

Remove legacy proxy objects and move all logic into relevant mixins

src/client/java/com/mumfrey/liteloader/client/ClientProxy.java deleted 100644 → 0
1 -/*  
2 - * This file is part of LiteLoader.  
3 - * Copyright (C) 2012-16 Adam Mummery-Smith  
4 - * All Rights Reserved.  
5 - */  
6 -package com.mumfrey.liteloader.client;  
7 -  
8 -import java.io.File;  
9 -  
10 -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;  
11 -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;  
12 -  
13 -import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton;  
14 -import com.mumfrey.liteloader.client.ducks.IFramebuffer;  
15 -import com.mumfrey.liteloader.core.Proxy;  
16 -  
17 -import net.minecraft.client.Minecraft;  
18 -import net.minecraft.client.entity.EntityPlayerSP;  
19 -import net.minecraft.client.gui.GuiNewChat;  
20 -import net.minecraft.client.renderer.RenderGlobal;  
21 -import net.minecraft.client.renderer.entity.Render;  
22 -import net.minecraft.client.renderer.entity.RenderManager;  
23 -import net.minecraft.client.shader.Framebuffer;  
24 -import net.minecraft.entity.Entity;  
25 -import net.minecraft.server.integrated.IntegratedServer;  
26 -import net.minecraft.util.text.ITextComponent;  
27 -import net.minecraft.world.WorldSettings;  
28 -  
29 -/**  
30 - * Proxy class which handles the redirected calls from the injected callbacks  
31 - * and routes them to the relevant liteloader handler classes. We do this rather  
32 - * than patching a bunch of bytecode into the packet classes themselves because  
33 - * this is easier to maintain.  
34 - *  
35 - * @author Adam Mummery-Smith  
36 - */  
37 -public abstract class ClientProxy extends Proxy  
38 -{  
39 - private static LiteLoaderEventBrokerClient broker;  
40 -  
41 - private ClientProxy() {}  
42 -  
43 - public static void onStartupComplete()  
44 - {  
45 - Proxy.onStartupComplete();  
46 -  
47 - ClientProxy.broker = LiteLoaderEventBrokerClient.getInstance();  
48 -  
49 - if (ClientProxy.broker == null)  
50 - {  
51 - throw new RuntimeException("LiteLoader failed to start up properly."  
52 - + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");  
53 - }  
54 -  
55 - ClientProxy.broker.onStartupComplete();  
56 - }  
57 -  
58 - public static void onTimerUpdate()  
59 - {  
60 - ClientProxy.broker.onTimerUpdate();  
61 - }  
62 -  
63 - public static void newTick()  
64 - {  
65 - }  
66 -  
67 - public static void onTick()  
68 - {  
69 - ClientProxy.broker.onTick();  
70 - }  
71 -  
72 - public static void onRender()  
73 - {  
74 - ClientProxy.broker.onRender();  
75 - }  
76 -  
77 - public static void preRenderGUI(float partialTicks)  
78 - {  
79 - ClientProxy.broker.preRenderGUI(partialTicks);  
80 - }  
81 -  
82 - public static void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)  
83 - {  
84 - ClientProxy.broker.onSetupCameraTransform(pass, partialTicks, timeSlice);  
85 - }  
86 -  
87 - public static void postRenderEntities(int pass, float partialTicks, long timeSlice)  
88 - {  
89 - ClientProxy.broker.postRenderEntities(partialTicks, timeSlice);  
90 - }  
91 -  
92 - public static void postRender(float partialTicks, long timeSlice)  
93 - {  
94 - ClientProxy.broker.postRender(partialTicks, timeSlice);  
95 - }  
96 -  
97 - public static void onRenderHUD(float partialTicks)  
98 - {  
99 - ClientProxy.broker.onRenderHUD(partialTicks);  
100 - }  
101 -  
102 - public static void onRenderChat(GuiNewChat chatGui, float partialTicks)  
103 - {  
104 - ClientProxy.broker.onRenderChat(chatGui, partialTicks);  
105 - }  
106 -  
107 - public static void postRenderChat(GuiNewChat chatGui, float partialTicks)  
108 - {  
109 - ClientProxy.broker.postRenderChat(chatGui, partialTicks);  
110 - }  
111 -  
112 - public static void postRenderHUD(float partialTicks)  
113 - {  
114 - ClientProxy.broker.postRenderHUD(partialTicks);  
115 - }  
116 -  
117 - public static void onCreateIntegratedServer(IntegratedServer server, String folderName, String worldName, WorldSettings worldSettings)  
118 - {  
119 - ClientProxy.broker.onStartServer(server, folderName, worldName, worldSettings);  
120 - }  
121 -  
122 - public static void onOutboundChat(CallbackInfo e, String message)  
123 - {  
124 - ClientProxy.broker.onSendChatMessage(e, message);  
125 - }  
126 -  
127 - public static void onResize(Minecraft mc)  
128 - {  
129 - if (ClientProxy.broker == null) return;  
130 - ClientProxy.broker.onResize(mc);  
131 - }  
132 -  
133 - public static void preRenderFBO(Framebuffer frameBufferMc)  
134 - {  
135 - if (ClientProxy.broker == null) return;  
136 - if (frameBufferMc instanceof IFramebuffer)  
137 - {  
138 - ((IFramebuffer)frameBufferMc).setDispatchRenderEvent(true);  
139 - }  
140 - ClientProxy.broker.preRenderFBO(frameBufferMc);  
141 - }  
142 -  
143 - public static void postRenderFBO(Framebuffer frameBufferMc)  
144 - {  
145 - if (ClientProxy.broker == null) return;  
146 - ClientProxy.broker.postRenderFBO(frameBufferMc);  
147 - }  
148 -  
149 - public static void renderFBO(Framebuffer frameBufferMc, int width, int height, boolean flag)  
150 - {  
151 - if (ClientProxy.broker == null) return;  
152 - ClientProxy.broker.onRenderFBO(frameBufferMc, width, height);  
153 - }  
154 -  
155 - public static void onRenderWorld(float partialTicks, long timeSlice)  
156 - {  
157 - ClientProxy.broker.onRenderWorld(partialTicks, timeSlice);  
158 - }  
159 -  
160 - public static void onRenderSky(int pass, float partialTicks, long timeSlice)  
161 - {  
162 - ClientProxy.broker.onRenderSky(partialTicks, pass, timeSlice);  
163 - }  
164 -  
165 - public static void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass)  
166 - {  
167 - ClientProxy.broker.onRenderClouds(partialTicks, pass, renderGlobalIn);  
168 - }  
169 -  
170 - public static void onRenderTerrain(int pass, float partialTicks, long timeSlice)  
171 - {  
172 - ClientProxy.broker.onRenderTerrain(partialTicks, pass, timeSlice);  
173 - }  
174 -  
175 - public static void onSaveScreenshot(CallbackInfoReturnable<ITextComponent> ci, File gameDir, String name, int width, int height,  
176 - Framebuffer fbo)  
177 - {  
178 - ClientProxy.broker.onScreenshot(ci, name, width, height, fbo);  
179 - }  
180 -  
181 - public static <T extends Entity> void onRenderEntity(RenderManager source, Render<T> render, T entity, double x, double y, double z,  
182 - float yaw, float pTicks)  
183 - {  
184 - ClientProxy.broker.onRenderEntity(source, entity, x, y, z, yaw, pTicks, render);  
185 - }  
186 -  
187 - public static <T extends Entity> void onPostRenderEntity(RenderManager source, Render<T> render, T entity, double x, double y, double z,  
188 - float yaw, float pTicks)  
189 - {  
190 - ClientProxy.broker.onPostRenderEntity(source, entity, x, y, z, yaw, pTicks, render);  
191 - }  
192 -  
193 - public static boolean onClickMouse(EntityPlayerSP player, MouseButton button)  
194 - {  
195 - return ClientProxy.broker.onClickMouse(player, button);  
196 - }  
197 -  
198 - public static boolean onMouseHeld(EntityPlayerSP player, MouseButton button)  
199 - {  
200 - return ClientProxy.broker.onMouseHeld(player, button);  
201 - }  
202 -}  
src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
@@ -286,7 +286,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -286,7 +286,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
286 * Late initialisation callback 286 * Late initialisation callback
287 */ 287 */
288 @Override 288 @Override
289 - protected void onStartupComplete() 289 + public void onStartupComplete()
290 { 290 {
291 this.engine.getResources().refreshResources(false); 291 this.engine.getResources().refreshResources(false);
292 292
@@ -328,7 +328,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -328,7 +328,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
328 /** 328 /**
329 * Callback from the tick hook, pre render 329 * Callback from the tick hook, pre render
330 */ 330 */
331 - void onRender() 331 + public void onRender()
332 { 332 {
333 this.renderListeners.all().onRender(); 333 this.renderListeners.all().onRender();
334 } 334 }
@@ -339,7 +339,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -339,7 +339,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
339 * @param partialTicks 339 * @param partialTicks
340 * @param timeSlice 340 * @param timeSlice
341 */ 341 */
342 - void postRenderEntities(float partialTicks, long timeSlice) 342 + public void postRenderEntities(float partialTicks, long timeSlice)
343 { 343 {
344 this.postRenderListeners.all().onPostRenderEntities(partialTicks); 344 this.postRenderListeners.all().onPostRenderEntities(partialTicks);
345 } 345 }
@@ -350,7 +350,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -350,7 +350,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
350 * @param partialTicks 350 * @param partialTicks
351 * @param timeSlice 351 * @param timeSlice
352 */ 352 */
353 - void postRender(float partialTicks, long timeSlice) 353 + public void postRender(float partialTicks, long timeSlice)
354 { 354 {
355 ((IEntityRenderer)this.engineClient.getClient().entityRenderer).setupCamera(partialTicks, 0); 355 ((IEntityRenderer)this.engineClient.getClient().entityRenderer).setupCamera(partialTicks, 0);
356 this.postRenderListeners.all().onPostRender(partialTicks); 356 this.postRenderListeners.all().onPostRender(partialTicks);
@@ -359,7 +359,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -359,7 +359,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
359 /** 359 /**
360 * Called immediately before the current GUI is rendered 360 * Called immediately before the current GUI is rendered
361 */ 361 */
362 - void preRenderGUI(float partialTicks) 362 + public void preRenderGUI(float partialTicks)
363 { 363 {
364 this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen()); 364 this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen());
365 } 365 }
@@ -371,7 +371,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -371,7 +371,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
371 * @param timeSlice 371 * @param timeSlice
372 * @param partialTicks 372 * @param partialTicks
373 */ 373 */
374 - void onSetupCameraTransform(int pass, float partialTicks, long timeSlice) 374 + public void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)
375 { 375 {
376 this.renderListeners.all().onSetupCameraTransform(); 376 this.renderListeners.all().onSetupCameraTransform();
377 this.preRenderListeners.all().onSetupCameraTransform(partialTicks, pass, timeSlice); 377 this.preRenderListeners.all().onSetupCameraTransform(partialTicks, pass, timeSlice);
@@ -383,7 +383,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -383,7 +383,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
383 * @param chatGui 383 * @param chatGui
384 * @param partialTicks 384 * @param partialTicks
385 */ 385 */
386 - void onRenderChat(GuiNewChat chatGui, float partialTicks) 386 + public void onRenderChat(GuiNewChat chatGui, float partialTicks)
387 { 387 {
388 this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui); 388 this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui);
389 } 389 }
@@ -394,7 +394,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -394,7 +394,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
394 * @param chatGui 394 * @param chatGui
395 * @param partialTicks 395 * @param partialTicks
396 */ 396 */
397 - void postRenderChat(GuiNewChat chatGui, float partialTicks) 397 + public void postRenderChat(GuiNewChat chatGui, float partialTicks)
398 { 398 {
399 this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chatGui); 399 this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chatGui);
400 } 400 }
@@ -402,7 +402,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -402,7 +402,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
402 /** 402 /**
403 * Callback when about to render the HUD 403 * Callback when about to render the HUD
404 */ 404 */
405 - void onRenderHUD(float partialTicks) 405 + public void onRenderHUD(float partialTicks)
406 { 406 {
407 this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight); 407 this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight);
408 } 408 }
@@ -410,7 +410,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -410,7 +410,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
410 /** 410 /**
411 * Callback when the HUD has just been rendered 411 * Callback when the HUD has just been rendered
412 */ 412 */
413 - void postRenderHUD(float partialTicks) 413 + public void postRenderHUD(float partialTicks)
414 { 414 {
415 this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight); 415 this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight);
416 } 416 }
@@ -418,7 +418,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -418,7 +418,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
418 /** 418 /**
419 * Callback from the tick hook, called every frame when the timer is updated 419 * Callback from the tick hook, called every frame when the timer is updated
420 */ 420 */
421 - void onTimerUpdate() 421 + public void onTimerUpdate()
422 { 422 {
423 Minecraft minecraft = this.engine.getClient(); 423 Minecraft minecraft = this.engine.getClient();
424 this.loopListeners.all().onRunGameLoop(minecraft); 424 this.loopListeners.all().onRunGameLoop(minecraft);
@@ -427,7 +427,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -427,7 +427,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
427 /** 427 /**
428 * Callback from the tick hook, ticks all tickable mods 428 * Callback from the tick hook, ticks all tickable mods
429 */ 429 */
430 - void onTick() 430 + public void onTick()
431 { 431 {
432 this.profiler.endStartSection("litemods"); 432 this.profiler.endStartSection("litemods");
433 433
@@ -474,7 +474,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -474,7 +474,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
474 /** 474 /**
475 * @param message 475 * @param message
476 */ 476 */
477 - void onSendChatMessage(CallbackInfo e, String message) 477 + public void onSendChatMessage(CallbackInfo e, String message)
478 { 478 {
479 if (!this.outboundChatFilters.all().onSendChatMessage(message)) 479 if (!this.outboundChatFilters.all().onSendChatMessage(message))
480 { 480 {
@@ -485,7 +485,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -485,7 +485,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
485 /** 485 /**
486 * @param framebuffer 486 * @param framebuffer
487 */ 487 */
488 - void preRenderFBO(Framebuffer framebuffer) 488 + public void preRenderFBO(Framebuffer framebuffer)
489 { 489 {
490 this.frameBufferListeners.all().preRenderFBO(framebuffer); 490 this.frameBufferListeners.all().preRenderFBO(framebuffer);
491 } 491 }
@@ -495,7 +495,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -495,7 +495,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
495 * @param width 495 * @param width
496 * @param height 496 * @param height
497 */ 497 */
498 - void onRenderFBO(Framebuffer framebuffer, int width, int height) 498 + public void onRenderFBO(Framebuffer framebuffer, int width, int height)
499 { 499 {
500 this.frameBufferListeners.all().onRenderFBO(framebuffer, width, height); 500 this.frameBufferListeners.all().onRenderFBO(framebuffer, width, height);
501 } 501 }
@@ -503,7 +503,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -503,7 +503,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
503 /** 503 /**
504 * @param framebuffer 504 * @param framebuffer
505 */ 505 */
506 - void postRenderFBO(Framebuffer framebuffer) 506 + public void postRenderFBO(Framebuffer framebuffer)
507 { 507 {
508 this.frameBufferListeners.all().postRenderFBO(framebuffer); 508 this.frameBufferListeners.all().postRenderFBO(framebuffer);
509 } 509 }
@@ -512,7 +512,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -512,7 +512,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
512 * @param partialTicks 512 * @param partialTicks
513 * @param timeSlice 513 * @param timeSlice
514 */ 514 */
515 - void onRenderWorld(float partialTicks, long timeSlice) 515 + public void onRenderWorld(float partialTicks, long timeSlice)
516 { 516 {
517 this.preRenderListeners.all().onRenderWorld(partialTicks); 517 this.preRenderListeners.all().onRenderWorld(partialTicks);
518 } 518 }
@@ -522,7 +522,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -522,7 +522,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
522 * @param pass 522 * @param pass
523 * @param timeSlice 523 * @param timeSlice
524 */ 524 */
525 - void onRenderSky(float partialTicks, int pass, long timeSlice) 525 + public void onRenderSky(float partialTicks, int pass, long timeSlice)
526 { 526 {
527 this.preRenderListeners.all().onRenderSky(partialTicks, pass); 527 this.preRenderListeners.all().onRenderSky(partialTicks, pass);
528 } 528 }
@@ -532,7 +532,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -532,7 +532,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
532 * @param pass 532 * @param pass
533 * @param renderGlobal 533 * @param renderGlobal
534 */ 534 */
535 - void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal) 535 + public void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal)
536 { 536 {
537 this.preRenderListeners.all().onRenderClouds(partialTicks, pass, renderGlobal); 537 this.preRenderListeners.all().onRenderClouds(partialTicks, pass, renderGlobal);
538 } 538 }
@@ -542,7 +542,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -542,7 +542,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
542 * @param pass 542 * @param pass
543 * @param timeSlice 543 * @param timeSlice
544 */ 544 */
545 - void onRenderTerrain(float partialTicks, int pass, long timeSlice) 545 + public void onRenderTerrain(float partialTicks, int pass, long timeSlice)
546 { 546 {
547 this.preRenderListeners.all().onRenderTerrain(partialTicks, pass); 547 this.preRenderListeners.all().onRenderTerrain(partialTicks, pass);
548 } 548 }
@@ -554,7 +554,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft @@ -554,7 +554,7 @@ public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker&lt;Minecraft
554 * @param height 554 * @param height
555 * @param fbo 555 * @param fbo
556 */ 556 */
557 - void onScreenshot(CallbackInfoReturnable<ITextComponent> ci, String name, int width, int height, Framebuffer fbo) 557 + public void onScreenshot(CallbackInfoReturnable<ITextComponent> ci, String name, int width, int height, Framebuffer fbo)
558 { 558 {
559 ReturnValue<ITextComponent> ret = new ReturnValue<ITextComponent>(ci.getReturnValue()); 559 ReturnValue<ITextComponent> ret = new ReturnValue<ITextComponent>(ci.getReturnValue());
560 560
src/client/java/com/mumfrey/liteloader/client/mixin/MixinEntityPlayerSP.java
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At; @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At;
10 import org.spongepowered.asm.mixin.injection.Inject; 10 import org.spongepowered.asm.mixin.injection.Inject;
11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12 12
13 -import com.mumfrey.liteloader.client.ClientProxy; 13 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
14 14
15 import net.minecraft.client.entity.AbstractClientPlayer; 15 import net.minecraft.client.entity.AbstractClientPlayer;
16 import net.minecraft.client.entity.EntityPlayerSP; 16 import net.minecraft.client.entity.EntityPlayerSP;
@@ -26,6 +26,6 @@ public abstract class MixinEntityPlayerSP extends AbstractClientPlayer @@ -26,6 +26,6 @@ public abstract class MixinEntityPlayerSP extends AbstractClientPlayer
26 @Inject(method = "sendChatMessage(Ljava/lang/String;)V", at = { @At("HEAD") }, cancellable = true) 26 @Inject(method = "sendChatMessage(Ljava/lang/String;)V", at = { @At("HEAD") }, cancellable = true)
27 public void onSendChatMessage(String message, CallbackInfo ci) 27 public void onSendChatMessage(String message, CallbackInfo ci)
28 { 28 {
29 - ClientProxy.onOutboundChat(ci, message); 29 + LiteLoaderEventBrokerClient.getInstance().onSendChatMessage(ci, message);
30 } 30 }
31 } 31 }
src/client/java/com/mumfrey/liteloader/client/mixin/MixinEntityRenderer.java
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.At.Shift; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.At.Shift;
13 import org.spongepowered.asm.mixin.injection.Inject; 13 import org.spongepowered.asm.mixin.injection.Inject;
14 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15 15
16 -import com.mumfrey.liteloader.client.ClientProxy; 16 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
17 import com.mumfrey.liteloader.client.overlays.IEntityRenderer; 17 import com.mumfrey.liteloader.client.overlays.IEntityRenderer;
18 18
19 import net.minecraft.client.renderer.EntityRenderer; 19 import net.minecraft.client.renderer.EntityRenderer;
@@ -33,6 +33,8 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -33,6 +33,8 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
33 @Shadow abstract float getFOVModifier(float partialTicks, boolean useFOVSetting); 33 @Shadow abstract float getFOVModifier(float partialTicks, boolean useFOVSetting);
34 @Shadow abstract void setupCameraTransform(float partialTicks, int pass); 34 @Shadow abstract void setupCameraTransform(float partialTicks, int pass);
35 35
  36 + private LiteLoaderEventBrokerClient broker = LiteLoaderEventBrokerClient.getInstance();
  37 +
36 @Inject(method = "updateCameraAndRender(FJ)V", at = @At( 38 @Inject(method = "updateCameraAndRender(FJ)V", at = @At(
37 value = "INVOKE", 39 value = "INVOKE",
38 shift = Shift.AFTER, 40 shift = Shift.AFTER,
@@ -40,7 +42,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -40,7 +42,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
40 )) 42 ))
41 private void onPreRenderGUI(float partialTicks, long nanoTime, CallbackInfo ci) 43 private void onPreRenderGUI(float partialTicks, long nanoTime, CallbackInfo ci)
42 { 44 {
43 - ClientProxy.preRenderGUI(partialTicks); 45 + this.broker.preRenderGUI(partialTicks);
44 } 46 }
45 47
46 @Inject(method = "updateCameraAndRender(FJ)V", at = @At( 48 @Inject(method = "updateCameraAndRender(FJ)V", at = @At(
@@ -49,7 +51,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -49,7 +51,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
49 )) 51 ))
50 private void onRenderHUD(float partialTicks, long nanoTime, CallbackInfo ci) 52 private void onRenderHUD(float partialTicks, long nanoTime, CallbackInfo ci)
51 { 53 {
52 - ClientProxy.onRenderHUD(partialTicks); 54 + this.broker.onRenderHUD(partialTicks);
53 } 55 }
54 56
55 @Inject(method = "updateCameraAndRender(FJ)V", at = @At( 57 @Inject(method = "updateCameraAndRender(FJ)V", at = @At(
@@ -59,7 +61,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -59,7 +61,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
59 )) 61 ))
60 private void onPostRenderHUD(float partialTicks, long nanoTime, CallbackInfo ci) 62 private void onPostRenderHUD(float partialTicks, long nanoTime, CallbackInfo ci)
61 { 63 {
62 - ClientProxy.postRenderHUD(partialTicks); 64 + this.broker.postRenderHUD(partialTicks);
63 } 65 }
64 66
65 @Inject(method = "renderWorld(FJ)V", at = @At( 67 @Inject(method = "renderWorld(FJ)V", at = @At(
@@ -69,7 +71,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -69,7 +71,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
69 )) 71 ))
70 private void onRenderWorld(float partialTicks, long timeSlice, CallbackInfo ci) 72 private void onRenderWorld(float partialTicks, long timeSlice, CallbackInfo ci)
71 { 73 {
72 - ClientProxy.onRenderWorld(partialTicks, timeSlice); 74 + this.broker.onRenderWorld(partialTicks, timeSlice);
73 } 75 }
74 76
75 @Inject(method = "renderWorld(FJ)V", at = @At( 77 @Inject(method = "renderWorld(FJ)V", at = @At(
@@ -79,7 +81,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -79,7 +81,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
79 )) 81 ))
80 private void onPostRender(float partialTicks, long timeSlice, CallbackInfo ci) 82 private void onPostRender(float partialTicks, long timeSlice, CallbackInfo ci)
81 { 83 {
82 - ClientProxy.postRender(partialTicks, timeSlice); 84 + this.broker.postRender(partialTicks, timeSlice);
83 } 85 }
84 86
85 @Inject(method = "renderWorldPass(IFJ)V", at = @At( 87 @Inject(method = "renderWorldPass(IFJ)V", at = @At(
@@ -89,7 +91,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -89,7 +91,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
89 )) 91 ))
90 private void onSetupCameraTransform(int pass, float partialTicks, long timeSlice, CallbackInfo ci) 92 private void onSetupCameraTransform(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
91 { 93 {
92 - ClientProxy.onSetupCameraTransform(pass, partialTicks, timeSlice); 94 + this.broker.onSetupCameraTransform(pass, partialTicks, timeSlice);
93 } 95 }
94 96
95 @Inject(method = "renderWorldPass(IFJ)V", at = @At( 97 @Inject(method = "renderWorldPass(IFJ)V", at = @At(
@@ -99,7 +101,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -99,7 +101,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
99 )) 101 ))
100 private void onRenderSky(int pass, float partialTicks, long timeSlice, CallbackInfo ci) 102 private void onRenderSky(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
101 { 103 {
102 - ClientProxy.onRenderSky(pass, partialTicks, timeSlice); 104 + this.broker.onRenderSky(partialTicks, pass, timeSlice);
103 } 105 }
104 106
105 @Inject(method = "renderWorldPass(IFJ)V", at = @At( 107 @Inject(method = "renderWorldPass(IFJ)V", at = @At(
@@ -109,8 +111,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -109,8 +111,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
109 )) 111 ))
110 private void onRenderTerrain(int pass, float partialTicks, long timeSlice, CallbackInfo ci) 112 private void onRenderTerrain(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
111 { 113 {
112 - ClientProxy.onRenderTerrain(pass, partialTicks, timeSlice);  
113 - 114 + this.broker.onRenderTerrain(partialTicks, pass, timeSlice);
114 } 115 }
115 116
116 @Inject(method = "renderWorldPass(IFJ)V", at = @At( 117 @Inject(method = "renderWorldPass(IFJ)V", at = @At(
@@ -120,7 +121,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -120,7 +121,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
120 )) 121 ))
121 private void onPostRenderEntities(int pass, float partialTicks, long timeSlice, CallbackInfo ci) 122 private void onPostRenderEntities(int pass, float partialTicks, long timeSlice, CallbackInfo ci)
122 { 123 {
123 - ClientProxy.postRenderEntities(pass, partialTicks, timeSlice); 124 + this.broker.postRenderEntities(partialTicks, timeSlice);
124 } 125 }
125 126
126 @Inject(method = "renderCloudsCheck(Lnet/minecraft/client/renderer/RenderGlobal;FIDDD)V", at = @At( 127 @Inject(method = "renderCloudsCheck(Lnet/minecraft/client/renderer/RenderGlobal;FIDDD)V", at = @At(
@@ -129,7 +130,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer @@ -129,7 +130,7 @@ public abstract class MixinEntityRenderer implements IEntityRenderer
129 )) 130 ))
130 private void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass, double x, double y, double z, CallbackInfo ci) 131 private void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass, double x, double y, double z, CallbackInfo ci)
131 { 132 {
132 - ClientProxy.onRenderClouds(renderGlobalIn, partialTicks, pass); 133 + this.broker.onRenderClouds(partialTicks, pass, renderGlobalIn);
133 } 134 }
134 135
135 @Override 136 @Override
src/client/java/com/mumfrey/liteloader/client/mixin/MixinFramebuffer.java
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At; @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At;
10 import org.spongepowered.asm.mixin.injection.Inject; 10 import org.spongepowered.asm.mixin.injection.Inject;
11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12 12
13 -import com.mumfrey.liteloader.client.ClientProxy; 13 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
14 import com.mumfrey.liteloader.client.ducks.IFramebuffer; 14 import com.mumfrey.liteloader.client.ducks.IFramebuffer;
15 15
16 import net.minecraft.client.shader.Framebuffer; 16 import net.minecraft.client.shader.Framebuffer;
@@ -18,6 +18,8 @@ import net.minecraft.client.shader.Framebuffer; @@ -18,6 +18,8 @@ import net.minecraft.client.shader.Framebuffer;
18 @Mixin(Framebuffer.class) 18 @Mixin(Framebuffer.class)
19 public abstract class MixinFramebuffer implements IFramebuffer 19 public abstract class MixinFramebuffer implements IFramebuffer
20 { 20 {
  21 + private LiteLoaderEventBrokerClient broker;
  22 +
21 private boolean dispatchRenderEvent; 23 private boolean dispatchRenderEvent;
22 24
23 @Override 25 @Override
@@ -39,10 +41,15 @@ public abstract class MixinFramebuffer implements IFramebuffer @@ -39,10 +41,15 @@ public abstract class MixinFramebuffer implements IFramebuffer
39 )) 41 ))
40 private void onRenderFBO(int width, int height, boolean flag, CallbackInfo ci) 42 private void onRenderFBO(int width, int height, boolean flag, CallbackInfo ci)
41 { 43 {
42 - if (this.dispatchRenderEvent) 44 + if (this.broker == null)
  45 + {
  46 + this.broker = LiteLoaderEventBrokerClient.getInstance();
  47 + }
  48 +
  49 + if (this.dispatchRenderEvent && this.broker != null)
43 { 50 {
44 - ClientProxy.renderFBO((Framebuffer)(Object)this, width, height, flag);  
45 - this.dispatchRenderEvent = false; 51 + this.broker.onRenderFBO((Framebuffer)(Object)this, width, height);
46 } 52 }
  53 + this.dispatchRenderEvent = false;
47 } 54 }
48 } 55 }
src/client/java/com/mumfrey/liteloader/client/mixin/MixinGuiIngame.java
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.At.Shift; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.At.Shift;
13 import org.spongepowered.asm.mixin.injection.Inject; 13 import org.spongepowered.asm.mixin.injection.Inject;
14 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15 15
16 -import com.mumfrey.liteloader.client.ClientProxy; 16 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
17 17
18 import net.minecraft.client.gui.Gui; 18 import net.minecraft.client.gui.Gui;
19 import net.minecraft.client.gui.GuiIngame; 19 import net.minecraft.client.gui.GuiIngame;
@@ -24,13 +24,15 @@ public abstract class MixinGuiIngame extends Gui @@ -24,13 +24,15 @@ public abstract class MixinGuiIngame extends Gui
24 { 24 {
25 @Shadow @Final private GuiNewChat persistantChatGUI; 25 @Shadow @Final private GuiNewChat persistantChatGUI;
26 26
  27 + private LiteLoaderEventBrokerClient broker = LiteLoaderEventBrokerClient.getInstance();
  28 +
27 @Inject(method = "renderGameOverlay(F)V", at = @At( 29 @Inject(method = "renderGameOverlay(F)V", at = @At(
28 value = "INVOKE", 30 value = "INVOKE",
29 target = "Lnet/minecraft/client/gui/GuiNewChat;drawChat(I)V" 31 target = "Lnet/minecraft/client/gui/GuiNewChat;drawChat(I)V"
30 )) 32 ))
31 private void onRenderChat(float partialTicks, CallbackInfo ci) 33 private void onRenderChat(float partialTicks, CallbackInfo ci)
32 { 34 {
33 - ClientProxy.onRenderChat(this.persistantChatGUI, partialTicks); 35 + this.broker.onRenderChat(this.persistantChatGUI, partialTicks);
34 } 36 }
35 37
36 @Inject(method = "renderGameOverlay(F)V", at = @At( 38 @Inject(method = "renderGameOverlay(F)V", at = @At(
@@ -40,6 +42,6 @@ public abstract class MixinGuiIngame extends Gui @@ -40,6 +42,6 @@ public abstract class MixinGuiIngame extends Gui
40 )) 42 ))
41 private void postRenderChat(float partialTicks, CallbackInfo ci) 43 private void postRenderChat(float partialTicks, CallbackInfo ci)
42 { 44 {
43 - ClientProxy.postRenderChat(this.persistantChatGUI, partialTicks); 45 + this.broker.postRenderChat(this.persistantChatGUI, partialTicks);
44 } 46 }
45 } 47 }
src/client/java/com/mumfrey/liteloader/client/mixin/MixinIntegratedServer.java
@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
14 import com.mojang.authlib.GameProfileRepository; 14 import com.mojang.authlib.GameProfileRepository;
15 import com.mojang.authlib.minecraft.MinecraftSessionService; 15 import com.mojang.authlib.minecraft.MinecraftSessionService;
16 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; 16 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
17 -import com.mumfrey.liteloader.client.ClientProxy; 17 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
18 18
19 import net.minecraft.client.Minecraft; 19 import net.minecraft.client.Minecraft;
20 import net.minecraft.server.MinecraftServer; 20 import net.minecraft.server.MinecraftServer;
@@ -25,6 +25,8 @@ import net.minecraft.world.WorldSettings; @@ -25,6 +25,8 @@ import net.minecraft.world.WorldSettings;
25 @Mixin(IntegratedServer.class) 25 @Mixin(IntegratedServer.class)
26 public abstract class MixinIntegratedServer extends MinecraftServer 26 public abstract class MixinIntegratedServer extends MinecraftServer
27 { 27 {
  28 + private LiteLoaderEventBrokerClient broker = LiteLoaderEventBrokerClient.getInstance();
  29 +
28 public MixinIntegratedServer() 30 public MixinIntegratedServer()
29 { 31 {
30 super(null, null, null, null, null, null, null); 32 super(null, null, null, null, null, null, null);
@@ -38,7 +40,7 @@ public abstract class MixinIntegratedServer extends MinecraftServer @@ -38,7 +40,7 @@ public abstract class MixinIntegratedServer extends MinecraftServer
38 private void onConstructed(Minecraft mcIn, String folderName, String worldName, WorldSettings settings, YggdrasilAuthenticationService authSrv, 40 private void onConstructed(Minecraft mcIn, String folderName, String worldName, WorldSettings settings, YggdrasilAuthenticationService authSrv,
39 MinecraftSessionService sessionSrv, GameProfileRepository profileRepo, PlayerProfileCache profileCache, CallbackInfo ci) 41 MinecraftSessionService sessionSrv, GameProfileRepository profileRepo, PlayerProfileCache profileCache, CallbackInfo ci)
40 { 42 {
41 - ClientProxy.onCreateIntegratedServer((IntegratedServer)(Object)this, folderName, worldName, settings); 43 + this.broker.onStartServer(this, folderName, worldName, settings);
42 } 44 }
43 45
44 @Surrogate 46 @Surrogate
src/client/java/com/mumfrey/liteloader/client/mixin/MixinMinecraft.java
@@ -17,7 +17,8 @@ import org.spongepowered.asm.mixin.injection.Redirect; @@ -17,7 +17,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
17 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 17 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
18 18
19 import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton; 19 import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton;
20 -import com.mumfrey.liteloader.client.ClientProxy; 20 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
  21 +import com.mumfrey.liteloader.client.ducks.IFramebuffer;
21 import com.mumfrey.liteloader.client.overlays.IMinecraft; 22 import com.mumfrey.liteloader.client.overlays.IMinecraft;
22 23
23 import net.minecraft.client.Minecraft; 24 import net.minecraft.client.Minecraft;
@@ -40,22 +41,35 @@ public abstract class MixinMinecraft implements IMinecraft @@ -40,22 +41,35 @@ public abstract class MixinMinecraft implements IMinecraft
40 @Shadow private void rightClickMouse() {} 41 @Shadow private void rightClickMouse() {}
41 @Shadow private void middleClickMouse() {} 42 @Shadow private void middleClickMouse() {}
42 43
  44 + private LiteLoaderEventBrokerClient broker;
  45 +
43 @Inject(method = "init()V", at = @At("RETURN")) 46 @Inject(method = "init()V", at = @At("RETURN"))
44 private void onStartupComplete(CallbackInfo ci) 47 private void onStartupComplete(CallbackInfo ci)
45 { 48 {
46 - ClientProxy.onStartupComplete(); 49 + this.broker = LiteLoaderEventBrokerClient.getInstance();
  50 +
  51 + if (this.broker == null)
  52 + {
  53 + throw new RuntimeException("LiteLoader failed to start up properly."
  54 + + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");
  55 + }
  56 +
  57 + this.broker.onStartupComplete();
47 } 58 }
48 59
49 @Inject(method = "updateFramebufferSize()V", at = @At("HEAD")) 60 @Inject(method = "updateFramebufferSize()V", at = @At("HEAD"))
50 private void onResize(CallbackInfo ci) 61 private void onResize(CallbackInfo ci)
51 { 62 {
52 - ClientProxy.onResize((Minecraft)(Object)this); 63 + if (this.broker != null)
  64 + {
  65 + this.broker.onResize((Minecraft)(Object)this);
  66 + }
53 } 67 }
54 68
55 @Inject(method = "runTick()V", at = @At("HEAD")) 69 @Inject(method = "runTick()V", at = @At("HEAD"))
56 private void newTick(CallbackInfo ci) 70 private void newTick(CallbackInfo ci)
57 { 71 {
58 - ClientProxy.newTick(); 72 +// ClientProxy.newTick();
59 } 73 }
60 74
61 @Inject(method = "runGameLoop()V", at = @At( 75 @Inject(method = "runGameLoop()V", at = @At(
@@ -65,7 +79,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -65,7 +79,7 @@ public abstract class MixinMinecraft implements IMinecraft
65 )) 79 ))
66 private void onTick(CallbackInfo ci) 80 private void onTick(CallbackInfo ci)
67 { 81 {
68 - ClientProxy.onTick(); 82 + this.broker.onTick();
69 } 83 }
70 84
71 @Redirect(method = "runGameLoop()V", at = @At( 85 @Redirect(method = "runGameLoop()V", at = @At(
@@ -75,11 +89,17 @@ public abstract class MixinMinecraft implements IMinecraft @@ -75,11 +89,17 @@ public abstract class MixinMinecraft implements IMinecraft
75 private void renderFBO(Framebuffer framebufferMc, int width, int height) 89 private void renderFBO(Framebuffer framebufferMc, int width, int height)
76 { 90 {
77 boolean fboEnabled = OpenGlHelper.isFramebufferEnabled(); 91 boolean fboEnabled = OpenGlHelper.isFramebufferEnabled();
78 - if (fboEnabled) 92 + if (fboEnabled && this.broker != null)
79 { 93 {
80 - ClientProxy.preRenderFBO(framebufferMc); 94 + if (framebufferMc instanceof IFramebuffer)
  95 + {
  96 + ((IFramebuffer)framebufferMc).setDispatchRenderEvent(true);
  97 + }
  98 + this.broker.preRenderFBO(framebufferMc);
  99 +
81 framebufferMc.framebufferRender(width, height); 100 framebufferMc.framebufferRender(width, height);
82 - ClientProxy.preRenderFBO(framebufferMc); 101 +
  102 + this.broker.postRenderFBO(framebufferMc);
83 } 103 }
84 else 104 else
85 { 105 {
@@ -94,7 +114,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -94,7 +114,7 @@ public abstract class MixinMinecraft implements IMinecraft
94 )) 114 ))
95 private void onTimerUpdate(CallbackInfo ci) 115 private void onTimerUpdate(CallbackInfo ci)
96 { 116 {
97 - ClientProxy.onTimerUpdate(); 117 + this.broker.onTimerUpdate();
98 } 118 }
99 119
100 @Inject(method = "runGameLoop()V", at = @At( 120 @Inject(method = "runGameLoop()V", at = @At(
@@ -104,7 +124,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -104,7 +124,7 @@ public abstract class MixinMinecraft implements IMinecraft
104 )) 124 ))
105 private void onRender(CallbackInfo ci) 125 private void onRender(CallbackInfo ci)
106 { 126 {
107 - ClientProxy.onRender(); 127 + this.broker.onRender();
108 } 128 }
109 129
110 @Redirect(method = "processKeyBinds()V", at = @At( 130 @Redirect(method = "processKeyBinds()V", at = @At(
@@ -113,7 +133,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -113,7 +133,7 @@ public abstract class MixinMinecraft implements IMinecraft
113 )) 133 ))
114 private void onClickMouse(Minecraft self) 134 private void onClickMouse(Minecraft self)
115 { 135 {
116 - if (ClientProxy.onClickMouse(self.player, MouseButton.LEFT)) 136 + if (this.broker.onClickMouse(self.player, MouseButton.LEFT))
117 { 137 {
118 this.clickMouse(); 138 this.clickMouse();
119 } 139 }
@@ -128,7 +148,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -128,7 +148,7 @@ public abstract class MixinMinecraft implements IMinecraft
128 ) 148 )
129 private void onMouseHeld(boolean leftClick, CallbackInfo ci) 149 private void onMouseHeld(boolean leftClick, CallbackInfo ci)
130 { 150 {
131 - if (!ClientProxy.onMouseHeld(((Minecraft)(Object)this).player, MouseButton.LEFT)) 151 + if (!this.broker.onMouseHeld(((Minecraft)(Object)this).player, MouseButton.LEFT))
132 { 152 {
133 ci.cancel(); 153 ci.cancel();
134 } 154 }
@@ -141,7 +161,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -141,7 +161,7 @@ public abstract class MixinMinecraft implements IMinecraft
141 )) 161 ))
142 private void onRightClickMouse(Minecraft self) 162 private void onRightClickMouse(Minecraft self)
143 { 163 {
144 - if (ClientProxy.onClickMouse(self.player, MouseButton.RIGHT)) 164 + if (this.broker.onClickMouse(self.player, MouseButton.RIGHT))
145 { 165 {
146 this.rightClickMouse(); 166 this.rightClickMouse();
147 } 167 }
@@ -154,7 +174,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -154,7 +174,7 @@ public abstract class MixinMinecraft implements IMinecraft
154 )) 174 ))
155 private void onRightMouseHeld(Minecraft self) 175 private void onRightMouseHeld(Minecraft self)
156 { 176 {
157 - if (ClientProxy.onMouseHeld(self.player, MouseButton.RIGHT)) 177 + if (this.broker.onMouseHeld(self.player, MouseButton.RIGHT))
158 { 178 {
159 this.rightClickMouse(); 179 this.rightClickMouse();
160 } 180 }
@@ -166,7 +186,7 @@ public abstract class MixinMinecraft implements IMinecraft @@ -166,7 +186,7 @@ public abstract class MixinMinecraft implements IMinecraft
166 )) 186 ))
167 private void onMiddleClickMouse(Minecraft self) 187 private void onMiddleClickMouse(Minecraft self)
168 { 188 {
169 - if (ClientProxy.onClickMouse(self.player, MouseButton.MIDDLE)) 189 + if (this.broker.onClickMouse(self.player, MouseButton.MIDDLE))
170 { 190 {
171 this.middleClickMouse(); 191 this.middleClickMouse();
172 } 192 }
src/client/java/com/mumfrey/liteloader/client/mixin/MixinRenderManager.java
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.Shadow; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.Shadow;
13 import org.spongepowered.asm.mixin.injection.At; 13 import org.spongepowered.asm.mixin.injection.At;
14 import org.spongepowered.asm.mixin.injection.Redirect; 14 import org.spongepowered.asm.mixin.injection.Redirect;
15 15
16 -import com.mumfrey.liteloader.client.ClientProxy; 16 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
17 import com.mumfrey.liteloader.client.ducks.IRenderManager; 17 import com.mumfrey.liteloader.client.ducks.IRenderManager;
18 18
19 import net.minecraft.client.renderer.entity.Render; 19 import net.minecraft.client.renderer.entity.Render;
@@ -25,6 +25,8 @@ public abstract class MixinRenderManager implements IRenderManager @@ -25,6 +25,8 @@ public abstract class MixinRenderManager implements IRenderManager
25 { 25 {
26 @Shadow @Final private Map<Class<? extends Entity>, Render<? extends Entity>> entityRenderMap; 26 @Shadow @Final private Map<Class<? extends Entity>, Render<? extends Entity>> entityRenderMap;
27 27
  28 + private LiteLoaderEventBrokerClient broker;
  29 +
28 @Override 30 @Override
29 public Map<Class<? extends Entity>, Render<? extends Entity>> getRenderMap() 31 public Map<Class<? extends Entity>, Render<? extends Entity>> getRenderMap()
30 { 32 {
@@ -37,9 +39,13 @@ public abstract class MixinRenderManager implements IRenderManager @@ -37,9 +39,13 @@ public abstract class MixinRenderManager implements IRenderManager
37 )) 39 ))
38 private <T extends Entity> void onRenderEntity(Render<T> render, T entity, double x, double y, double z, float entityYaw, float partialTicks) 40 private <T extends Entity> void onRenderEntity(Render<T> render, T entity, double x, double y, double z, float entityYaw, float partialTicks)
39 { 41 {
40 - RenderManager source = (RenderManager)(Object)this;  
41 - ClientProxy.onRenderEntity(source, render, entity, x, y, z, entityYaw, partialTicks); 42 + if (this.broker == null)
  43 + {
  44 + this.broker = LiteLoaderEventBrokerClient.getInstance();
  45 + }
  46 +
  47 + this.broker.onRenderEntity((RenderManager)(Object)this, entity, x, y, z, entityYaw, partialTicks, render);
42 render.doRender(entity, x, y, z, entityYaw, partialTicks); 48 render.doRender(entity, x, y, z, entityYaw, partialTicks);
43 - ClientProxy.onPostRenderEntity(source, render, entity, x, y, z, entityYaw, partialTicks); 49 + this.broker.onPostRenderEntity((RenderManager)(Object)this, entity, x, y, z, entityYaw, partialTicks, render);
44 } 50 }
45 } 51 }
src/client/java/com/mumfrey/liteloader/client/mixin/MixinScreenShotHelper.java
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.At; @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.At;
12 import org.spongepowered.asm.mixin.injection.Inject; 12 import org.spongepowered.asm.mixin.injection.Inject;
13 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
14 14
15 -import com.mumfrey.liteloader.client.ClientProxy; 15 +import com.mumfrey.liteloader.client.LiteLoaderEventBrokerClient;
16 16
17 import net.minecraft.client.shader.Framebuffer; 17 import net.minecraft.client.shader.Framebuffer;
18 import net.minecraft.util.ScreenShotHelper; 18 import net.minecraft.util.ScreenShotHelper;
@@ -34,6 +34,6 @@ public abstract class MixinScreenShotHelper @@ -34,6 +34,6 @@ public abstract class MixinScreenShotHelper
34 ) 34 )
35 private static void onSaveScreenshot(File gameDir, String name, int width, int height, Framebuffer fbo, CallbackInfoReturnable<ITextComponent> ci) 35 private static void onSaveScreenshot(File gameDir, String name, int width, int height, Framebuffer fbo, CallbackInfoReturnable<ITextComponent> ci)
36 { 36 {
37 - ClientProxy.onSaveScreenshot(ci, gameDir, name, width, height, fbo); 37 + LiteLoaderEventBrokerClient.getInstance().onScreenshot(ci, name, width, height, fbo);
38 } 38 }
39 } 39 }
src/main/java/com/mumfrey/liteloader/common/mixin/MixinMinecraftServer.java
@@ -10,16 +10,18 @@ import org.spongepowered.asm.mixin.injection.At; @@ -10,16 +10,18 @@ import org.spongepowered.asm.mixin.injection.At;
10 import org.spongepowered.asm.mixin.injection.Inject; 10 import org.spongepowered.asm.mixin.injection.Inject;
11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12 12
13 -import com.mumfrey.liteloader.core.Proxy; 13 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker;
14 14
15 import net.minecraft.server.MinecraftServer; 15 import net.minecraft.server.MinecraftServer;
16 16
17 @Mixin(MinecraftServer.class) 17 @Mixin(MinecraftServer.class)
18 public abstract class MixinMinecraftServer 18 public abstract class MixinMinecraftServer
19 { 19 {
  20 + LiteLoaderEventBroker<?, ?> broker = LiteLoaderEventBroker.getCommonBroker();
  21 +
20 @Inject(method = "updateTimeLightAndEntities()V", at = @At("HEAD")) 22 @Inject(method = "updateTimeLightAndEntities()V", at = @At("HEAD"))
21 private void onServerTick(CallbackInfo ci) 23 private void onServerTick(CallbackInfo ci)
22 { 24 {
23 - Proxy.onServerTick((MinecraftServer)(Object)this); 25 + this.broker.onServerTick((MinecraftServer)(Object)this);
24 } 26 }
25 } 27 }
src/main/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java
@@ -15,12 +15,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -15,12 +15,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15 import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 15 import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
16 16
17 import com.mumfrey.liteloader.common.ducks.ITeleportHandler; 17 import com.mumfrey.liteloader.common.ducks.ITeleportHandler;
18 -import com.mumfrey.liteloader.core.Proxy; 18 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker;
  19 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.InteractType;
19 20
  21 +import net.minecraft.entity.player.EntityPlayerMP;
20 import net.minecraft.network.NetHandlerPlayServer; 22 import net.minecraft.network.NetHandlerPlayServer;
21 import net.minecraft.network.play.client.CPacketAnimation; 23 import net.minecraft.network.play.client.CPacketAnimation;
22 import net.minecraft.network.play.client.CPacketPlayer; 24 import net.minecraft.network.play.client.CPacketPlayer;
23 import net.minecraft.network.play.client.CPacketPlayerDigging; 25 import net.minecraft.network.play.client.CPacketPlayerDigging;
  26 +import net.minecraft.network.play.client.CPacketPlayerDigging.Action;
24 import net.minecraft.network.play.client.CPacketPlayerTryUseItem; 27 import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
25 import net.minecraft.util.math.Vec3d; 28 import net.minecraft.util.math.Vec3d;
26 import net.minecraft.world.WorldServer; 29 import net.minecraft.world.WorldServer;
@@ -30,6 +33,9 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler @@ -30,6 +33,9 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler
30 { 33 {
31 @Shadow private int teleportId; 34 @Shadow private int teleportId;
32 @Shadow private Vec3d targetPos; 35 @Shadow private Vec3d targetPos;
  36 + @Shadow public EntityPlayerMP playerEntity;;
  37 +
  38 + LiteLoaderEventBroker<?, ?> broker = LiteLoaderEventBroker.getCommonBroker();
33 39
34 @Inject( 40 @Inject(
35 method = "processTryUseItem(Lnet/minecraft/network/play/client/CPacketPlayerTryUseItem;)V", 41 method = "processTryUseItem(Lnet/minecraft/network/play/client/CPacketPlayerTryUseItem;)V",
@@ -43,7 +49,7 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler @@ -43,7 +49,7 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler
43 ) 49 )
44 private void onPlaceBlock(CPacketPlayerTryUseItem packetIn, CallbackInfo ci) 50 private void onPlaceBlock(CPacketPlayerTryUseItem packetIn, CallbackInfo ci)
45 { 51 {
46 - Proxy.onPlaceBlock(ci, (NetHandlerPlayServer)(Object)this, packetIn); 52 +// this.onPlaceBlock(ci, (NetHandlerPlayServer)(Object)this, packetIn);
47 } 53 }
48 54
49 @Inject( 55 @Inject(
@@ -58,7 +64,10 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler @@ -58,7 +64,10 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler
58 ) 64 )
59 private void onClickedAir(CPacketAnimation packetIn, CallbackInfo ci) 65 private void onClickedAir(CPacketAnimation packetIn, CallbackInfo ci)
60 { 66 {
61 - Proxy.onClickedAir(ci, (NetHandlerPlayServer)(Object)this, packetIn); 67 + if (!this.broker.onClickedAir(InteractType.LEFT_CLICK, ((NetHandlerPlayServer)(Object)this).playerEntity, packetIn.getHand()))
  68 + {
  69 + ci.cancel();
  70 + }
62 } 71 }
63 72
64 @Inject( 73 @Inject(
@@ -73,7 +82,26 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler @@ -73,7 +82,26 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler
73 ) 82 )
74 private void onPlayerDigging(CPacketPlayerDigging packetIn, CallbackInfo ci) 83 private void onPlayerDigging(CPacketPlayerDigging packetIn, CallbackInfo ci)
75 { 84 {
76 - Proxy.onPlayerDigging(ci, (NetHandlerPlayServer)(Object)this, packetIn); 85 + NetHandlerPlayServer netHandler = (NetHandlerPlayServer)(Object)this;
  86 + Action action = packetIn.getAction();
  87 + if (action == Action.START_DESTROY_BLOCK)
  88 + {
  89 + if (!this.broker.onPlayerDigging(InteractType.DIG_BLOCK_MAYBE, this.playerEntity, netHandler, packetIn.getPosition()))
  90 + {
  91 + ci.cancel();
  92 + }
  93 + }
  94 + else if (action == Action.ABORT_DESTROY_BLOCK || action == Action.STOP_DESTROY_BLOCK)
  95 + {
  96 + this.broker.onPlayerDigging(InteractType.DIG_BLOCK_END, this.playerEntity, netHandler, packetIn.getPosition());
  97 + }
  98 + else if (action == Action.SWAP_HELD_ITEMS)
  99 + {
  100 + if (!this.broker.onPlayerSwapItems(this.playerEntity))
  101 + {
  102 + ci.cancel();
  103 + }
  104 + }
77 } 105 }
78 106
79 @Inject( 107 @Inject(
@@ -89,7 +117,10 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler @@ -89,7 +117,10 @@ public abstract class MixinNetHandlerPlayServer implements ITeleportHandler
89 ) 117 )
90 private void onPlayerMoved(CPacketPlayer packetIn, CallbackInfo ci, WorldServer world) 118 private void onPlayerMoved(CPacketPlayer packetIn, CallbackInfo ci, WorldServer world)
91 { 119 {
92 - Proxy.onPlayerMoved(ci, (NetHandlerPlayServer)(Object)this, packetIn, world); 120 + if (!this.broker.onPlayerMove((NetHandlerPlayServer)(Object)this, packetIn, this.playerEntity, world))
  121 + {
  122 + ci.cancel();
  123 + }
93 } 124 }
94 125
95 @Override 126 @Override
src/main/java/com/mumfrey/liteloader/common/mixin/MixinPlayerInteractionManager.java
@@ -11,9 +11,11 @@ import org.spongepowered.asm.mixin.injection.Inject; @@ -11,9 +11,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13 13
14 -import com.mumfrey.liteloader.core.Proxy; 14 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker;
  15 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.InteractType;
15 16
16 import net.minecraft.entity.player.EntityPlayer; 17 import net.minecraft.entity.player.EntityPlayer;
  18 +import net.minecraft.entity.player.EntityPlayerMP;
17 import net.minecraft.item.ItemStack; 19 import net.minecraft.item.ItemStack;
18 import net.minecraft.server.management.PlayerInteractionManager; 20 import net.minecraft.server.management.PlayerInteractionManager;
19 import net.minecraft.util.EnumActionResult; 21 import net.minecraft.util.EnumActionResult;
@@ -25,6 +27,8 @@ import net.minecraft.world.World; @@ -25,6 +27,8 @@ import net.minecraft.world.World;
25 @Mixin(value = PlayerInteractionManager.class, priority = 2000) 27 @Mixin(value = PlayerInteractionManager.class, priority = 2000)
26 public abstract class MixinPlayerInteractionManager 28 public abstract class MixinPlayerInteractionManager
27 { 29 {
  30 + LiteLoaderEventBroker<?, ?> broker = LiteLoaderEventBroker.getCommonBroker();
  31 +
28 @Inject( 32 @Inject(
29 method = "onBlockClicked(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)V", 33 method = "onBlockClicked(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)V",
30 cancellable = true, 34 cancellable = true,
@@ -32,7 +36,10 @@ public abstract class MixinPlayerInteractionManager @@ -32,7 +36,10 @@ public abstract class MixinPlayerInteractionManager
32 ) 36 )
33 private void onBlockClicked(BlockPos pos, EnumFacing side, CallbackInfo ci) 37 private void onBlockClicked(BlockPos pos, EnumFacing side, CallbackInfo ci)
34 { 38 {
35 - Proxy.onBlockClicked(ci, (PlayerInteractionManager)(Object)this, pos, side); 39 + if (!this.broker.onBlockClicked(pos, side, (PlayerInteractionManager)(Object)this))
  40 + {
  41 + ci.cancel();
  42 + }
36 } 43 }
37 44
38 @Inject( 45 @Inject(
@@ -45,7 +52,15 @@ public abstract class MixinPlayerInteractionManager @@ -45,7 +52,15 @@ public abstract class MixinPlayerInteractionManager
45 private void onRightClickBlock(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, BlockPos pos, EnumFacing side, 52 private void onRightClickBlock(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, BlockPos pos, EnumFacing side,
46 float offsetX, float offsetY, float offsetZ, CallbackInfoReturnable<EnumActionResult> cir) 53 float offsetX, float offsetY, float offsetZ, CallbackInfoReturnable<EnumActionResult> cir)
47 { 54 {
48 - Proxy.onRightClickBlock(cir, player, worldIn, stack, hand, pos, side, offsetX, offsetY, offsetZ); 55 + if (!(player instanceof EntityPlayerMP))
  56 + {
  57 + return;
  58 + }
  59 +
  60 + if (!this.broker.onUseItem((EntityPlayerMP)player, hand, stack, pos, side))
  61 + {
  62 + cir.setReturnValue(EnumActionResult.FAIL);
  63 + }
49 } 64 }
50 65
51 // @Inject( 66 // @Inject(
@@ -58,7 +73,12 @@ public abstract class MixinPlayerInteractionManager @@ -58,7 +73,12 @@ public abstract class MixinPlayerInteractionManager
58 // private void postRightClickBlock(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, BlockPos pos, EnumFacing side, 73 // private void postRightClickBlock(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, BlockPos pos, EnumFacing side,
59 // float offsetX, float offsetY, float offsetZ, CallbackInfoReturnable<EnumActionResult> cir) 74 // float offsetX, float offsetY, float offsetZ, CallbackInfoReturnable<EnumActionResult> cir)
60 // { 75 // {
61 -// Proxy.postRightClickBlock(cir, player, worldIn, stack, hand, pos, side, offsetX, offsetY, offsetZ); 76 +// if (!(player instanceof EntityPlayerMP))
  77 +// {
  78 +// return;
  79 +// }
  80 +//
  81 +// System.err.printf("@@ postRightClickBlock: %s\n", cir.getReturnValue());
62 // } 82 // }
63 83
64 @Inject( 84 @Inject(
@@ -69,6 +89,14 @@ public abstract class MixinPlayerInteractionManager @@ -69,6 +89,14 @@ public abstract class MixinPlayerInteractionManager
69 ) 89 )
70 private void onRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, CallbackInfoReturnable<EnumActionResult> cir) 90 private void onRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand, CallbackInfoReturnable<EnumActionResult> cir)
71 { 91 {
72 - Proxy.onRightClick(cir, player, worldIn, stack, hand); 92 + if (!(player instanceof EntityPlayerMP))
  93 + {
  94 + return;
  95 + }
  96 +
  97 + if (!this.broker.onClickedAir(InteractType.RIGHT_CLICK, (EntityPlayerMP)player, hand))
  98 + {
  99 + cir.setReturnValue(EnumActionResult.FAIL);
  100 + }
73 } 101 }
74 } 102 }
src/main/java/com/mumfrey/liteloader/common/mixin/MixinPlayerList.java
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
14 14
15 import com.mojang.authlib.GameProfile; 15 import com.mojang.authlib.GameProfile;
16 -import com.mumfrey.liteloader.core.Proxy; 16 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker;
17 17
18 import net.minecraft.entity.player.EntityPlayerMP; 18 import net.minecraft.entity.player.EntityPlayerMP;
19 import net.minecraft.network.NetHandlerPlayServer; 19 import net.minecraft.network.NetHandlerPlayServer;
@@ -29,26 +29,26 @@ public abstract class MixinPlayerList @@ -29,26 +29,26 @@ public abstract class MixinPlayerList
29 ) 29 )
30 private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, CallbackInfo ci) 30 private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, CallbackInfo ci)
31 { 31 {
32 - Proxy.onInitializePlayerConnection((PlayerList)(Object)this, netManager, player); 32 + LiteLoaderEventBroker.getCommonBroker().onInitializePlayerConnection((PlayerList)(Object)this, netManager, player);
33 } 33 }
34 34
35 // Because, forge 35 // Because, forge
36 @Surrogate 36 @Surrogate
37 private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, NetHandlerPlayServer nhps, CallbackInfo ci) 37 private void onInitializePlayerConnection(NetworkManager netManager, EntityPlayerMP player, NetHandlerPlayServer nhps, CallbackInfo ci)
38 { 38 {
39 - Proxy.onInitializePlayerConnection((PlayerList)(Object)this, netManager, player); 39 + LiteLoaderEventBroker.getCommonBroker().onInitializePlayerConnection((PlayerList)(Object)this, netManager, player);
40 } 40 }
41 41
42 @Inject(method = "playerLoggedIn(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN")) 42 @Inject(method = "playerLoggedIn(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN"))
43 private void onPlayerLogin(EntityPlayerMP player, CallbackInfo ci) 43 private void onPlayerLogin(EntityPlayerMP player, CallbackInfo ci)
44 { 44 {
45 - Proxy.onPlayerLogin((PlayerList)(Object)this, player); 45 + LiteLoaderEventBroker.getCommonBroker().onPlayerLogin((PlayerList)(Object)this, player);
46 } 46 }
47 47
48 @Inject(method = "playerLoggedOut(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN")) 48 @Inject(method = "playerLoggedOut(Lnet/minecraft/entity/player/EntityPlayerMP;)V", at = @At("RETURN"))
49 private void onPlayerLogout(EntityPlayerMP player, CallbackInfo ci) 49 private void onPlayerLogout(EntityPlayerMP player, CallbackInfo ci)
50 { 50 {
51 - Proxy.onPlayerLogout((PlayerList)(Object)this, player); 51 + LiteLoaderEventBroker.getCommonBroker().onPlayerLogout((PlayerList)(Object)this, player);
52 } 52 }
53 53
54 @Inject( 54 @Inject(
@@ -58,7 +58,7 @@ public abstract class MixinPlayerList @@ -58,7 +58,7 @@ public abstract class MixinPlayerList
58 ) 58 )
59 private void onSpawnPlayer(GameProfile profile, CallbackInfoReturnable<EntityPlayerMP> cir) 59 private void onSpawnPlayer(GameProfile profile, CallbackInfoReturnable<EntityPlayerMP> cir)
60 { 60 {
61 - Proxy.onSpawnPlayer(cir, (PlayerList)(Object)this, profile); 61 + LiteLoaderEventBroker.getCommonBroker().onSpawnPlayer((PlayerList)(Object)this, cir.getReturnValue(), profile);
62 } 62 }
63 63
64 @Inject( 64 @Inject(
@@ -68,6 +68,6 @@ public abstract class MixinPlayerList @@ -68,6 +68,6 @@ public abstract class MixinPlayerList
68 ) 68 )
69 private void onRespawnPlayer(EntityPlayerMP player, int dimension, boolean conqueredEnd, CallbackInfoReturnable<EntityPlayerMP> cir) 69 private void onRespawnPlayer(EntityPlayerMP player, int dimension, boolean conqueredEnd, CallbackInfoReturnable<EntityPlayerMP> cir)
70 { 70 {
71 - Proxy.onRespawnPlayer(cir, (PlayerList)(Object)this, player, dimension, conqueredEnd); 71 + LiteLoaderEventBroker.getCommonBroker().onRespawnPlayer((PlayerList)(Object)this, cir.getReturnValue(), player, dimension, conqueredEnd);
72 } 72 }
73 } 73 }
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
@@ -636,6 +636,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator @@ -636,6 +636,7 @@ public class LiteLoaderEnumerator implements LoaderEnumerator
636 } 636 }
637 } 637 }
638 638
  639 + @SuppressWarnings("deprecation")
639 private void addMixinsFrom(MixinContainer<File> container) 640 private void addMixinsFrom(MixinContainer<File> container)
640 { 641 {
641 try 642 try
src/main/java/com/mumfrey/liteloader/core/LiteLoaderEventBroker.java
@@ -118,7 +118,7 @@ public abstract class LiteLoaderEventBroker&lt;TClient, TServer extends MinecraftSe @@ -118,7 +118,7 @@ public abstract class LiteLoaderEventBroker&lt;TClient, TServer extends MinecraftSe
118 /** 118 /**
119 * Singleton 119 * Singleton
120 */ 120 */
121 - static LiteLoaderEventBroker<?, ?> broker; 121 + protected static LiteLoaderEventBroker<?, ?> broker;
122 122
123 /** 123 /**
124 * Reference to the loader instance 124 * Reference to the loader instance
@@ -191,6 +191,12 @@ public abstract class LiteLoaderEventBroker&lt;TClient, TServer extends MinecraftSe @@ -191,6 +191,12 @@ public abstract class LiteLoaderEventBroker&lt;TClient, TServer extends MinecraftSe
191 191
192 LiteLoaderEventBroker.broker = this; 192 LiteLoaderEventBroker.broker = this;
193 } 193 }
  194 +
  195 + @SuppressWarnings("unchecked")
  196 + public static <TClient, TServer extends MinecraftServer> LiteLoaderEventBroker<TClient, TServer> getCommonBroker()
  197 + {
  198 + return (LiteLoaderEventBroker<TClient, TServer>)LiteLoaderEventBroker.broker;
  199 + }
194 200
195 /** 201 /**
196 * @param mods 202 * @param mods
src/main/java/com/mumfrey/liteloader/core/Proxy.java deleted 100644 → 0
1 -/*  
2 - * This file is part of LiteLoader.  
3 - * Copyright (C) 2012-16 Adam Mummery-Smith  
4 - * All Rights Reserved.  
5 - */  
6 -package com.mumfrey.liteloader.core;  
7 -  
8 -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;  
9 -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;  
10 -  
11 -import com.mojang.authlib.GameProfile;  
12 -import com.mumfrey.liteloader.core.LiteLoaderEventBroker.InteractType;  
13 -  
14 -import net.minecraft.entity.player.EntityPlayer;  
15 -import net.minecraft.entity.player.EntityPlayerMP;  
16 -import net.minecraft.item.ItemStack;  
17 -import net.minecraft.network.NetHandlerPlayServer;  
18 -import net.minecraft.network.NetworkManager;  
19 -import net.minecraft.network.play.client.CPacketAnimation;  
20 -import net.minecraft.network.play.client.CPacketPlayer;  
21 -import net.minecraft.network.play.client.CPacketPlayerDigging;  
22 -import net.minecraft.network.play.client.CPacketPlayerDigging.Action;  
23 -import net.minecraft.network.play.client.CPacketPlayerTryUseItem;  
24 -import net.minecraft.server.MinecraftServer;  
25 -import net.minecraft.server.management.PlayerInteractionManager;  
26 -import net.minecraft.server.management.PlayerList;  
27 -import net.minecraft.util.EnumActionResult;  
28 -import net.minecraft.util.EnumFacing;  
29 -import net.minecraft.util.EnumHand;  
30 -import net.minecraft.util.math.BlockPos;  
31 -import net.minecraft.world.World;  
32 -import net.minecraft.world.WorldServer;  
33 -  
34 -public abstract class Proxy  
35 -{  
36 - private static LiteLoaderEventBroker<?, ?> broker;  
37 -  
38 - protected Proxy() {}  
39 -  
40 - protected static void onStartupComplete()  
41 - {  
42 - Proxy.broker = LiteLoaderEventBroker.broker;  
43 -  
44 - if (Proxy.broker == null)  
45 - {  
46 - throw new RuntimeException("LiteLoader failed to start up properly."  
47 - + " The game is in an unstable state and must shut down now. Check the developer log for startup errors");  
48 - }  
49 - }  
50 -  
51 - public static void onInitializePlayerConnection(PlayerList source, NetworkManager netManager, EntityPlayerMP player)  
52 - {  
53 - Proxy.broker.onInitializePlayerConnection(source, netManager, player);  
54 - }  
55 -  
56 - public static void onPlayerLogin(PlayerList source, EntityPlayerMP player)  
57 - {  
58 - Proxy.broker.onPlayerLogin(source, player);  
59 - }  
60 -  
61 - public static void onPlayerLogout(PlayerList source, EntityPlayerMP player)  
62 - {  
63 - Proxy.broker.onPlayerLogout(source, player);  
64 - }  
65 -  
66 - public static void onSpawnPlayer(CallbackInfoReturnable<EntityPlayerMP> cir, PlayerList source, GameProfile profile)  
67 - {  
68 - Proxy.broker.onSpawnPlayer(source, cir.getReturnValue(), profile);  
69 - }  
70 -  
71 - public static void onRespawnPlayer(CallbackInfoReturnable<EntityPlayerMP> cir, PlayerList source, EntityPlayerMP oldPlayer,  
72 - int dimension, boolean won)  
73 - {  
74 - Proxy.broker.onRespawnPlayer(source, cir.getReturnValue(), oldPlayer, dimension, won);  
75 - }  
76 -  
77 - public static void onServerTick(MinecraftServer mcServer)  
78 - {  
79 - Proxy.broker.onServerTick(mcServer);  
80 - }  
81 -  
82 - public static void onPlaceBlock(CallbackInfo ci, NetHandlerPlayServer netHandler, CPacketPlayerTryUseItem packet)  
83 - {  
84 - // Potentially not needed any more  
85 -// if (!Proxy.broker.onPlaceBlock(netHandler, netHandler.playerEntity, packet.getPosition(),  
86 -// EnumFacing.getFront(packet.getPlacedBlockDirection())))  
87 -// {  
88 -// ci.cancel();  
89 -// }  
90 - }  
91 -  
92 - public static void onClickedAir(CallbackInfo ci, NetHandlerPlayServer netHandler, CPacketAnimation packet)  
93 - {  
94 - if (!Proxy.broker.onClickedAir(InteractType.LEFT_CLICK, netHandler.playerEntity, packet.getHand()))  
95 - {  
96 - ci.cancel();  
97 - }  
98 - }  
99 -  
100 - public static void onPlayerDigging(CallbackInfo ci, NetHandlerPlayServer netHandler, CPacketPlayerDigging packet)  
101 - {  
102 - Action action = packet.getAction();  
103 - EntityPlayerMP player = netHandler.playerEntity;  
104 - if (action == Action.START_DESTROY_BLOCK)  
105 - {  
106 - if (!Proxy.broker.onPlayerDigging(InteractType.DIG_BLOCK_MAYBE, player, netHandler, packet.getPosition()))  
107 - {  
108 - ci.cancel();  
109 - }  
110 - }  
111 - else if (action == Action.ABORT_DESTROY_BLOCK || action == Action.STOP_DESTROY_BLOCK)  
112 - {  
113 - Proxy.broker.onPlayerDigging(InteractType.DIG_BLOCK_END, player, netHandler, packet.getPosition());  
114 - }  
115 - else if (action == Action.SWAP_HELD_ITEMS)  
116 - {  
117 - if (!Proxy.broker.onPlayerSwapItems(player))  
118 - {  
119 - ci.cancel();  
120 - }  
121 - }  
122 - }  
123 -  
124 - public static void onRightClickBlock(CallbackInfoReturnable<EnumActionResult> ci, EntityPlayer player, World world, ItemStack stack,  
125 - EnumHand hand, BlockPos pos, EnumFacing side, float offsetX, float offsetY, float offsetZ)  
126 - {  
127 - if (!(player instanceof EntityPlayerMP))  
128 - {  
129 - return;  
130 - }  
131 -  
132 - if (!Proxy.broker.onUseItem((EntityPlayerMP)player, hand, stack, pos, side))  
133 - {  
134 - ci.setReturnValue(EnumActionResult.FAIL);  
135 - }  
136 - }  
137 -  
138 - public static void postRightClickBlock(CallbackInfoReturnable<EnumActionResult> cir, EntityPlayer player, World world, ItemStack stack,  
139 - EnumHand hand, BlockPos pos, EnumFacing side, float offsetX, float offsetY, float offsetZ)  
140 - {  
141 - if (!(player instanceof EntityPlayerMP))  
142 - {  
143 - return;  
144 - }  
145 -  
146 - System.err.printf("@@ postRightClickBlock: %s\n", cir.getReturnValue());  
147 - }  
148 -  
149 - public static void onRightClick(CallbackInfoReturnable<EnumActionResult> cir, EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)  
150 - {  
151 - if (!(player instanceof EntityPlayerMP))  
152 - {  
153 - return;  
154 - }  
155 -  
156 - if (!Proxy.broker.onClickedAir(InteractType.RIGHT_CLICK, (EntityPlayerMP)player, hand))  
157 - {  
158 - cir.setReturnValue(EnumActionResult.FAIL);  
159 - }  
160 - }  
161 -  
162 - public static void onBlockClicked(CallbackInfo ci, PlayerInteractionManager manager, BlockPos pos, EnumFacing side)  
163 - {  
164 - if (!Proxy.broker.onBlockClicked(pos, side, manager))  
165 - {  
166 - ci.cancel();  
167 - }  
168 - }  
169 -  
170 - public static void onPlayerMoved(CallbackInfo ci, NetHandlerPlayServer netHandler, CPacketPlayer packet, WorldServer world, double oldPosX,  
171 - double oldPosY, double oldPosZ)  
172 - {  
173 - if (!Proxy.broker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))  
174 - {  
175 - ci.cancel();  
176 - }  
177 - }  
178 -  
179 - public static void onPlayerMoved(CallbackInfo ci, NetHandlerPlayServer netHandler, CPacketPlayer packet, WorldServer world)  
180 - {  
181 - if (!Proxy.broker.onPlayerMove(netHandler, packet, netHandler.playerEntity, world))  
182 - {  
183 - ci.cancel();  
184 - }  
185 - }  
186 -}  
src/main/java/com/mumfrey/liteloader/crashreport/CrashSectionLaunchWrapper.java
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 package com.mumfrey.liteloader.crashreport; 6 package com.mumfrey.liteloader.crashreport;
7 7
8 import java.util.List; 8 import java.util.List;
9 -import java.util.concurrent.Callable;  
10 9
11 import net.minecraft.crash.CrashReport; 10 import net.minecraft.crash.CrashReport;
12 import net.minecraft.launchwrapper.IClassTransformer; 11 import net.minecraft.launchwrapper.IClassTransformer;