Commit 43cb3bc4b356731b6dc525d74fbcd61d9ed0086c

Authored by Mumfrey
1 parent 11a9a320

Style update part 1 - tabs to spaces

Showing 32 changed files with 2277 additions and 2277 deletions

Too many changes to show.

To preserve performance only 32 of 276 files are displayed.

src/client/java/com/mumfrey/liteloader/ChatFilter.java
@@ -12,14 +12,14 @@ import net.minecraft.util.IChatComponent; @@ -12,14 +12,14 @@ import net.minecraft.util.IChatComponent;
12 */ 12 */
13 public interface ChatFilter extends LiteMod 13 public interface ChatFilter extends LiteMod
14 { 14 {
15 - /**  
16 - * Chat filter function, return false to filter this packet, true to pass the packet  
17 - *  
18 - * @param chat ChatMessageComponent parsed from the chat packet  
19 - * @param message Chat message parsed from the chat message component  
20 - * @param newMessage If you wish to mutate the message, set the value using newMessage.set()  
21 - *  
22 - * @return True to keep the packet, false to discard  
23 - */  
24 - public abstract boolean onChat(IChatComponent chat, String message, ReturnValue<IChatComponent> newMessage); 15 + /**
  16 + * Chat filter function, return false to filter this packet, true to pass the packet
  17 + *
  18 + * @param chat ChatMessageComponent parsed from the chat packet
  19 + * @param message Chat message parsed from the chat message component
  20 + * @param newMessage If you wish to mutate the message, set the value using newMessage.set()
  21 + *
  22 + * @return True to keep the packet, false to discard
  23 + */
  24 + public abstract boolean onChat(IChatComponent chat, String message, ReturnValue<IChatComponent> newMessage);
25 } 25 }
src/client/java/com/mumfrey/liteloader/ChatListener.java
@@ -10,11 +10,11 @@ import net.minecraft.util.IChatComponent; @@ -10,11 +10,11 @@ import net.minecraft.util.IChatComponent;
10 */ 10 */
11 public interface ChatListener extends LiteMod 11 public interface ChatListener extends LiteMod
12 { 12 {
13 - /**  
14 - * Handle an inbound message  
15 - *  
16 - * @param chat IChatComponent parsed from the chat packet  
17 - * @param message Chat message parsed from the chat message component  
18 - */  
19 - public abstract void onChat(IChatComponent chat, String message); 13 + /**
  14 + * Handle an inbound message
  15 + *
  16 + * @param chat IChatComponent parsed from the chat packet
  17 + * @param message Chat message parsed from the chat message component
  18 + */
  19 + public abstract void onChat(IChatComponent chat, String message);
20 } 20 }
src/client/java/com/mumfrey/liteloader/ChatRenderListener.java
@@ -9,7 +9,7 @@ import net.minecraft.client.gui.GuiNewChat; @@ -9,7 +9,7 @@ import net.minecraft.client.gui.GuiNewChat;
9 */ 9 */
10 public interface ChatRenderListener extends LiteMod 10 public interface ChatRenderListener extends LiteMod
11 { 11 {
12 - public abstract void onPreRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);  
13 -  
14 - public abstract void onPostRenderChat(int screenWidth, int screenHeight, GuiNewChat chat); 12 + public abstract void onPreRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);
  13 +
  14 + public abstract void onPostRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);
15 } 15 }
src/client/java/com/mumfrey/liteloader/EntityRenderListener.java
@@ -10,29 +10,29 @@ import net.minecraft.entity.Entity; @@ -10,29 +10,29 @@ import net.minecraft.entity.Entity;
10 */ 10 */
11 public interface EntityRenderListener extends LiteMod 11 public interface EntityRenderListener extends LiteMod
12 { 12 {
13 - /**  
14 - * Called immediately prior to an entity being rendered  
15 - *  
16 - * @param render  
17 - * @param entity  
18 - * @param xPos  
19 - * @param yPos  
20 - * @param zPos  
21 - * @param yaw  
22 - * @param partialTicks  
23 - */  
24 - public abstract void onRenderEntity(Render render, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks); 13 + /**
  14 + * Called immediately prior to an entity being rendered
  15 + *
  16 + * @param render
  17 + * @param entity
  18 + * @param xPos
  19 + * @param yPos
  20 + * @param zPos
  21 + * @param yaw
  22 + * @param partialTicks
  23 + */
  24 + public abstract void onRenderEntity(Render render, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks);
25 25
26 - /**  
27 - * Called immediately following an entity being rendered  
28 - *  
29 - * @param render  
30 - * @param entity  
31 - * @param xPos  
32 - * @param yPos  
33 - * @param zPos  
34 - * @param yaw  
35 - * @param partialTicks  
36 - */  
37 - public abstract void onPostRenderEntity(Render render, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks); 26 + /**
  27 + * Called immediately following an entity being rendered
  28 + *
  29 + * @param render
  30 + * @param entity
  31 + * @param xPos
  32 + * @param yPos
  33 + * @param zPos
  34 + * @param yaw
  35 + * @param partialTicks
  36 + */
  37 + public abstract void onPostRenderEntity(Render render, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks);
38 } 38 }
src/client/java/com/mumfrey/liteloader/FrameBufferListener.java
@@ -9,23 +9,23 @@ import net.minecraft.client.shader.Framebuffer; @@ -9,23 +9,23 @@ import net.minecraft.client.shader.Framebuffer;
9 */ 9 */
10 public interface FrameBufferListener extends LiteMod 10 public interface FrameBufferListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Called before the FBO is rendered. Useful if you want to interact with the FBO before it is drawn to the screen  
14 - */  
15 - public abstract void preRenderFBO(Framebuffer fbo);  
16 -  
17 - /**  
18 - * Called immediately before the FBO is rendered to the screen, after the appropriate IGL modes and matrix transforms  
19 - * have been set but before the FBO is actually rendered into the main output buffer.  
20 - *  
21 - * @param fbo FBO instance  
22 - * @param width FBO width  
23 - * @param height FBO height  
24 - */  
25 - public abstract void onRenderFBO(Framebuffer fbo, int width, int height); 12 + /**
  13 + * Called before the FBO is rendered. Useful if you want to interact with the FBO before it is drawn to the screen
  14 + */
  15 + public abstract void preRenderFBO(Framebuffer fbo);
26 16
27 - /**  
28 - * Called after the FBO is rendered whilst still inside the FBO transform  
29 - */  
30 - public abstract void postRenderFBO(Framebuffer fbo); 17 + /**
  18 + * Called immediately before the FBO is rendered to the screen, after the appropriate IGL modes and matrix transforms
  19 + * have been set but before the FBO is actually rendered into the main output buffer.
  20 + *
  21 + * @param fbo FBO instance
  22 + * @param width FBO width
  23 + * @param height FBO height
  24 + */
  25 + public abstract void onRenderFBO(Framebuffer fbo, int width, int height);
  26 +
  27 + /**
  28 + * Called after the FBO is rendered whilst still inside the FBO transform
  29 + */
  30 + public abstract void postRenderFBO(Framebuffer fbo);
31 } 31 }
src/client/java/com/mumfrey/liteloader/GameLoopListener.java
@@ -9,10 +9,10 @@ import net.minecraft.client.Minecraft; @@ -9,10 +9,10 @@ import net.minecraft.client.Minecraft;
9 */ 9 */
10 public interface GameLoopListener extends LiteMod 10 public interface GameLoopListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Called every frame, before the world is ticked  
14 - *  
15 - * @param minecraft  
16 - */  
17 - public abstract void onRunGameLoop(Minecraft minecraft); 12 + /**
  13 + * Called every frame, before the world is ticked
  14 + *
  15 + * @param minecraft
  16 + */
  17 + public abstract void onRunGameLoop(Minecraft minecraft);
18 } 18 }
src/client/java/com/mumfrey/liteloader/HUDRenderListener.java
@@ -7,7 +7,7 @@ package com.mumfrey.liteloader; @@ -7,7 +7,7 @@ package com.mumfrey.liteloader;
7 */ 7 */
8 public interface HUDRenderListener extends LiteMod 8 public interface HUDRenderListener extends LiteMod
9 { 9 {
10 - public abstract void onPreRenderHUD(int screenWidth, int screenHeight);  
11 -  
12 - public abstract void onPostRenderHUD(int screenWidth, int screenHeight); 10 + public abstract void onPreRenderHUD(int screenWidth, int screenHeight);
  11 +
  12 + public abstract void onPostRenderHUD(int screenWidth, int screenHeight);
13 } 13 }
src/client/java/com/mumfrey/liteloader/InitCompleteListener.java
@@ -12,11 +12,11 @@ import com.mumfrey.liteloader.core.LiteLoader; @@ -12,11 +12,11 @@ import com.mumfrey.liteloader.core.LiteLoader;
12 */ 12 */
13 public interface InitCompleteListener extends Tickable 13 public interface InitCompleteListener extends Tickable
14 { 14 {
15 - /**  
16 - * Called as soon as the game is initialised and the main game loop is running  
17 - *  
18 - * @param minecraft Minecraft instance  
19 - * @param loader LiteLoader instance  
20 - */  
21 - public abstract void onInitCompleted(Minecraft minecraft, LiteLoader loader); 15 + /**
  16 + * Called as soon as the game is initialised and the main game loop is running
  17 + *
  18 + * @param minecraft Minecraft instance
  19 + * @param loader LiteLoader instance
  20 + */
  21 + public abstract void onInitCompleted(Minecraft minecraft, LiteLoader loader);
22 } 22 }
src/client/java/com/mumfrey/liteloader/JoinGameListener.java
@@ -14,13 +14,13 @@ import com.mojang.realmsclient.dto.RealmsServer; @@ -14,13 +14,13 @@ import com.mojang.realmsclient.dto.RealmsServer;
14 */ 14 */
15 public interface JoinGameListener extends LiteMod 15 public interface JoinGameListener extends LiteMod
16 { 16 {
17 - /**  
18 - * Called on join game  
19 - *  
20 - * @param netHandler Net handler  
21 - * @param joinGamePacket Join game packet  
22 - * @param serverData ServerData object representing the server being connected to  
23 - * @param realmsServer If connecting to a realm, a reference to the RealmsServer object  
24 - */  
25 - public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer); 17 + /**
  18 + * Called on join game
  19 + *
  20 + * @param netHandler Net handler
  21 + * @param joinGamePacket Join game packet
  22 + * @param serverData ServerData object representing the server being connected to
  23 + * @param realmsServer If connecting to a realm, a reference to the RealmsServer object
  24 + */
  25 + public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer);
26 } 26 }
src/client/java/com/mumfrey/liteloader/OutboundChatFilter.java
@@ -7,10 +7,10 @@ package com.mumfrey.liteloader; @@ -7,10 +7,10 @@ package com.mumfrey.liteloader;
7 */ 7 */
8 public interface OutboundChatFilter extends LiteMod 8 public interface OutboundChatFilter extends LiteMod
9 { 9 {
10 - /**  
11 - * Raised when a chat message is being sent, return false to filter this message or true to allow it to be sent  
12 - *  
13 - * @param message  
14 - */  
15 - public abstract boolean onSendChatMessage(String message); 10 + /**
  11 + * Raised when a chat message is being sent, return false to filter this message or true to allow it to be sent
  12 + *
  13 + * @param message
  14 + */
  15 + public abstract boolean onSendChatMessage(String message);
16 } 16 }
src/client/java/com/mumfrey/liteloader/OutboundChatListener.java
@@ -9,11 +9,11 @@ import net.minecraft.network.play.client.C01PacketChatMessage; @@ -9,11 +9,11 @@ import net.minecraft.network.play.client.C01PacketChatMessage;
9 */ 9 */
10 public interface OutboundChatListener extends LiteMod 10 public interface OutboundChatListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Raised when a new chat packet is created (not necessarily transmitted, something could be trolling us)  
14 - *  
15 - * @param packet  
16 - * @param message  
17 - */  
18 - public abstract void onSendChatMessage(C01PacketChatMessage packet, String message); 12 + /**
  13 + * Raised when a new chat packet is created (not necessarily transmitted, something could be trolling us)
  14 + *
  15 + * @param packet
  16 + * @param message
  17 + */
  18 + public abstract void onSendChatMessage(C01PacketChatMessage packet, String message);
19 } 19 }
src/client/java/com/mumfrey/liteloader/PostLoginListener.java
@@ -9,12 +9,12 @@ import net.minecraft.network.login.server.S02PacketLoginSuccess; @@ -9,12 +9,12 @@ import net.minecraft.network.login.server.S02PacketLoginSuccess;
9 */ 9 */
10 public interface PostLoginListener extends LiteMod 10 public interface PostLoginListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Called immediately after login, before the player has properly joined the game. Note that this event is raised  
14 - * <b>in the network thread</b> and is not marshalled to the main thread as other packet-generated events are.  
15 - *  
16 - * @param netHandler  
17 - * @param packet  
18 - */  
19 - public abstract void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess packet); 12 + /**
  13 + * Called immediately after login, before the player has properly joined the game. Note that this event is raised
  14 + * <b>in the network thread</b> and is not marshalled to the main thread as other packet-generated events are.
  15 + *
  16 + * @param netHandler
  17 + * @param packet
  18 + */
  19 + public abstract void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess packet);
20 } 20 }
src/client/java/com/mumfrey/liteloader/PostRenderListener.java
@@ -7,17 +7,17 @@ package com.mumfrey.liteloader; @@ -7,17 +7,17 @@ package com.mumfrey.liteloader;
7 */ 7 */
8 public interface PostRenderListener extends LiteMod 8 public interface PostRenderListener extends LiteMod
9 { 9 {
10 - /**  
11 - * Called after entities are rendered but before particles  
12 - *  
13 - * @param partialTicks  
14 - */  
15 - public abstract void onPostRenderEntities(float partialTicks); 10 + /**
  11 + * Called after entities are rendered but before particles
  12 + *
  13 + * @param partialTicks
  14 + */
  15 + public abstract void onPostRenderEntities(float partialTicks);
16 16
17 - /**  
18 - * Called after all world rendering is completed  
19 - *  
20 - * @param partialTicks  
21 - */  
22 - public abstract void onPostRender(float partialTicks); 17 + /**
  18 + * Called after all world rendering is completed
  19 + *
  20 + * @param partialTicks
  21 + */
  22 + public abstract void onPostRender(float partialTicks);
23 } 23 }
src/client/java/com/mumfrey/liteloader/PreRenderListener.java
@@ -9,44 +9,44 @@ import net.minecraft.client.renderer.RenderGlobal; @@ -9,44 +9,44 @@ import net.minecraft.client.renderer.RenderGlobal;
9 */ 9 */
10 public interface PreRenderListener extends LiteMod 10 public interface PreRenderListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Called immediately before rendering of the world (including the sky) is started.  
14 - *  
15 - * @param partialTicks  
16 - */  
17 - public abstract void onRenderWorld(float partialTicks);  
18 -  
19 - /**  
20 - * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled  
21 - *  
22 - * @param partialTicks  
23 - * @param pass  
24 - * @param timeSlice  
25 - */  
26 - public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice);  
27 -  
28 - /**  
29 - * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled  
30 - *  
31 - * @param partialTicks  
32 - * @param pass  
33 - */  
34 - public abstract void onRenderSky(float partialTicks, int pass);  
35 -  
36 - /**  
37 - * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled  
38 - *  
39 - * @param renderGlobal  
40 - * @param partialTicks  
41 - * @param pass  
42 - */  
43 - public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal); 12 + /**
  13 + * Called immediately before rendering of the world (including the sky) is started.
  14 + *
  15 + * @param partialTicks
  16 + */
  17 + public abstract void onRenderWorld(float partialTicks);
44 18
45 - /**  
46 - * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled  
47 - *  
48 - * @param partialTicks  
49 - * @param pass  
50 - */  
51 - public abstract void onRenderTerrain(float partialTicks, int pass); 19 + /**
  20 + * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled
  21 + *
  22 + * @param partialTicks
  23 + * @param pass
  24 + * @param timeSlice
  25 + */
  26 + public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice);
  27 +
  28 + /**
  29 + * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled
  30 + *
  31 + * @param partialTicks
  32 + * @param pass
  33 + */
  34 + public abstract void onRenderSky(float partialTicks, int pass);
  35 +
  36 + /**
  37 + * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled
  38 + *
  39 + * @param renderGlobal
  40 + * @param partialTicks
  41 + * @param pass
  42 + */
  43 + public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal);
  44 +
  45 + /**
  46 + * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled
  47 + *
  48 + * @param partialTicks
  49 + * @param pass
  50 + */
  51 + public abstract void onRenderTerrain(float partialTicks, int pass);
52 } 52 }
src/client/java/com/mumfrey/liteloader/RenderListener.java
@@ -9,28 +9,28 @@ import net.minecraft.client.gui.GuiScreen; @@ -9,28 +9,28 @@ import net.minecraft.client.gui.GuiScreen;
9 */ 9 */
10 public interface RenderListener extends LiteMod 10 public interface RenderListener extends LiteMod
11 { 11 {
12 - /**  
13 - * Callback when a frame is rendered  
14 - */  
15 - public abstract void onRender();  
16 -  
17 - /**  
18 - * Called immediately before the current GUI is rendered  
19 - *  
20 - * @param currentScreen Current screen (if any)  
21 - */  
22 - public abstract void onRenderGui(GuiScreen currentScreen);  
23 -  
24 - /**  
25 - * Called when the world is rendered  
26 - *  
27 - * @deprecated Use PreRenderListener::onRenderWorld(F)V instead  
28 - */  
29 - @Deprecated  
30 - public abstract void onRenderWorld(); 12 + /**
  13 + * Callback when a frame is rendered
  14 + */
  15 + public abstract void onRender();
31 16
32 - /**  
33 - * Called immediately after the world/camera transform is initialised  
34 - */  
35 - public abstract void onSetupCameraTransform(); 17 + /**
  18 + * Called immediately before the current GUI is rendered
  19 + *
  20 + * @param currentScreen Current screen (if any)
  21 + */
  22 + public abstract void onRenderGui(GuiScreen currentScreen);
  23 +
  24 + /**
  25 + * Called when the world is rendered
  26 + *
  27 + * @deprecated Use PreRenderListener::onRenderWorld(F)V instead
  28 + */
  29 + @Deprecated
  30 + public abstract void onRenderWorld();
  31 +
  32 + /**
  33 + * Called immediately after the world/camera transform is initialised
  34 + */
  35 + public abstract void onSetupCameraTransform();
36 } 36 }
src/client/java/com/mumfrey/liteloader/ScreenshotListener.java
@@ -12,16 +12,16 @@ import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue; @@ -12,16 +12,16 @@ import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
12 */ 12 */
13 public interface ScreenshotListener extends LiteMod 13 public interface ScreenshotListener extends LiteMod
14 { 14 {
15 - /**  
16 - * Called when a screenshot is taken, mods should return FALSE to suspend further processing, or TRUE to allow  
17 - * processing to continue normally  
18 - *  
19 - * @param screenshotName  
20 - * @param width  
21 - * @param height  
22 - * @param fbo  
23 - * @param message Message to return if the event is cancelled  
24 - * @return FALSE to suspend further processing, or TRUE to allow processing to continue normally  
25 - */  
26 - public boolean onSaveScreenshot(String screenshotName, int width, int height, Framebuffer fbo, ReturnValue<IChatComponent> message); 15 + /**
  16 + * Called when a screenshot is taken, mods should return FALSE to suspend further processing, or TRUE to allow
  17 + * processing to continue normally
  18 + *
  19 + * @param screenshotName
  20 + * @param width
  21 + * @param height
  22 + * @param fbo
  23 + * @param message Message to return if the event is cancelled
  24 + * @return FALSE to suspend further processing, or TRUE to allow processing to continue normally
  25 + */
  26 + public boolean onSaveScreenshot(String screenshotName, int width, int height, Framebuffer fbo, ReturnValue<IChatComponent> message);
27 } 27 }
src/client/java/com/mumfrey/liteloader/Tickable.java
@@ -9,13 +9,13 @@ import net.minecraft.client.Minecraft; @@ -9,13 +9,13 @@ import net.minecraft.client.Minecraft;
9 */ 9 */
10 public interface Tickable extends LiteMod 10 public interface Tickable extends LiteMod
11 { 11 {
12 - /**  
13 - * Called every frame  
14 - *  
15 - * @param minecraft Minecraft instance  
16 - * @param partialTicks Partial tick value  
17 - * @param inGame True if in-game, false if in the menu  
18 - * @param clock True if this is a new tick, otherwise false if it's a regular frame  
19 - */  
20 - public abstract void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock); 12 + /**
  13 + * Called every frame
  14 + *
  15 + * @param minecraft Minecraft instance
  16 + * @param partialTicks Partial tick value
  17 + * @param inGame True if in-game, false if in the menu
  18 + * @param clock True if this is a new tick, otherwise false if it's a regular frame
  19 + */
  20 + public abstract void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock);
21 } 21 }
src/client/java/com/mumfrey/liteloader/ViewportListener.java
@@ -4,7 +4,7 @@ import net.minecraft.client.gui.ScaledResolution; @@ -4,7 +4,7 @@ import net.minecraft.client.gui.ScaledResolution;
4 4
5 public interface ViewportListener extends LiteMod 5 public interface ViewportListener extends LiteMod
6 { 6 {
7 - public abstract void onViewportResized(ScaledResolution resolution, int displayWidth, int displayHeight);  
8 -  
9 - public abstract void onFullScreenToggled(boolean fullScreen); 7 + public abstract void onViewportResized(ScaledResolution resolution, int displayWidth, int displayHeight);
  8 +
  9 + public abstract void onFullScreenToggled(boolean fullScreen);
10 } 10 }
src/client/java/com/mumfrey/liteloader/client/CallbackProxyClient.java
@@ -34,180 +34,180 @@ import com.mumfrey.liteloader.transformers.event.ReturnEventInfo; @@ -34,180 +34,180 @@ import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
34 */ 34 */
35 public abstract class CallbackProxyClient extends CallbackProxyCommon 35 public abstract class CallbackProxyClient extends CallbackProxyCommon
36 { 36 {
37 - private static LiteLoaderEventBrokerClient clientEventBroker;  
38 -  
39 - private static boolean fboEnabled;  
40 -  
41 - private static boolean renderingFBO;  
42 -  
43 - private CallbackProxyClient() {}  
44 -  
45 - public static void onStartupComplete(EventInfo<Minecraft> e)  
46 - {  
47 - CallbackProxyCommon.onStartupComplete();  
48 -  
49 - CallbackProxyClient.clientEventBroker = LiteLoaderEventBrokerClient.getInstance();  
50 -  
51 - if (CallbackProxyClient.clientEventBroker == null)  
52 - {  
53 - throw new RuntimeException("LiteLoader failed to start up properly. The game is in an unstable state and must shut down now. Check the developer log for startup errors");  
54 - }  
55 -  
56 - CallbackProxyClient.clientEventBroker.onStartupComplete();  
57 - }  
58 -  
59 - public static void onTimerUpdate(EventInfo<Minecraft> e)  
60 - {  
61 - CallbackProxyClient.clientEventBroker.onTimerUpdate();  
62 - }  
63 -  
64 - public static void newTick(EventInfo<Minecraft> e)  
65 - {  
66 - }  
67 -  
68 - public static void onTick(EventInfo<Minecraft> e)  
69 - {  
70 - CallbackProxyClient.clientEventBroker.onTick();  
71 - }  
72 -  
73 - public static void onRender(EventInfo<Minecraft> e)  
74 - {  
75 - CallbackProxyClient.clientEventBroker.onRender();  
76 - }  
77 -  
78 - public static void preRenderGUI(EventInfo<EntityRenderer> e, float partialTicks)  
79 - {  
80 - CallbackProxyClient.clientEventBroker.preRenderGUI(partialTicks);  
81 - }  
82 -  
83 - public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)  
84 - {  
85 - CallbackProxyClient.clientEventBroker.onSetupCameraTransform(pass, partialTicks, timeSlice);  
86 - }  
87 -  
88 - public static void postRenderEntities(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)  
89 - {  
90 - CallbackProxyClient.clientEventBroker.postRenderEntities(partialTicks, timeSlice);  
91 - }  
92 -  
93 - public static void postRender(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)  
94 - {  
95 - CallbackProxyClient.clientEventBroker.postRender(partialTicks, timeSlice);  
96 - }  
97 -  
98 - public static void onRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)  
99 - {  
100 - CallbackProxyClient.clientEventBroker.onRenderHUD(partialTicks);  
101 - }  
102 -  
103 - public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks)  
104 - {  
105 - CallbackProxyClient.clientEventBroker.onRenderChat(e.getSource().getChatGUI(), partialTicks);  
106 - }  
107 -  
108 - public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks)  
109 - {  
110 - CallbackProxyClient.clientEventBroker.postRenderChat(e.getSource().getChatGUI(), partialTicks);  
111 - }  
112 -  
113 - public static void postRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)  
114 - {  
115 - CallbackProxyClient.clientEventBroker.postRenderHUD(partialTicks);  
116 - }  
117 -  
118 - public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName, WorldSettings worldSettings)  
119 - {  
120 - CallbackProxyClient.clientEventBroker.onStartServer(e.getSource(), folderName, worldName, worldSettings);  
121 - }  
122 -  
123 - public static void onOutboundChat(EventInfo<EntityPlayerSP> e, String message)  
124 - {  
125 - CallbackProxyClient.clientEventBroker.onSendChatMessage(e, message);  
126 - }  
127 -  
128 - public static void onResize(EventInfo<Minecraft> e)  
129 - {  
130 - if (CallbackProxyClient.clientEventBroker == null) return;  
131 - CallbackProxyClient.clientEventBroker.onResize(e.getSource());  
132 - }  
133 -  
134 - public static void preRenderFBO(EventInfo<Minecraft> e)  
135 - {  
136 - if (CallbackProxyClient.clientEventBroker == null) return;  
137 - CallbackProxyClient.fboEnabled = OpenGlHelper.isFramebufferEnabled();  
138 -  
139 - if (CallbackProxyClient.fboEnabled)  
140 - {  
141 - CallbackProxyClient.renderingFBO = true;  
142 - CallbackProxyClient.clientEventBroker.preRenderFBO(e.getSource().getFramebuffer());  
143 - }  
144 - }  
145 -  
146 - public static void postRenderFBO(EventInfo<Minecraft> e)  
147 - {  
148 - if (CallbackProxyClient.clientEventBroker == null) return;  
149 - CallbackProxyClient.renderingFBO = false;  
150 -  
151 - if (CallbackProxyClient.fboEnabled)  
152 - {  
153 - CallbackProxyClient.clientEventBroker.postRenderFBO(e.getSource().getFramebuffer());  
154 - }  
155 - }  
156 -  
157 - public static void renderFBO(EventInfo<Framebuffer> e, int width, int height, boolean flag)  
158 - {  
159 - if (CallbackProxyClient.clientEventBroker == null) return;  
160 - if (CallbackProxyClient.renderingFBO)  
161 - {  
162 - CallbackProxyClient.clientEventBroker.onRenderFBO(e.getSource(), width, height);  
163 - }  
164 -  
165 - CallbackProxyClient.renderingFBO = false;  
166 - }  
167 -  
168 - public static void onRenderWorld(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)  
169 - {  
170 - CallbackProxyClient.clientEventBroker.onRenderWorld(partialTicks, timeSlice);  
171 - }  
172 -  
173 - public static void onRenderSky(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)  
174 - {  
175 - CallbackProxyClient.clientEventBroker.onRenderSky(partialTicks, pass, timeSlice);  
176 - }  
177 -  
178 - public static void onRenderClouds(EventInfo<EntityRenderer> e, RenderGlobal renderGlobalIn, float partialTicks, int pass)  
179 - {  
180 - CallbackProxyClient.clientEventBroker.onRenderClouds(partialTicks, pass, renderGlobalIn);  
181 - }  
182 -  
183 - public static void onRenderTerrain(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)  
184 - {  
185 - CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice);  
186 - }  
187 -  
188 - public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height, Framebuffer fbo)  
189 - {  
190 - CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo);  
191 - }  
192 -  
193 - public static void onRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render)  
194 - {  
195 - CallbackProxyClient.clientEventBroker.onRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);  
196 - }  
197 -  
198 - public static void onPostRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render)  
199 - {  
200 - CallbackProxyClient.clientEventBroker.onPostRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);  
201 - }  
202 -  
203 - /**  
204 - * Compatiblbe behaviour with FML, this method is called to generate a consistent offline UUID between client and server  
205 - * for a given username.  
206 - */  
207 - public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e)  
208 - {  
209 - Session session = e.getSource();  
210 - UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, session.getUsername()));  
211 - e.setReturnValue(new GameProfile(uuid, session.getUsername()));  
212 - } 37 + private static LiteLoaderEventBrokerClient clientEventBroker;
  38 +
  39 + private static boolean fboEnabled;
  40 +
  41 + private static boolean renderingFBO;
  42 +
  43 + private CallbackProxyClient() {}
  44 +
  45 + public static void onStartupComplete(EventInfo<Minecraft> e)
  46 + {
  47 + CallbackProxyCommon.onStartupComplete();
  48 +
  49 + CallbackProxyClient.clientEventBroker = LiteLoaderEventBrokerClient.getInstance();
  50 +
  51 + if (CallbackProxyClient.clientEventBroker == null)
  52 + {
  53 + throw new RuntimeException("LiteLoader failed to start up properly. The game is in an unstable state and must shut down now. Check the developer log for startup errors");
  54 + }
  55 +
  56 + CallbackProxyClient.clientEventBroker.onStartupComplete();
  57 + }
  58 +
  59 + public static void onTimerUpdate(EventInfo<Minecraft> e)
  60 + {
  61 + CallbackProxyClient.clientEventBroker.onTimerUpdate();
  62 + }
  63 +
  64 + public static void newTick(EventInfo<Minecraft> e)
  65 + {
  66 + }
  67 +
  68 + public static void onTick(EventInfo<Minecraft> e)
  69 + {
  70 + CallbackProxyClient.clientEventBroker.onTick();
  71 + }
  72 +
  73 + public static void onRender(EventInfo<Minecraft> e)
  74 + {
  75 + CallbackProxyClient.clientEventBroker.onRender();
  76 + }
  77 +
  78 + public static void preRenderGUI(EventInfo<EntityRenderer> e, float partialTicks)
  79 + {
  80 + CallbackProxyClient.clientEventBroker.preRenderGUI(partialTicks);
  81 + }
  82 +
  83 + public static void onSetupCameraTransform(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
  84 + {
  85 + CallbackProxyClient.clientEventBroker.onSetupCameraTransform(pass, partialTicks, timeSlice);
  86 + }
  87 +
  88 + public static void postRenderEntities(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
  89 + {
  90 + CallbackProxyClient.clientEventBroker.postRenderEntities(partialTicks, timeSlice);
  91 + }
  92 +
  93 + public static void postRender(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
  94 + {
  95 + CallbackProxyClient.clientEventBroker.postRender(partialTicks, timeSlice);
  96 + }
  97 +
  98 + public static void onRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
  99 + {
  100 + CallbackProxyClient.clientEventBroker.onRenderHUD(partialTicks);
  101 + }
  102 +
  103 + public static void onRenderChat(EventInfo<GuiIngame> e, float partialTicks)
  104 + {
  105 + CallbackProxyClient.clientEventBroker.onRenderChat(e.getSource().getChatGUI(), partialTicks);
  106 + }
  107 +
  108 + public static void postRenderChat(EventInfo<GuiIngame> e, float partialTicks)
  109 + {
  110 + CallbackProxyClient.clientEventBroker.postRenderChat(e.getSource().getChatGUI(), partialTicks);
  111 + }
  112 +
  113 + public static void postRenderHUD(EventInfo<EntityRenderer> e, float partialTicks)
  114 + {
  115 + CallbackProxyClient.clientEventBroker.postRenderHUD(partialTicks);
  116 + }
  117 +
  118 + public static void IntegratedServerCtor(EventInfo<IntegratedServer> e, Minecraft minecraft, String folderName, String worldName, WorldSettings worldSettings)
  119 + {
  120 + CallbackProxyClient.clientEventBroker.onStartServer(e.getSource(), folderName, worldName, worldSettings);
  121 + }
  122 +
  123 + public static void onOutboundChat(EventInfo<EntityPlayerSP> e, String message)
  124 + {
  125 + CallbackProxyClient.clientEventBroker.onSendChatMessage(e, message);
  126 + }
  127 +
  128 + public static void onResize(EventInfo<Minecraft> e)
  129 + {
  130 + if (CallbackProxyClient.clientEventBroker == null) return;
  131 + CallbackProxyClient.clientEventBroker.onResize(e.getSource());
  132 + }
  133 +
  134 + public static void preRenderFBO(EventInfo<Minecraft> e)
  135 + {
  136 + if (CallbackProxyClient.clientEventBroker == null) return;
  137 + CallbackProxyClient.fboEnabled = OpenGlHelper.isFramebufferEnabled();
  138 +
  139 + if (CallbackProxyClient.fboEnabled)
  140 + {
  141 + CallbackProxyClient.renderingFBO = true;
  142 + CallbackProxyClient.clientEventBroker.preRenderFBO(e.getSource().getFramebuffer());
  143 + }
  144 + }
  145 +
  146 + public static void postRenderFBO(EventInfo<Minecraft> e)
  147 + {
  148 + if (CallbackProxyClient.clientEventBroker == null) return;
  149 + CallbackProxyClient.renderingFBO = false;
  150 +
  151 + if (CallbackProxyClient.fboEnabled)
  152 + {
  153 + CallbackProxyClient.clientEventBroker.postRenderFBO(e.getSource().getFramebuffer());
  154 + }
  155 + }
  156 +
  157 + public static void renderFBO(EventInfo<Framebuffer> e, int width, int height, boolean flag)
  158 + {
  159 + if (CallbackProxyClient.clientEventBroker == null) return;
  160 + if (CallbackProxyClient.renderingFBO)
  161 + {
  162 + CallbackProxyClient.clientEventBroker.onRenderFBO(e.getSource(), width, height);
  163 + }
  164 +
  165 + CallbackProxyClient.renderingFBO = false;
  166 + }
  167 +
  168 + public static void onRenderWorld(EventInfo<EntityRenderer> e, float partialTicks, long timeSlice)
  169 + {
  170 + CallbackProxyClient.clientEventBroker.onRenderWorld(partialTicks, timeSlice);
  171 + }
  172 +
  173 + public static void onRenderSky(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
  174 + {
  175 + CallbackProxyClient.clientEventBroker.onRenderSky(partialTicks, pass, timeSlice);
  176 + }
  177 +
  178 + public static void onRenderClouds(EventInfo<EntityRenderer> e, RenderGlobal renderGlobalIn, float partialTicks, int pass)
  179 + {
  180 + CallbackProxyClient.clientEventBroker.onRenderClouds(partialTicks, pass, renderGlobalIn);
  181 + }
  182 +
  183 + public static void onRenderTerrain(EventInfo<EntityRenderer> e, int pass, float partialTicks, long timeSlice)
  184 + {
  185 + CallbackProxyClient.clientEventBroker.onRenderTerrain(partialTicks, pass, timeSlice);
  186 + }
  187 +
  188 + public static void onSaveScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, File gameDir, String name, int width, int height, Framebuffer fbo)
  189 + {
  190 + CallbackProxyClient.clientEventBroker.onScreenshot(e, name, width, height, fbo);
  191 + }
  192 +
  193 + public static void onRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render)
  194 + {
  195 + CallbackProxyClient.clientEventBroker.onRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);
  196 + }
  197 +
  198 + public static void onPostRenderEntity(ReturnEventInfo<RenderManager, Boolean> e, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, boolean hideBoundingBox, Render render)
  199 + {
  200 + CallbackProxyClient.clientEventBroker.onPostRenderEntity(e.getSource(), entity, xPos, yPos, zPos, yaw, partialTicks, render);
  201 + }
  202 +
  203 + /**
  204 + * Compatiblbe behaviour with FML, this method is called to generate a consistent offline UUID between client and server
  205 + * for a given username.
  206 + */
  207 + public static void generateOfflineUUID(ReturnEventInfo<Session, GameProfile> e)
  208 + {
  209 + Session session = e.getSource();
  210 + UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, session.getUsername()));
  211 + e.setReturnValue(new GameProfile(uuid, session.getUsername()));
  212 + }
213 } 213 }
src/client/java/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java
@@ -23,98 +23,98 @@ import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException; @@ -23,98 +23,98 @@ import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;
23 */ 23 */
24 public class ClientPluginChannelsClient extends ClientPluginChannels 24 public class ClientPluginChannelsClient extends ClientPluginChannels
25 { 25 {
26 - /**  
27 - * @param netHandler  
28 - * @param loginPacket  
29 - */  
30 - void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)  
31 - {  
32 - this.clearPluginChannels(netHandler);  
33 - } 26 + /**
  27 + * @param netHandler
  28 + * @param loginPacket
  29 + */
  30 + void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)
  31 + {
  32 + this.clearPluginChannels(netHandler);
  33 + }
34 34
35 - /**  
36 - * @param netHandler  
37 - * @param loginPacket  
38 - */  
39 - void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)  
40 - {  
41 - this.sendRegisteredPluginChannels(netHandler);  
42 - } 35 + /**
  36 + * @param netHandler
  37 + * @param loginPacket
  38 + */
  39 + void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
  40 + {
  41 + this.sendRegisteredPluginChannels(netHandler);
  42 + }
43 43
44 - /**  
45 - * Callback for the plugin channel hook  
46 - *  
47 - * @param customPayload  
48 - */  
49 - @Override  
50 - public void onPluginChannelMessage(S3FPacketCustomPayload customPayload)  
51 - {  
52 - if (customPayload != null && customPayload.getChannelName() != null)  
53 - {  
54 - String channel = customPayload.getChannelName();  
55 - PacketBuffer data = customPayload.getBufferData();  
56 -  
57 - this.onPluginChannelMessage(channel, data);  
58 - }  
59 - } 44 + /**
  45 + * Callback for the plugin channel hook
  46 + *
  47 + * @param customPayload
  48 + */
  49 + @Override
  50 + public void onPluginChannelMessage(S3FPacketCustomPayload customPayload)
  51 + {
  52 + if (customPayload != null && customPayload.getChannelName() != null)
  53 + {
  54 + String channel = customPayload.getChannelName();
  55 + PacketBuffer data = customPayload.getBufferData();
60 56
61 - /**  
62 - * @param netHandler  
63 - * @param registrationData  
64 - */  
65 - @Override  
66 - protected void sendRegistrationData(INetHandler netHandler, PacketBuffer registrationData)  
67 - {  
68 - if (netHandler instanceof INetHandlerLoginClient)  
69 - {  
70 - NetworkManager networkManager = PrivateFieldsClient.netManager.get(((NetHandlerLoginClient)netHandler));  
71 - networkManager.sendPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));  
72 - }  
73 - else if (netHandler instanceof INetHandlerPlayClient)  
74 - {  
75 - ClientPluginChannelsClient.dispatch(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));  
76 - }  
77 - } 57 + this.onPluginChannelMessage(channel, data);
  58 + }
  59 + }
78 60
79 - /**  
80 - * Send a message to the server on a plugin channel  
81 - *  
82 - * @param channel Channel to send, must not be a reserved channel name  
83 - * @param data  
84 - */  
85 - @Override  
86 - protected boolean send(String channel, PacketBuffer data, ChannelPolicy policy)  
87 - {  
88 - if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel))  
89 - throw new RuntimeException("Invalid channel name specified");  
90 -  
91 - if (!policy.allows(this, channel))  
92 - {  
93 - if (policy.isSilent()) return false;  
94 - throw new UnregisteredChannelException(channel);  
95 - }  
96 -  
97 - C17PacketCustomPayload payload = new C17PacketCustomPayload(channel, data);  
98 - return ClientPluginChannelsClient.dispatch(payload);  
99 - } 61 + /**
  62 + * @param netHandler
  63 + * @param registrationData
  64 + */
  65 + @Override
  66 + protected void sendRegistrationData(INetHandler netHandler, PacketBuffer registrationData)
  67 + {
  68 + if (netHandler instanceof INetHandlerLoginClient)
  69 + {
  70 + NetworkManager networkManager = PrivateFieldsClient.netManager.get(((NetHandlerLoginClient)netHandler));
  71 + networkManager.sendPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
  72 + }
  73 + else if (netHandler instanceof INetHandlerPlayClient)
  74 + {
  75 + ClientPluginChannelsClient.dispatch(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
  76 + }
  77 + }
100 78
101 - /**  
102 - * @param payload  
103 - */  
104 - static boolean dispatch(C17PacketCustomPayload payload)  
105 - {  
106 - try  
107 - {  
108 - Minecraft minecraft = Minecraft.getMinecraft();  
109 -  
110 - if (minecraft.thePlayer != null && minecraft.thePlayer.sendQueue != null)  
111 - {  
112 - minecraft.thePlayer.sendQueue.addToSendQueue(payload);  
113 - return true;  
114 - }  
115 - }  
116 - catch (Exception ex) {}  
117 -  
118 - return false;  
119 - } 79 + /**
  80 + * Send a message to the server on a plugin channel
  81 + *
  82 + * @param channel Channel to send, must not be a reserved channel name
  83 + * @param data
  84 + */
  85 + @Override
  86 + protected boolean send(String channel, PacketBuffer data, ChannelPolicy policy)
  87 + {
  88 + if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel))
  89 + throw new RuntimeException("Invalid channel name specified");
  90 +
  91 + if (!policy.allows(this, channel))
  92 + {
  93 + if (policy.isSilent()) return false;
  94 + throw new UnregisteredChannelException(channel);
  95 + }
  96 +
  97 + C17PacketCustomPayload payload = new C17PacketCustomPayload(channel, data);
  98 + return ClientPluginChannelsClient.dispatch(payload);
  99 + }
  100 +
  101 + /**
  102 + * @param payload
  103 + */
  104 + static boolean dispatch(C17PacketCustomPayload payload)
  105 + {
  106 + try
  107 + {
  108 + Minecraft minecraft = Minecraft.getMinecraft();
  109 +
  110 + if (minecraft.thePlayer != null && minecraft.thePlayer.sendQueue != null)
  111 + {
  112 + minecraft.thePlayer.sendQueue.addToSendQueue(payload);
  113 + return true;
  114 + }
  115 + }
  116 + catch (Exception ex) {}
  117 +
  118 + return false;
  119 + }
120 } 120 }
src/client/java/com/mumfrey/liteloader/client/GameEngineClient.java
@@ -24,135 +24,135 @@ import com.mumfrey.liteloader.common.Resources; @@ -24,135 +24,135 @@ import com.mumfrey.liteloader.common.Resources;
24 */ 24 */
25 public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer> 25 public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer>
26 { 26 {
27 - private final Minecraft engine = Minecraft.getMinecraft();  
28 -  
29 - private final Resources<?, ?> resources = new ResourcesClient();  
30 -  
31 - /* (non-Javadoc)  
32 - * @see com.mumfrey.liteloader.common.GameEngine#getProfiler()  
33 - */  
34 - @Override  
35 - public Profiler getProfiler()  
36 - {  
37 - return this.engine.mcProfiler;  
38 - }  
39 -  
40 - /* (non-Javadoc)  
41 - * @see com.mumfrey.liteloader.common.GameEngine#isClient()  
42 - */  
43 - @Override  
44 - public boolean isClient()  
45 - {  
46 - return true;  
47 - }  
48 -  
49 - /* (non-Javadoc)  
50 - * @see com.mumfrey.liteloader.common.GameEngine#isServer()  
51 - */  
52 - @Override  
53 - public boolean isServer()  
54 - {  
55 - return this.isSinglePlayer();  
56 - }  
57 -  
58 - /* (non-Javadoc)  
59 - * @see com.mumfrey.liteloader.common.GameEngine#isInGame()  
60 - */  
61 - @Override  
62 - public boolean isInGame()  
63 - {  
64 - return this.engine.thePlayer != null && this.engine.theWorld != null && this.engine.theWorld.isRemote;  
65 - }  
66 -  
67 - /* (non-Javadoc)  
68 - * @see com.mumfrey.liteloader.common.GameEngine#isRunning()  
69 - */  
70 - @Override  
71 - public boolean isRunning()  
72 - {  
73 - return ((IMinecraft)this.engine).isRunning();  
74 - }  
75 -  
76 - /* (non-Javadoc)  
77 - * @see com.mumfrey.liteloader.common.GameEngine#isSingleplayer()  
78 - */  
79 - @Override  
80 - public boolean isSinglePlayer()  
81 - {  
82 - return this.engine.isSingleplayer();  
83 - }  
84 -  
85 - /* (non-Javadoc)  
86 - * @see com.mumfrey.liteloader.common.GameEngine#getClient()  
87 - */  
88 - @Override  
89 - public Minecraft getClient()  
90 - {  
91 - return this.engine;  
92 - }  
93 -  
94 - /* (non-Javadoc)  
95 - * @see com.mumfrey.liteloader.common.GameEngine#getServer()  
96 - */  
97 - @Override  
98 - public IntegratedServer getServer()  
99 - {  
100 - return this.engine.getIntegratedServer();  
101 - }  
102 -  
103 - @Override  
104 - public Resources<?, ?> getResources()  
105 - {  
106 - return this.resources;  
107 - }  
108 -  
109 - public GameSettings getGameSettings()  
110 - {  
111 - return this.engine.gameSettings;  
112 - }  
113 -  
114 - public ScaledResolution getScaledResolution()  
115 - {  
116 - return new ScaledResolution(this.engine, this.engine.displayWidth, this.engine.displayHeight);  
117 - }  
118 -  
119 - public GuiNewChat getChatGUI()  
120 - {  
121 - return this.engine.ingameGUI.getChatGUI();  
122 - }  
123 -  
124 - public GuiScreen getCurrentScreen()  
125 - {  
126 - return this.engine.currentScreen;  
127 - }  
128 -  
129 - public boolean hideGUI()  
130 - {  
131 - return this.engine.gameSettings.hideGUI;  
132 - }  
133 -  
134 - public SoundHandler getSoundHandler()  
135 - {  
136 - return this.engine.getSoundHandler();  
137 - }  
138 -  
139 - /* (non-Javadoc)  
140 - * @see com.mumfrey.liteloader.common.GameEngine#getKeyBindings()  
141 - */  
142 - @Override  
143 - public List<KeyBinding> getKeyBindings()  
144 - {  
145 - LinkedList<KeyBinding> keyBindings = new LinkedList<KeyBinding>();  
146 - keyBindings.addAll(Arrays.asList(this.engine.gameSettings.keyBindings));  
147 - return keyBindings;  
148 - }  
149 -  
150 - /* (non-Javadoc)  
151 - * @see com.mumfrey.liteloader.common.GameEngine#setKeyBindings(java.util.List)  
152 - */  
153 - @Override  
154 - public void setKeyBindings(List<KeyBinding> keyBindings)  
155 - {  
156 - this.engine.gameSettings.keyBindings = keyBindings.toArray(new KeyBinding[0]);  
157 - } 27 + private final Minecraft engine = Minecraft.getMinecraft();
  28 +
  29 + private final Resources<?, ?> resources = new ResourcesClient();
  30 +
  31 + /* (non-Javadoc)
  32 + * @see com.mumfrey.liteloader.common.GameEngine#getProfiler()
  33 + */
  34 + @Override
  35 + public Profiler getProfiler()
  36 + {
  37 + return this.engine.mcProfiler;
  38 + }
  39 +
  40 + /* (non-Javadoc)
  41 + * @see com.mumfrey.liteloader.common.GameEngine#isClient()
  42 + */
  43 + @Override
  44 + public boolean isClient()
  45 + {
  46 + return true;
  47 + }
  48 +
  49 + /* (non-Javadoc)
  50 + * @see com.mumfrey.liteloader.common.GameEngine#isServer()
  51 + */
  52 + @Override
  53 + public boolean isServer()
  54 + {
  55 + return this.isSinglePlayer();
  56 + }
  57 +
  58 + /* (non-Javadoc)
  59 + * @see com.mumfrey.liteloader.common.GameEngine#isInGame()
  60 + */
  61 + @Override
  62 + public boolean isInGame()
  63 + {
  64 + return this.engine.thePlayer != null && this.engine.theWorld != null && this.engine.theWorld.isRemote;
  65 + }
  66 +
  67 + /* (non-Javadoc)
  68 + * @see com.mumfrey.liteloader.common.GameEngine#isRunning()
  69 + */
  70 + @Override
  71 + public boolean isRunning()
  72 + {
  73 + return ((IMinecraft)this.engine).isRunning();
  74 + }
  75 +
  76 + /* (non-Javadoc)
  77 + * @see com.mumfrey.liteloader.common.GameEngine#isSingleplayer()
  78 + */
  79 + @Override
  80 + public boolean isSinglePlayer()
  81 + {
  82 + return this.engine.isSingleplayer();
  83 + }
  84 +
  85 + /* (non-Javadoc)
  86 + * @see com.mumfrey.liteloader.common.GameEngine#getClient()
  87 + */
  88 + @Override
  89 + public Minecraft getClient()
  90 + {
  91 + return this.engine;
  92 + }
  93 +
  94 + /* (non-Javadoc)
  95 + * @see com.mumfrey.liteloader.common.GameEngine#getServer()
  96 + */
  97 + @Override
  98 + public IntegratedServer getServer()
  99 + {
  100 + return this.engine.getIntegratedServer();
  101 + }
  102 +
  103 + @Override
  104 + public Resources<?, ?> getResources()
  105 + {
  106 + return this.resources;
  107 + }
  108 +
  109 + public GameSettings getGameSettings()
  110 + {
  111 + return this.engine.gameSettings;
  112 + }
  113 +
  114 + public ScaledResolution getScaledResolution()
  115 + {
  116 + return new ScaledResolution(this.engine, this.engine.displayWidth, this.engine.displayHeight);
  117 + }
  118 +
  119 + public GuiNewChat getChatGUI()
  120 + {
  121 + return this.engine.ingameGUI.getChatGUI();
  122 + }
  123 +
  124 + public GuiScreen getCurrentScreen()
  125 + {
  126 + return this.engine.currentScreen;
  127 + }
  128 +
  129 + public boolean hideGUI()
  130 + {
  131 + return this.engine.gameSettings.hideGUI;
  132 + }
  133 +
  134 + public SoundHandler getSoundHandler()
  135 + {
  136 + return this.engine.getSoundHandler();
  137 + }
  138 +
  139 + /* (non-Javadoc)
  140 + * @see com.mumfrey.liteloader.common.GameEngine#getKeyBindings()
  141 + */
  142 + @Override
  143 + public List<KeyBinding> getKeyBindings()
  144 + {
  145 + LinkedList<KeyBinding> keyBindings = new LinkedList<KeyBinding>();
  146 + keyBindings.addAll(Arrays.asList(this.engine.gameSettings.keyBindings));
  147 + return keyBindings;
  148 + }
  149 +
  150 + /* (non-Javadoc)
  151 + * @see com.mumfrey.liteloader.common.GameEngine#setKeyBindings(java.util.List)
  152 + */
  153 + @Override
  154 + public void setKeyBindings(List<KeyBinding> keyBindings)
  155 + {
  156 + this.engine.gameSettings.keyBindings = keyBindings.toArray(new KeyBinding[0]);
  157 + }
158 } 158 }
src/client/java/com/mumfrey/liteloader/client/LiteLoaderCoreProviderClient.java
@@ -22,84 +22,84 @@ import com.mumfrey.liteloader.resources.InternalResourcePack; @@ -22,84 +22,84 @@ import com.mumfrey.liteloader.resources.InternalResourcePack;
22 */ 22 */
23 public class LiteLoaderCoreProviderClient implements CoreProvider 23 public class LiteLoaderCoreProviderClient implements CoreProvider
24 { 24 {
25 - /**  
26 - * Loader Properties adapter  
27 - */  
28 - private final LoaderProperties properties;  
29 -  
30 - /**  
31 - * Read from the properties file, if true we will inhibit the sound manager reload during startup to avoid getting in trouble with OpenAL  
32 - */  
33 - private boolean inhibitSoundManagerReload = true;  
34 -  
35 - /**  
36 - * If inhibit is enabled, this object is used to reflectively inhibit the sound manager's reload process during startup by removing it from the reloadables list  
37 - */  
38 - private SoundHandlerReloadInhibitor soundHandlerReloadInhibitor;  
39 -  
40 - public LiteLoaderCoreProviderClient(LoaderProperties properties)  
41 - {  
42 - this.properties = properties;  
43 - }  
44 -  
45 - @Override  
46 - public void onInit()  
47 - {  
48 - this.inhibitSoundManagerReload = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_SOUND_MANAGER_FIX, true);  
49 - }  
50 -  
51 - @SuppressWarnings("unchecked")  
52 - @Override  
53 - public void onPostInit(GameEngine<?, ?> engine)  
54 - {  
55 - this.soundHandlerReloadInhibitor = new SoundHandlerReloadInhibitor((SimpleReloadableResourceManager)engine.getResources().getResourceManager(), ((GameEngineClient)engine).getSoundHandler());  
56 -  
57 - if (this.inhibitSoundManagerReload)  
58 - {  
59 - this.soundHandlerReloadInhibitor.inhibit();  
60 - }  
61 -  
62 - // Add self as a resource pack for texture/lang resources  
63 - Resources<IResourceManager, IResourcePack> resources = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources();  
64 - resources.registerResourcePack(new InternalResourcePack("LiteLoader", LiteLoader.class, "liteloader"));  
65 - }  
66 -  
67 - @Override  
68 - public void onPostInitComplete(LiteLoaderMods mods)  
69 - {  
70 - }  
71 -  
72 - @Override  
73 - public void onStartupComplete()  
74 - {  
75 - if (this.soundHandlerReloadInhibitor != null && this.soundHandlerReloadInhibitor.isInhibited())  
76 - {  
77 - this.soundHandlerReloadInhibitor.unInhibit(true);  
78 - }  
79 - }  
80 -  
81 - @Override  
82 - public void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)  
83 - {  
84 - }  
85 -  
86 - @Override  
87 - public void onPostRender(int mouseX, int mouseY, float partialTicks)  
88 - {  
89 - }  
90 -  
91 - @Override  
92 - public void onTick(boolean clock, float partialTicks, boolean inGame)  
93 - {  
94 - }  
95 -  
96 - @Override  
97 - public void onWorldChanged(World world)  
98 - {  
99 - }  
100 -  
101 - @Override  
102 - public void onShutDown()  
103 - {  
104 - } 25 + /**
  26 + * Loader Properties adapter
  27 + */
  28 + private final LoaderProperties properties;
  29 +
  30 + /**
  31 + * Read from the properties file, if true we will inhibit the sound manager reload during startup to avoid getting in trouble with OpenAL
  32 + */
  33 + private boolean inhibitSoundManagerReload = true;
  34 +
  35 + /**
  36 + * If inhibit is enabled, this object is used to reflectively inhibit the sound manager's reload process during startup by removing it from the reloadables list
  37 + */
  38 + private SoundHandlerReloadInhibitor soundHandlerReloadInhibitor;
  39 +
  40 + public LiteLoaderCoreProviderClient(LoaderProperties properties)
  41 + {
  42 + this.properties = properties;
  43 + }
  44 +
  45 + @Override
  46 + public void onInit()
  47 + {
  48 + this.inhibitSoundManagerReload = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_SOUND_MANAGER_FIX, true);
  49 + }
  50 +
  51 + @SuppressWarnings("unchecked")
  52 + @Override
  53 + public void onPostInit(GameEngine<?, ?> engine)
  54 + {
  55 + this.soundHandlerReloadInhibitor = new SoundHandlerReloadInhibitor((SimpleReloadableResourceManager)engine.getResources().getResourceManager(), ((GameEngineClient)engine).getSoundHandler());
  56 +
  57 + if (this.inhibitSoundManagerReload)
  58 + {
  59 + this.soundHandlerReloadInhibitor.inhibit();
  60 + }
  61 +
  62 + // Add self as a resource pack for texture/lang resources
  63 + Resources<IResourceManager, IResourcePack> resources = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources();
  64 + resources.registerResourcePack(new InternalResourcePack("LiteLoader", LiteLoader.class, "liteloader"));
  65 + }
  66 +
  67 + @Override
  68 + public void onPostInitComplete(LiteLoaderMods mods)
  69 + {
  70 + }
  71 +
  72 + @Override
  73 + public void onStartupComplete()
  74 + {
  75 + if (this.soundHandlerReloadInhibitor != null && this.soundHandlerReloadInhibitor.isInhibited())
  76 + {
  77 + this.soundHandlerReloadInhibitor.unInhibit(true);
  78 + }
  79 + }
  80 +
  81 + @Override
  82 + public void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
  83 + {
  84 + }
  85 +
  86 + @Override
  87 + public void onPostRender(int mouseX, int mouseY, float partialTicks)
  88 + {
  89 + }
  90 +
  91 + @Override
  92 + public void onTick(boolean clock, float partialTicks, boolean inGame)
  93 + {
  94 + }
  95 +
  96 + @Override
  97 + public void onWorldChanged(World world)
  98 + {
  99 + }
  100 +
  101 + @Override
  102 + public void onShutDown()
  103 + {
  104 + }
105 } 105 }
src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
@@ -37,526 +37,526 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -37,526 +37,526 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
37 37
38 public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener 38 public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener
39 { 39 {
40 - private static LiteLoaderEventBrokerClient instance;  
41 -  
42 - /**  
43 - * Reference to the game  
44 - */  
45 - protected final GameEngineClient engineClient;  
46 -  
47 - /**  
48 - * Current screen width  
49 - */  
50 - private int screenWidth = 854;  
51 -  
52 - /**  
53 - * Current screen height  
54 - */  
55 - private int screenHeight = 480;  
56 -  
57 - /**  
58 - *  
59 - */  
60 - private boolean wasFullScreen = false;  
61 -  
62 - /**  
63 - * Hash code of the current world. We don't store the world reference here because we don't want  
64 - * to mess with world GC by mistake  
65 - */  
66 - private int worldHashCode = 0;  
67 -  
68 - private FastIterableDeque<Tickable> tickListeners;  
69 - private FastIterableDeque<GameLoopListener> loopListeners = new HandlerList<GameLoopListener>(GameLoopListener.class);  
70 - private FastIterableDeque<RenderListener> renderListeners = new HandlerList<RenderListener>(RenderListener.class);  
71 - private FastIterableDeque<PreRenderListener> preRenderListeners = new HandlerList<PreRenderListener>(PreRenderListener.class);  
72 - private FastIterableDeque<PostRenderListener> postRenderListeners = new HandlerList<PostRenderListener>(PostRenderListener.class);  
73 - private FastIterableDeque<HUDRenderListener> hudRenderListeners = new HandlerList<HUDRenderListener>(HUDRenderListener.class);  
74 - private FastIterableDeque<ChatRenderListener> chatRenderListeners = new HandlerList<ChatRenderListener>(ChatRenderListener.class);  
75 - private FastIterableDeque<OutboundChatListener> outboundChatListeners = new HandlerList<OutboundChatListener>(OutboundChatListener.class);  
76 - private FastIterableDeque<ViewportListener> viewportListeners = new HandlerList<ViewportListener>(ViewportListener.class);  
77 - private FastIterableDeque<FrameBufferListener> frameBufferListeners = new HandlerList<FrameBufferListener>(FrameBufferListener.class);  
78 - private FastIterableDeque<InitCompleteListener> initListeners = new HandlerList<InitCompleteListener>(InitCompleteListener.class);  
79 - private FastIterableDeque<OutboundChatFilter> outboundChatFilters = new HandlerList<OutboundChatFilter>(OutboundChatFilter.class, ReturnLogicOp.AND);  
80 - private FastIterableDeque<ScreenshotListener> screenshotListeners = new HandlerList<ScreenshotListener>(ScreenshotListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE);  
81 - private FastIterableDeque<EntityRenderListener> entityRenderListeners = new HandlerList<EntityRenderListener>(EntityRenderListener.class);  
82 -  
83 - @SuppressWarnings("cast")  
84 - public LiteLoaderEventBrokerClient(LiteLoader loader, GameEngineClient engine, LoaderProperties properties)  
85 - {  
86 - super(loader, engine, properties);  
87 -  
88 - LiteLoaderEventBrokerClient.instance = this;  
89 -  
90 - this.engineClient = (GameEngineClient)engine;  
91 - this.tickListeners = new ProfilingHandlerList<Tickable>(Tickable.class, this.engineClient.getProfiler());  
92 - }  
93 -  
94 - static LiteLoaderEventBrokerClient getInstance()  
95 - {  
96 - return LiteLoaderEventBrokerClient.instance;  
97 - }  
98 -  
99 - @Override  
100 - public void onResourceManagerReload(IResourceManager resourceManager)  
101 - {  
102 - LoadingProgress.setMessage("Reloading Resources...");  
103 - }  
104 -  
105 - /* (non-Javadoc)  
106 - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate)  
107 - */  
108 - @Override  
109 - public void registerInterfaces(InterfaceRegistrationDelegate delegate)  
110 - {  
111 - super.registerInterfaces(delegate);  
112 -  
113 - delegate.registerInterface(Tickable.class);  
114 - delegate.registerInterface(GameLoopListener.class);  
115 - delegate.registerInterface(RenderListener.class);  
116 - delegate.registerInterface(PreRenderListener.class);  
117 - delegate.registerInterface(PostRenderListener.class);  
118 - delegate.registerInterface(HUDRenderListener.class);  
119 - delegate.registerInterface(ChatRenderListener.class);  
120 - delegate.registerInterface(OutboundChatListener.class);  
121 - delegate.registerInterface(ViewportListener.class);  
122 - delegate.registerInterface(FrameBufferListener.class);  
123 - delegate.registerInterface(InitCompleteListener.class);  
124 - delegate.registerInterface(OutboundChatFilter.class);  
125 - delegate.registerInterface(ScreenshotListener.class);  
126 - delegate.registerInterface(EntityRenderListener.class);  
127 - }  
128 -  
129 - /* (non-Javadoc)  
130 - * @see com.mumfrey.liteloader.api.InterfaceProvider#initProvider()  
131 - */  
132 - @Override  
133 - public void initProvider()  
134 - {  
135 - }  
136 -  
137 - /**  
138 - * @param tickable  
139 - */  
140 - public void addTickListener(Tickable tickable)  
141 - {  
142 - this.tickListeners.add(tickable);  
143 - }  
144 -  
145 - /**  
146 - * @param loopListener  
147 - */  
148 - public void addLoopListener(GameLoopListener loopListener)  
149 - {  
150 - this.loopListeners.add(loopListener);  
151 - }  
152 -  
153 - /**  
154 - * @param initCompleteListener  
155 - */  
156 - public void addInitListener(InitCompleteListener initCompleteListener)  
157 - {  
158 - this.initListeners.add(initCompleteListener);  
159 - }  
160 -  
161 - /**  
162 - * @param renderListener  
163 - */  
164 - public void addRenderListener(RenderListener renderListener)  
165 - {  
166 - this.renderListeners.add(renderListener);  
167 - }  
168 -  
169 - /**  
170 - * @param preRenderListener  
171 - */  
172 - public void addPreRenderListener(PreRenderListener preRenderListener)  
173 - {  
174 - this.preRenderListeners.add(preRenderListener);  
175 - }  
176 -  
177 - /**  
178 - * @param postRenderListener  
179 - */  
180 - public void addPostRenderListener(PostRenderListener postRenderListener)  
181 - {  
182 - this.postRenderListeners.add(postRenderListener);  
183 - }  
184 -  
185 - /**  
186 - * @param chatRenderListener  
187 - */  
188 - public void addChatRenderListener(ChatRenderListener chatRenderListener)  
189 - {  
190 - this.chatRenderListeners.add(chatRenderListener);  
191 - }  
192 -  
193 - /**  
194 - * @param hudRenderListener  
195 - */  
196 - public void addHUDRenderListener(HUDRenderListener hudRenderListener)  
197 - {  
198 - this.hudRenderListeners.add(hudRenderListener);  
199 - }  
200 -  
201 - /**  
202 - * @param outboundChatListener  
203 - */  
204 - public void addOutboundChatListener(OutboundChatListener outboundChatListener)  
205 - {  
206 - this.outboundChatListeners.add(outboundChatListener);  
207 - }  
208 -  
209 - /**  
210 - * @param outboundChatFilter  
211 - */  
212 - public void addOutboundChatFiler(OutboundChatFilter outboundChatFilter)  
213 - {  
214 - this.outboundChatFilters.add(outboundChatFilter);  
215 - }  
216 -  
217 - /**  
218 - * @param viewportListener  
219 - */  
220 - public void addViewportListener(ViewportListener viewportListener)  
221 - {  
222 - this.viewportListeners.add(viewportListener);  
223 - }  
224 -  
225 - /**  
226 - * @param frameBufferListener  
227 - */  
228 - public void addFrameBufferListener(FrameBufferListener frameBufferListener)  
229 - {  
230 - this.frameBufferListeners.add(frameBufferListener);  
231 - }  
232 -  
233 - /**  
234 - * @param screenshotListener  
235 - */  
236 - public void addScreenshotListener(ScreenshotListener screenshotListener)  
237 - {  
238 - this.screenshotListeners.add(screenshotListener);  
239 - }  
240 -  
241 - /**  
242 - * @param entityRenderListener  
243 - */  
244 - public void addEntityRenderListener(EntityRenderListener entityRenderListener)  
245 - {  
246 - this.entityRenderListeners.add(entityRenderListener);  
247 - }  
248 -  
249 - /**  
250 - * Late initialisation callback  
251 - */  
252 - @Override  
253 - protected void onStartupComplete()  
254 - {  
255 - this.engine.getResources().refreshResources(false);  
256 -  
257 - for (InitCompleteListener initMod : this.initListeners)  
258 - {  
259 - try  
260 - {  
261 - LoadingProgress.setMessage("Calling late init for mod %s...", initMod.getName());  
262 - LiteLoaderLogger.info("Calling late init for mod %s", initMod.getName());  
263 - initMod.onInitCompleted(this.engine.getClient(), this.loader);  
264 - }  
265 - catch (Throwable th)  
266 - {  
267 - this.mods.onLateInitFailed(initMod, th);  
268 - LiteLoaderLogger.warning(th, "Error calling late init for mod %s", initMod.getName());  
269 - }  
270 - }  
271 -  
272 - this.onResize(this.engineClient.getClient());  
273 -  
274 - super.onStartupComplete();  
275 - }  
276 -  
277 - public void onResize(Minecraft minecraft)  
278 - {  
279 - ScaledResolution currentResolution = this.engineClient.getScaledResolution();  
280 - this.screenWidth = currentResolution.getScaledWidth();  
281 - this.screenHeight = currentResolution.getScaledHeight();  
282 -  
283 - if (this.wasFullScreen != minecraft.isFullScreen())  
284 - {  
285 - this.viewportListeners.all().onFullScreenToggled(minecraft.isFullScreen());  
286 - }  
287 -  
288 - this.wasFullScreen = minecraft.isFullScreen();  
289 - this.viewportListeners.all().onViewportResized(currentResolution, minecraft.displayWidth, minecraft.displayHeight);  
290 - }  
291 -  
292 - /**  
293 - * Callback from the tick hook, pre render  
294 - */  
295 - void onRender()  
296 - {  
297 - this.renderListeners.all().onRender();  
298 - }  
299 -  
300 - /**  
301 - * Callback from the tick hook, post render entities  
302 - *  
303 - * @param partialTicks  
304 - * @param timeSlice  
305 - */  
306 - void postRenderEntities(float partialTicks, long timeSlice)  
307 - {  
308 - this.postRenderListeners.all().onPostRenderEntities(partialTicks);  
309 - }  
310 -  
311 - /**  
312 - * Callback from the tick hook, post render  
313 - *  
314 - * @param partialTicks  
315 - * @param timeSlice  
316 - */  
317 - void postRender(float partialTicks, long timeSlice)  
318 - {  
319 - ((IEntityRenderer)this.engineClient.getClient().entityRenderer).setupCamera(partialTicks, 0);  
320 - this.postRenderListeners.all().onPostRender(partialTicks);  
321 - }  
322 -  
323 - /**  
324 - * Called immediately before the current GUI is rendered  
325 - */  
326 - void preRenderGUI(float partialTicks)  
327 - {  
328 - this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen());  
329 - }  
330 -  
331 - /**  
332 - * Called immediately after the world/camera transform is initialised  
333 - *  
334 - * @param pass  
335 - * @param timeSlice  
336 - * @param partialTicks  
337 - */  
338 - void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)  
339 - {  
340 - this.renderListeners.all().onSetupCameraTransform();  
341 - this.preRenderListeners.all().onSetupCameraTransform(partialTicks, pass, timeSlice);  
342 - }  
343 -  
344 - /**  
345 - * Called immediately before the chat log is rendered  
346 - *  
347 - * @param chatGui  
348 - * @param partialTicks  
349 - */  
350 - void onRenderChat(GuiNewChat chatGui, float partialTicks)  
351 - {  
352 - this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui);  
353 - }  
354 -  
355 - /**  
356 - * Called immediately after the chat log is rendered  
357 - *  
358 - * @param chatGui  
359 - * @param partialTicks  
360 - */  
361 - void postRenderChat(GuiNewChat chatGui, float partialTicks)  
362 - {  
363 - GuiNewChat chat = this.engineClient.getChatGUI();  
364 - this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat);  
365 - }  
366 -  
367 - /**  
368 - * Callback when about to render the HUD  
369 - */  
370 - void onRenderHUD(float partialTicks)  
371 - {  
372 - this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight);  
373 - }  
374 -  
375 - /**  
376 - * Callback when the HUD has just been rendered  
377 - */  
378 - void postRenderHUD(float partialTicks)  
379 - {  
380 - this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight);  
381 - }  
382 -  
383 - /**  
384 - * Callback from the tick hook, called every frame when the timer is updated  
385 - */  
386 - void onTimerUpdate()  
387 - {  
388 - Minecraft minecraft = this.engine.getClient();  
389 - this.loopListeners.all().onRunGameLoop(minecraft);  
390 - }  
391 -  
392 - /**  
393 - * Callback from the tick hook, ticks all tickable mods  
394 - */  
395 - void onTick()  
396 - {  
397 - this.profiler.endStartSection("litemods");  
398 -  
399 - Timer minecraftTimer = ((IMinecraft)this.engine.getClient()).getTimer();  
400 - float partialTicks = minecraftTimer.renderPartialTicks;  
401 - boolean clock = minecraftTimer.elapsedTicks > 0;  
402 -  
403 - Minecraft minecraft = this.engine.getClient();  
404 -  
405 - // Flag indicates whether we are in game at the moment  
406 - Entity renderViewEntity = minecraft.getRenderViewEntity(); // TODO OBF MCPTEST func_175606_aa - getRenderViewEntity  
407 - boolean inGame = renderViewEntity != null && renderViewEntity.worldObj != null;  
408 -  
409 - this.profiler.startSection("loader");  
410 - super.onTick(clock, partialTicks, inGame);  
411 -  
412 - int mouseX = Mouse.getX() * this.screenWidth / minecraft.displayWidth;  
413 - int mouseY = this.screenHeight - Mouse.getY() * this.screenHeight / minecraft.displayHeight - 1;  
414 - this.profiler.endStartSection("postrender");  
415 - super.onPostRender(mouseX, mouseY, partialTicks);  
416 - this.profiler.endSection();  
417 -  
418 - // Iterate tickable mods  
419 - this.tickListeners.all().onTick(minecraft, partialTicks, inGame, clock);  
420 -  
421 - // Detected world change  
422 - int worldHashCode = (minecraft.theWorld != null) ? minecraft.theWorld.hashCode() : 0;  
423 - if (worldHashCode != this.worldHashCode)  
424 - {  
425 - this.worldHashCode = worldHashCode;  
426 - super.onWorldChanged(minecraft.theWorld);  
427 - }  
428 - }  
429 -  
430 - /**  
431 - * @param packet  
432 - * @param message  
433 - */  
434 - void onSendChatMessage(C01PacketChatMessage packet, String message)  
435 - {  
436 - this.outboundChatListeners.all().onSendChatMessage(packet, message);  
437 - }  
438 -  
439 - /**  
440 - * @param message  
441 - */  
442 - void onSendChatMessage(EventInfo<EntityPlayerSP> e, String message)  
443 - {  
444 - if (!this.outboundChatFilters.all().onSendChatMessage(message))  
445 - {  
446 - e.cancel();  
447 - }  
448 - }  
449 -  
450 - /**  
451 - * @param framebuffer  
452 - */  
453 - void preRenderFBO(Framebuffer framebuffer)  
454 - {  
455 - this.frameBufferListeners.all().preRenderFBO(framebuffer);  
456 - }  
457 -  
458 - /**  
459 - * @param framebuffer  
460 - * @param width  
461 - * @param height  
462 - */  
463 - void onRenderFBO(Framebuffer framebuffer, int width, int height)  
464 - {  
465 - this.frameBufferListeners.all().onRenderFBO(framebuffer, width, height);  
466 - }  
467 -  
468 - /**  
469 - * @param framebuffer  
470 - */  
471 - void postRenderFBO(Framebuffer framebuffer)  
472 - {  
473 - this.frameBufferListeners.all().postRenderFBO(framebuffer);  
474 - }  
475 -  
476 - /**  
477 - * @param partialTicks  
478 - * @param timeSlice  
479 - */  
480 - void onRenderWorld(float partialTicks, long timeSlice)  
481 - {  
482 - this.preRenderListeners.all().onRenderWorld(partialTicks);  
483 - this.renderListeners.all().onRenderWorld();  
484 - }  
485 -  
486 - /**  
487 - * @param partialTicks  
488 - * @param pass  
489 - * @param timeSlice  
490 - */  
491 - void onRenderSky(float partialTicks, int pass, long timeSlice)  
492 - {  
493 - this.preRenderListeners.all().onRenderSky(partialTicks, pass);  
494 - }  
495 -  
496 - /**  
497 - * @param partialTicks  
498 - * @param pass  
499 - * @param renderGlobal  
500 - */  
501 - void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal)  
502 - {  
503 - this.preRenderListeners.all().onRenderClouds(partialTicks, pass, renderGlobal);  
504 - }  
505 -  
506 - /**  
507 - * @param partialTicks  
508 - * @param pass  
509 - * @param timeSlice  
510 - */  
511 - void onRenderTerrain(float partialTicks, int pass, long timeSlice)  
512 - {  
513 - this.preRenderListeners.all().onRenderTerrain(partialTicks, pass);  
514 - }  
515 -  
516 - /**  
517 - * @param e  
518 - * @param name  
519 - * @param width  
520 - * @param height  
521 - * @param fbo  
522 - */  
523 - void onScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, String name, int width, int height, Framebuffer fbo)  
524 - {  
525 - ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>(e.getReturnValue());  
526 -  
527 - if (!this.screenshotListeners.all().onSaveScreenshot(name, width, height, fbo, ret))  
528 - {  
529 - e.setReturnValue(ret.get());  
530 - }  
531 - }  
532 -  
533 - /**  
534 - * @param source  
535 - * @param entity  
536 - * @param xPos  
537 - * @param yPos  
538 - * @param zPos  
539 - * @param yaw  
540 - * @param partialTicks  
541 - * @param render  
542 - */  
543 - public void onRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render)  
544 - {  
545 - this.entityRenderListeners.all().onRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks);  
546 - }  
547 -  
548 - /**  
549 - * @param source  
550 - * @param entity  
551 - * @param xPos  
552 - * @param yPos  
553 - * @param zPos  
554 - * @param yaw  
555 - * @param partialTicks  
556 - * @param render  
557 - */  
558 - public void onPostRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render)  
559 - {  
560 - this.entityRenderListeners.all().onPostRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks);  
561 - } 40 + private static LiteLoaderEventBrokerClient instance;
  41 +
  42 + /**
  43 + * Reference to the game
  44 + */
  45 + protected final GameEngineClient engineClient;
  46 +
  47 + /**
  48 + * Current screen width
  49 + */
  50 + private int screenWidth = 854;
  51 +
  52 + /**
  53 + * Current screen height
  54 + */
  55 + private int screenHeight = 480;
  56 +
  57 + /**
  58 + *
  59 + */
  60 + private boolean wasFullScreen = false;
  61 +
  62 + /**
  63 + * Hash code of the current world. We don't store the world reference here because we don't want
  64 + * to mess with world GC by mistake
  65 + */
  66 + private int worldHashCode = 0;
  67 +
  68 + private FastIterableDeque<Tickable> tickListeners;
  69 + private FastIterableDeque<GameLoopListener> loopListeners = new HandlerList<GameLoopListener>(GameLoopListener.class);
  70 + private FastIterableDeque<RenderListener> renderListeners = new HandlerList<RenderListener>(RenderListener.class);
  71 + private FastIterableDeque<PreRenderListener> preRenderListeners = new HandlerList<PreRenderListener>(PreRenderListener.class);
  72 + private FastIterableDeque<PostRenderListener> postRenderListeners = new HandlerList<PostRenderListener>(PostRenderListener.class);
  73 + private FastIterableDeque<HUDRenderListener> hudRenderListeners = new HandlerList<HUDRenderListener>(HUDRenderListener.class);
  74 + private FastIterableDeque<ChatRenderListener> chatRenderListeners = new HandlerList<ChatRenderListener>(ChatRenderListener.class);
  75 + private FastIterableDeque<OutboundChatListener> outboundChatListeners = new HandlerList<OutboundChatListener>(OutboundChatListener.class);
  76 + private FastIterableDeque<ViewportListener> viewportListeners = new HandlerList<ViewportListener>(ViewportListener.class);
  77 + private FastIterableDeque<FrameBufferListener> frameBufferListeners = new HandlerList<FrameBufferListener>(FrameBufferListener.class);
  78 + private FastIterableDeque<InitCompleteListener> initListeners = new HandlerList<InitCompleteListener>(InitCompleteListener.class);
  79 + private FastIterableDeque<OutboundChatFilter> outboundChatFilters = new HandlerList<OutboundChatFilter>(OutboundChatFilter.class, ReturnLogicOp.AND);
  80 + private FastIterableDeque<ScreenshotListener> screenshotListeners = new HandlerList<ScreenshotListener>(ScreenshotListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE);
  81 + private FastIterableDeque<EntityRenderListener> entityRenderListeners = new HandlerList<EntityRenderListener>(EntityRenderListener.class);
  82 +
  83 + @SuppressWarnings("cast")
  84 + public LiteLoaderEventBrokerClient(LiteLoader loader, GameEngineClient engine, LoaderProperties properties)
  85 + {
  86 + super(loader, engine, properties);
  87 +
  88 + LiteLoaderEventBrokerClient.instance = this;
  89 +
  90 + this.engineClient = (GameEngineClient)engine;
  91 + this.tickListeners = new ProfilingHandlerList<Tickable>(Tickable.class, this.engineClient.getProfiler());
  92 + }
  93 +
  94 + static LiteLoaderEventBrokerClient getInstance()
  95 + {
  96 + return LiteLoaderEventBrokerClient.instance;
  97 + }
  98 +
  99 + @Override
  100 + public void onResourceManagerReload(IResourceManager resourceManager)
  101 + {
  102 + LoadingProgress.setMessage("Reloading Resources...");
  103 + }
  104 +
  105 + /* (non-Javadoc)
  106 + * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate)
  107 + */
  108 + @Override
  109 + public void registerInterfaces(InterfaceRegistrationDelegate delegate)
  110 + {
  111 + super.registerInterfaces(delegate);
  112 +
  113 + delegate.registerInterface(Tickable.class);
  114 + delegate.registerInterface(GameLoopListener.class);
  115 + delegate.registerInterface(RenderListener.class);
  116 + delegate.registerInterface(PreRenderListener.class);
  117 + delegate.registerInterface(PostRenderListener.class);
  118 + delegate.registerInterface(HUDRenderListener.class);
  119 + delegate.registerInterface(ChatRenderListener.class);
  120 + delegate.registerInterface(OutboundChatListener.class);
  121 + delegate.registerInterface(ViewportListener.class);
  122 + delegate.registerInterface(FrameBufferListener.class);
  123 + delegate.registerInterface(InitCompleteListener.class);
  124 + delegate.registerInterface(OutboundChatFilter.class);
  125 + delegate.registerInterface(ScreenshotListener.class);
  126 + delegate.registerInterface(EntityRenderListener.class);
  127 + }
  128 +
  129 + /* (non-Javadoc)
  130 + * @see com.mumfrey.liteloader.api.InterfaceProvider#initProvider()
  131 + */
  132 + @Override
  133 + public void initProvider()
  134 + {
  135 + }
  136 +
  137 + /**
  138 + * @param tickable
  139 + */
  140 + public void addTickListener(Tickable tickable)
  141 + {
  142 + this.tickListeners.add(tickable);
  143 + }
  144 +
  145 + /**
  146 + * @param loopListener
  147 + */
  148 + public void addLoopListener(GameLoopListener loopListener)
  149 + {
  150 + this.loopListeners.add(loopListener);
  151 + }
  152 +
  153 + /**
  154 + * @param initCompleteListener
  155 + */
  156 + public void addInitListener(InitCompleteListener initCompleteListener)
  157 + {
  158 + this.initListeners.add(initCompleteListener);
  159 + }
  160 +
  161 + /**
  162 + * @param renderListener
  163 + */
  164 + public void addRenderListener(RenderListener renderListener)
  165 + {
  166 + this.renderListeners.add(renderListener);
  167 + }
  168 +
  169 + /**
  170 + * @param preRenderListener
  171 + */
  172 + public void addPreRenderListener(PreRenderListener preRenderListener)
  173 + {
  174 + this.preRenderListeners.add(preRenderListener);
  175 + }
  176 +
  177 + /**
  178 + * @param postRenderListener
  179 + */
  180 + public void addPostRenderListener(PostRenderListener postRenderListener)
  181 + {
  182 + this.postRenderListeners.add(postRenderListener);
  183 + }
  184 +
  185 + /**
  186 + * @param chatRenderListener
  187 + */
  188 + public void addChatRenderListener(ChatRenderListener chatRenderListener)
  189 + {
  190 + this.chatRenderListeners.add(chatRenderListener);
  191 + }
  192 +
  193 + /**
  194 + * @param hudRenderListener
  195 + */
  196 + public void addHUDRenderListener(HUDRenderListener hudRenderListener)
  197 + {
  198 + this.hudRenderListeners.add(hudRenderListener);
  199 + }
  200 +
  201 + /**
  202 + * @param outboundChatListener
  203 + */
  204 + public void addOutboundChatListener(OutboundChatListener outboundChatListener)
  205 + {
  206 + this.outboundChatListeners.add(outboundChatListener);
  207 + }
  208 +
  209 + /**
  210 + * @param outboundChatFilter
  211 + */
  212 + public void addOutboundChatFiler(OutboundChatFilter outboundChatFilter)
  213 + {
  214 + this.outboundChatFilters.add(outboundChatFilter);
  215 + }
  216 +
  217 + /**
  218 + * @param viewportListener
  219 + */
  220 + public void addViewportListener(ViewportListener viewportListener)
  221 + {
  222 + this.viewportListeners.add(viewportListener);
  223 + }
  224 +
  225 + /**
  226 + * @param frameBufferListener
  227 + */
  228 + public void addFrameBufferListener(FrameBufferListener frameBufferListener)
  229 + {
  230 + this.frameBufferListeners.add(frameBufferListener);
  231 + }
  232 +
  233 + /**
  234 + * @param screenshotListener
  235 + */
  236 + public void addScreenshotListener(ScreenshotListener screenshotListener)
  237 + {
  238 + this.screenshotListeners.add(screenshotListener);
  239 + }
  240 +
  241 + /**
  242 + * @param entityRenderListener
  243 + */
  244 + public void addEntityRenderListener(EntityRenderListener entityRenderListener)
  245 + {
  246 + this.entityRenderListeners.add(entityRenderListener);
  247 + }
  248 +
  249 + /**
  250 + * Late initialisation callback
  251 + */
  252 + @Override
  253 + protected void onStartupComplete()
  254 + {
  255 + this.engine.getResources().refreshResources(false);
  256 +
  257 + for (InitCompleteListener initMod : this.initListeners)
  258 + {
  259 + try
  260 + {
  261 + LoadingProgress.setMessage("Calling late init for mod %s...", initMod.getName());
  262 + LiteLoaderLogger.info("Calling late init for mod %s", initMod.getName());
  263 + initMod.onInitCompleted(this.engine.getClient(), this.loader);
  264 + }
  265 + catch (Throwable th)
  266 + {
  267 + this.mods.onLateInitFailed(initMod, th);
  268 + LiteLoaderLogger.warning(th, "Error calling late init for mod %s", initMod.getName());
  269 + }
  270 + }
  271 +
  272 + this.onResize(this.engineClient.getClient());
  273 +
  274 + super.onStartupComplete();
  275 + }
  276 +
  277 + public void onResize(Minecraft minecraft)
  278 + {
  279 + ScaledResolution currentResolution = this.engineClient.getScaledResolution();
  280 + this.screenWidth = currentResolution.getScaledWidth();
  281 + this.screenHeight = currentResolution.getScaledHeight();
  282 +
  283 + if (this.wasFullScreen != minecraft.isFullScreen())
  284 + {
  285 + this.viewportListeners.all().onFullScreenToggled(minecraft.isFullScreen());
  286 + }
  287 +
  288 + this.wasFullScreen = minecraft.isFullScreen();
  289 + this.viewportListeners.all().onViewportResized(currentResolution, minecraft.displayWidth, minecraft.displayHeight);
  290 + }
  291 +
  292 + /**
  293 + * Callback from the tick hook, pre render
  294 + */
  295 + void onRender()
  296 + {
  297 + this.renderListeners.all().onRender();
  298 + }
  299 +
  300 + /**
  301 + * Callback from the tick hook, post render entities
  302 + *
  303 + * @param partialTicks
  304 + * @param timeSlice
  305 + */
  306 + void postRenderEntities(float partialTicks, long timeSlice)
  307 + {
  308 + this.postRenderListeners.all().onPostRenderEntities(partialTicks);
  309 + }
  310 +
  311 + /**
  312 + * Callback from the tick hook, post render
  313 + *
  314 + * @param partialTicks
  315 + * @param timeSlice
  316 + */
  317 + void postRender(float partialTicks, long timeSlice)
  318 + {
  319 + ((IEntityRenderer)this.engineClient.getClient().entityRenderer).setupCamera(partialTicks, 0);
  320 + this.postRenderListeners.all().onPostRender(partialTicks);
  321 + }
  322 +
  323 + /**
  324 + * Called immediately before the current GUI is rendered
  325 + */
  326 + void preRenderGUI(float partialTicks)
  327 + {
  328 + this.renderListeners.all().onRenderGui(this.engineClient.getCurrentScreen());
  329 + }
  330 +
  331 + /**
  332 + * Called immediately after the world/camera transform is initialised
  333 + *
  334 + * @param pass
  335 + * @param timeSlice
  336 + * @param partialTicks
  337 + */
  338 + void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)
  339 + {
  340 + this.renderListeners.all().onSetupCameraTransform();
  341 + this.preRenderListeners.all().onSetupCameraTransform(partialTicks, pass, timeSlice);
  342 + }
  343 +
  344 + /**
  345 + * Called immediately before the chat log is rendered
  346 + *
  347 + * @param chatGui
  348 + * @param partialTicks
  349 + */
  350 + void onRenderChat(GuiNewChat chatGui, float partialTicks)
  351 + {
  352 + this.chatRenderListeners.all().onPreRenderChat(this.screenWidth, this.screenHeight, chatGui);
  353 + }
  354 +
  355 + /**
  356 + * Called immediately after the chat log is rendered
  357 + *
  358 + * @param chatGui
  359 + * @param partialTicks
  360 + */
  361 + void postRenderChat(GuiNewChat chatGui, float partialTicks)
  362 + {
  363 + GuiNewChat chat = this.engineClient.getChatGUI();
  364 + this.chatRenderListeners.all().onPostRenderChat(this.screenWidth, this.screenHeight, chat);
  365 + }
  366 +
  367 + /**
  368 + * Callback when about to render the HUD
  369 + */
  370 + void onRenderHUD(float partialTicks)
  371 + {
  372 + this.hudRenderListeners.all().onPreRenderHUD(this.screenWidth, this.screenHeight);
  373 + }
  374 +
  375 + /**
  376 + * Callback when the HUD has just been rendered
  377 + */
  378 + void postRenderHUD(float partialTicks)
  379 + {
  380 + this.hudRenderListeners.all().onPostRenderHUD(this.screenWidth, this.screenHeight);
  381 + }
  382 +
  383 + /**
  384 + * Callback from the tick hook, called every frame when the timer is updated
  385 + */
  386 + void onTimerUpdate()
  387 + {
  388 + Minecraft minecraft = this.engine.getClient();
  389 + this.loopListeners.all().onRunGameLoop(minecraft);
  390 + }
  391 +
  392 + /**
  393 + * Callback from the tick hook, ticks all tickable mods
  394 + */
  395 + void onTick()
  396 + {
  397 + this.profiler.endStartSection("litemods");
  398 +
  399 + Timer minecraftTimer = ((IMinecraft)this.engine.getClient()).getTimer();
  400 + float partialTicks = minecraftTimer.renderPartialTicks;
  401 + boolean clock = minecraftTimer.elapsedTicks > 0;
  402 +
  403 + Minecraft minecraft = this.engine.getClient();
  404 +
  405 + // Flag indicates whether we are in game at the moment
  406 + Entity renderViewEntity = minecraft.getRenderViewEntity(); // TODO OBF MCPTEST func_175606_aa - getRenderViewEntity
  407 + boolean inGame = renderViewEntity != null && renderViewEntity.worldObj != null;
  408 +
  409 + this.profiler.startSection("loader");
  410 + super.onTick(clock, partialTicks, inGame);
  411 +
  412 + int mouseX = Mouse.getX() * this.screenWidth / minecraft.displayWidth;
  413 + int mouseY = this.screenHeight - Mouse.getY() * this.screenHeight / minecraft.displayHeight - 1;
  414 + this.profiler.endStartSection("postrender");
  415 + super.onPostRender(mouseX, mouseY, partialTicks);
  416 + this.profiler.endSection();
  417 +
  418 + // Iterate tickable mods
  419 + this.tickListeners.all().onTick(minecraft, partialTicks, inGame, clock);
  420 +
  421 + // Detected world change
  422 + int worldHashCode = (minecraft.theWorld != null) ? minecraft.theWorld.hashCode() : 0;
  423 + if (worldHashCode != this.worldHashCode)
  424 + {
  425 + this.worldHashCode = worldHashCode;
  426 + super.onWorldChanged(minecraft.theWorld);
  427 + }
  428 + }
  429 +
  430 + /**
  431 + * @param packet
  432 + * @param message
  433 + */
  434 + void onSendChatMessage(C01PacketChatMessage packet, String message)
  435 + {
  436 + this.outboundChatListeners.all().onSendChatMessage(packet, message);
  437 + }
  438 +
  439 + /**
  440 + * @param message
  441 + */
  442 + void onSendChatMessage(EventInfo<EntityPlayerSP> e, String message)
  443 + {
  444 + if (!this.outboundChatFilters.all().onSendChatMessage(message))
  445 + {
  446 + e.cancel();
  447 + }
  448 + }
  449 +
  450 + /**
  451 + * @param framebuffer
  452 + */
  453 + void preRenderFBO(Framebuffer framebuffer)
  454 + {
  455 + this.frameBufferListeners.all().preRenderFBO(framebuffer);
  456 + }
  457 +
  458 + /**
  459 + * @param framebuffer
  460 + * @param width
  461 + * @param height
  462 + */
  463 + void onRenderFBO(Framebuffer framebuffer, int width, int height)
  464 + {
  465 + this.frameBufferListeners.all().onRenderFBO(framebuffer, width, height);
  466 + }
  467 +
  468 + /**
  469 + * @param framebuffer
  470 + */
  471 + void postRenderFBO(Framebuffer framebuffer)
  472 + {
  473 + this.frameBufferListeners.all().postRenderFBO(framebuffer);
  474 + }
  475 +
  476 + /**
  477 + * @param partialTicks
  478 + * @param timeSlice
  479 + */
  480 + void onRenderWorld(float partialTicks, long timeSlice)
  481 + {
  482 + this.preRenderListeners.all().onRenderWorld(partialTicks);
  483 + this.renderListeners.all().onRenderWorld();
  484 + }
  485 +
  486 + /**
  487 + * @param partialTicks
  488 + * @param pass
  489 + * @param timeSlice
  490 + */
  491 + void onRenderSky(float partialTicks, int pass, long timeSlice)
  492 + {
  493 + this.preRenderListeners.all().onRenderSky(partialTicks, pass);
  494 + }
  495 +
  496 + /**
  497 + * @param partialTicks
  498 + * @param pass
  499 + * @param renderGlobal
  500 + */
  501 + void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal)
  502 + {
  503 + this.preRenderListeners.all().onRenderClouds(partialTicks, pass, renderGlobal);
  504 + }
  505 +
  506 + /**
  507 + * @param partialTicks
  508 + * @param pass
  509 + * @param timeSlice
  510 + */
  511 + void onRenderTerrain(float partialTicks, int pass, long timeSlice)
  512 + {
  513 + this.preRenderListeners.all().onRenderTerrain(partialTicks, pass);
  514 + }
  515 +
  516 + /**
  517 + * @param e
  518 + * @param name
  519 + * @param width
  520 + * @param height
  521 + * @param fbo
  522 + */
  523 + void onScreenshot(ReturnEventInfo<ScreenShotHelper, IChatComponent> e, String name, int width, int height, Framebuffer fbo)
  524 + {
  525 + ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>(e.getReturnValue());
  526 +
  527 + if (!this.screenshotListeners.all().onSaveScreenshot(name, width, height, fbo, ret))
  528 + {
  529 + e.setReturnValue(ret.get());
  530 + }
  531 + }
  532 +
  533 + /**
  534 + * @param source
  535 + * @param entity
  536 + * @param xPos
  537 + * @param yPos
  538 + * @param zPos
  539 + * @param yaw
  540 + * @param partialTicks
  541 + * @param render
  542 + */
  543 + public void onRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render)
  544 + {
  545 + this.entityRenderListeners.all().onRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks);
  546 + }
  547 +
  548 + /**
  549 + * @param source
  550 + * @param entity
  551 + * @param xPos
  552 + * @param yPos
  553 + * @param zPos
  554 + * @param yaw
  555 + * @param partialTicks
  556 + * @param render
  557 + */
  558 + public void onPostRenderEntity(RenderManager source, Entity entity, double xPos, double yPos, double zPos, float yaw, float partialTicks, Render render)
  559 + {
  560 + this.entityRenderListeners.all().onPostRenderEntity(render, entity, xPos, yPos, zPos, yaw, partialTicks);
  561 + }
562 } 562 }
src/client/java/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java
@@ -27,261 +27,261 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -27,261 +27,261 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
27 */ 27 */
28 public class LiteLoaderPanelManager implements PanelManager<GuiScreen> 28 public class LiteLoaderPanelManager implements PanelManager<GuiScreen>
29 { 29 {
30 - private final LoaderEnvironment environment;  
31 -  
32 - /**  
33 - * Loader Properties adapter  
34 - */  
35 - private final LoaderProperties properties;  
36 -  
37 - private LiteLoaderMods mods;  
38 -  
39 - private ConfigManager configManager;  
40 -  
41 - private Minecraft minecraft;  
42 -  
43 - /**  
44 - * Setting which determines whether we show the "mod info" screen tab in the main menu  
45 - */  
46 - private boolean displayModInfoScreenTab = true;  
47 -  
48 - /**  
49 - * Don't hide t  
50 - */  
51 - private boolean tabAlwaysExpanded = false;  
52 -  
53 - /**  
54 - * Override for the "mod info" tab setting, so that mods which want to handle the mod info themselves  
55 - * can temporarily disable the function without having to change the underlying property  
56 - */  
57 - private boolean hideModInfoScreenTab = false;  
58 -  
59 - private boolean checkForUpdate = false;  
60 -  
61 - private String notification;  
62 -  
63 - /**  
64 - * Active "mod info" screen, drawn as an overlay when in the main menu and made the active screen if  
65 - * the user clicks the tab  
66 - */  
67 - private GuiLiteLoaderPanel panelHost;  
68 -  
69 - /**  
70 - * @param environment  
71 - * @param properties  
72 - */  
73 - @SuppressWarnings("unchecked")  
74 - public LiteLoaderPanelManager(GameEngine<?, ?> engine, LoaderEnvironment environment, LoaderProperties properties)  
75 - {  
76 - this.environment = environment;  
77 - this.properties = properties;  
78 - this.minecraft = ((GameEngine<Minecraft, ?>)engine).getClient();  
79 -  
80 - this.displayModInfoScreenTab = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_MOD_INFO_SCREEN, true);  
81 - this.tabAlwaysExpanded = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_NO_HIDE_TAB, false);  
82 -  
83 - if (this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE, false))  
84 - {  
85 - int updateCheckInterval = this.properties.getIntegerProperty(LoaderProperties.OPTION_UPDATE_CHECK_INTR) + 1;  
86 - LiteLoaderLogger.debug("Force update is TRUE, updateCheckInterval = %d", updateCheckInterval);  
87 -  
88 - if (updateCheckInterval > 10)  
89 - {  
90 - LiteLoaderLogger.debug("Forcing update check!");  
91 - this.checkForUpdate = true;  
92 - updateCheckInterval = 0;  
93 - }  
94 -  
95 - this.properties.setIntegerProperty(LoaderProperties.OPTION_UPDATE_CHECK_INTR, updateCheckInterval);  
96 - this.properties.writeProperties();  
97 - }  
98 - }  
99 -  
100 - @Override  
101 - public void init(LiteLoaderMods mods, ConfigManager configManager)  
102 - {  
103 - this.mods = mods;  
104 - this.configManager = configManager;  
105 - }  
106 -  
107 - @Override  
108 - public void onStartupComplete()  
109 - {  
110 - if (this.checkForUpdate)  
111 - {  
112 - LiteLoaderVersion.getUpdateSite().beginUpdateCheck();  
113 - }  
114 - }  
115 -  
116 - /* (non-Javadoc)  
117 - * @see com.mumfrey.liteloader.api.TickObserver#onTick(boolean, float, boolean)  
118 - */  
119 - @Override  
120 - public void onTick(boolean clock, float partialTicks, boolean inGame)  
121 - {  
122 - if (clock && this.panelHost != null && this.minecraft.currentScreen != this.panelHost)  
123 - {  
124 - this.panelHost.updateScreen();  
125 - }  
126 -  
127 - if (clock && this.checkForUpdate)  
128 - {  
129 - LiteLoaderUpdateSite updateSite = LiteLoaderVersion.getUpdateSite();  
130 - if (!updateSite.isCheckInProgress() && updateSite.isCheckComplete())  
131 - {  
132 - LiteLoaderLogger.debug("Scheduled update check completed, success=%s", updateSite.isCheckSucceess());  
133 - this.checkForUpdate = false;  
134 - if (updateSite.isCheckSucceess() && updateSite.isUpdateAvailable())  
135 - {  
136 - this.setNotification(I18n.format("gui.notifications.updateavailable"));  
137 - }  
138 - }  
139 - }  
140 - }  
141 -  
142 - /* (non-Javadoc)  
143 - * @see com.mumfrey.liteloader.api.PostRenderObserver#onPostRender(int, int, float)  
144 - */  
145 - @Override  
146 - public void onPostRender(int mouseX, int mouseY, float partialTicks)  
147 - {  
148 - if (this.mods == null) return;  
149 -  
150 - boolean tabHidden = this.isTabHidden() && this.minecraft.currentScreen instanceof GuiMainMenu;  
151 -  
152 - if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && ((this.displayModInfoScreenTab && !tabHidden) || (this.panelHost != null && this.panelHost.isOpen())))  
153 - {  
154 - // If we're at the main menu, prepare the overlay  
155 - if (this.panelHost == null || this.panelHost.getScreen() != this.minecraft.currentScreen)  
156 - {  
157 - this.panelHost = new GuiLiteLoaderPanel(this.minecraft, this.minecraft.currentScreen, this.mods, this.environment, this.properties, this.configManager, !tabHidden);  
158 - if (this.notification != null)  
159 - {  
160 - this.panelHost.setNotification(this.notification);  
161 - }  
162 - }  
163 -  
164 - this.minecraft.entityRenderer.setupOverlayRendering();  
165 - this.panelHost.drawScreen(mouseX, mouseY, partialTicks, this.tabAlwaysExpanded);  
166 - }  
167 - else if (this.minecraft.currentScreen != this.panelHost && this.panelHost != null)  
168 - {  
169 - // If we're in any other screen, kill the overlay  
170 - this.panelHost.release();  
171 - this.panelHost = null;  
172 - }  
173 - else if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_TAB))  
174 - {  
175 - this.displayLiteLoaderPanel(this.minecraft.currentScreen);  
176 - }  
177 - }  
178 -  
179 - /**  
180 - * Set the "mod info" screen tab to hidden, regardless of the property setting  
181 - */  
182 - @Override  
183 - public void hideTab()  
184 - {  
185 - this.hideModInfoScreenTab = true;  
186 - }  
187 -  
188 - private boolean isTabHidden()  
189 - {  
190 - return this.hideModInfoScreenTab && this.getStartupErrorCount() == 0 && this.notification == null;  
191 - }  
192 -  
193 - /**  
194 - * Set whether the "mod info" screen tab should be shown in the main menu  
195 - */  
196 - @Override  
197 - public void setTabVisible(boolean show)  
198 - {  
199 - this.displayModInfoScreenTab = show;  
200 - this.properties.setBooleanProperty(LoaderProperties.OPTION_MOD_INFO_SCREEN, show);  
201 - this.properties.writeProperties();  
202 - }  
203 -  
204 - /**  
205 - * Get whether the "mod info" screen tab is shown in the main menu  
206 - */  
207 - @Override  
208 - public boolean isTabVisible()  
209 - {  
210 - return this.displayModInfoScreenTab;  
211 - }  
212 -  
213 - @Override  
214 - public void setTabAlwaysExpanded(boolean expand)  
215 - {  
216 - this.tabAlwaysExpanded = expand;  
217 - this.properties.setBooleanProperty(LoaderProperties.OPTION_NO_HIDE_TAB, expand);  
218 - this.properties.writeProperties();  
219 - }  
220 -  
221 - @Override  
222 - public boolean isTabAlwaysExpanded()  
223 - {  
224 - return this.tabAlwaysExpanded;  
225 - }  
226 -  
227 - @Override  
228 - public void setForceUpdateEnabled(boolean forceUpdate)  
229 - {  
230 - this.properties.setBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE, forceUpdate);  
231 - this.properties.writeProperties();  
232 - }  
233 -  
234 - @Override  
235 - public boolean isForceUpdateEnabled()  
236 - {  
237 - return this.properties.getBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE);  
238 - }  
239 -  
240 - /**  
241 - * Display the liteloader panel over the specified GUI  
242 - *  
243 - * @param parentScreen  
244 - */  
245 - @Override  
246 - public void displayLiteLoaderPanel(GuiScreen parentScreen)  
247 - {  
248 - if (this.isPanelSupportedOnScreen(parentScreen))  
249 - {  
250 - this.panelHost = new GuiLiteLoaderPanel(this.minecraft, parentScreen, this.mods, this.environment, this.properties, this.configManager, !this.isTabHidden());  
251 - this.minecraft.displayGuiScreen(this.panelHost);  
252 - }  
253 - }  
254 -  
255 - @Override  
256 - public int getStartupErrorCount()  
257 - {  
258 - return this.mods.getStartupErrorCount();  
259 - }  
260 -  
261 - @Override  
262 - public int getCriticalErrorCount()  
263 - {  
264 - return this.mods.getCriticalErrorCount();  
265 - }  
266 -  
267 - @Override  
268 - public void setNotification(String notification)  
269 - {  
270 - LiteLoaderLogger.debug("Setting notification: " + notification);  
271 - this.notification = notification;  
272 -  
273 - if (this.panelHost != null)  
274 - {  
275 - this.panelHost.setNotification(notification);  
276 - }  
277 - }  
278 -  
279 - private boolean isPanelSupportedOnScreen(GuiScreen guiScreen)  
280 - {  
281 - return (  
282 - guiScreen instanceof GuiMainMenu ||  
283 - guiScreen instanceof GuiIngameMenu ||  
284 - guiScreen instanceof GuiOptions  
285 - );  
286 - } 30 + private final LoaderEnvironment environment;
  31 +
  32 + /**
  33 + * Loader Properties adapter
  34 + */
  35 + private final LoaderProperties properties;
  36 +
  37 + private LiteLoaderMods mods;
  38 +
  39 + private ConfigManager configManager;
  40 +
  41 + private Minecraft minecraft;
  42 +
  43 + /**
  44 + * Setting which determines whether we show the "mod info" screen tab in the main menu
  45 + */
  46 + private boolean displayModInfoScreenTab = true;
  47 +
  48 + /**
  49 + * Don't hide t
  50 + */
  51 + private boolean tabAlwaysExpanded = false;
  52 +
  53 + /**
  54 + * Override for the "mod info" tab setting, so that mods which want to handle the mod info themselves
  55 + * can temporarily disable the function without having to change the underlying property
  56 + */
  57 + private boolean hideModInfoScreenTab = false;
  58 +
  59 + private boolean checkForUpdate = false;
  60 +
  61 + private String notification;
  62 +
  63 + /**
  64 + * Active "mod info" screen, drawn as an overlay when in the main menu and made the active screen if
  65 + * the user clicks the tab
  66 + */
  67 + private GuiLiteLoaderPanel panelHost;
  68 +
  69 + /**
  70 + * @param environment
  71 + * @param properties
  72 + */
  73 + @SuppressWarnings("unchecked")
  74 + public LiteLoaderPanelManager(GameEngine<?, ?> engine, LoaderEnvironment environment, LoaderProperties properties)
  75 + {
  76 + this.environment = environment;
  77 + this.properties = properties;
  78 + this.minecraft = ((GameEngine<Minecraft, ?>)engine).getClient();
  79 +
  80 + this.displayModInfoScreenTab = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_MOD_INFO_SCREEN, true);
  81 + this.tabAlwaysExpanded = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_NO_HIDE_TAB, false);
  82 +
  83 + if (this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE, false))
  84 + {
  85 + int updateCheckInterval = this.properties.getIntegerProperty(LoaderProperties.OPTION_UPDATE_CHECK_INTR) + 1;
  86 + LiteLoaderLogger.debug("Force update is TRUE, updateCheckInterval = %d", updateCheckInterval);
  87 +
  88 + if (updateCheckInterval > 10)
  89 + {
  90 + LiteLoaderLogger.debug("Forcing update check!");
  91 + this.checkForUpdate = true;
  92 + updateCheckInterval = 0;
  93 + }
  94 +
  95 + this.properties.setIntegerProperty(LoaderProperties.OPTION_UPDATE_CHECK_INTR, updateCheckInterval);
  96 + this.properties.writeProperties();
  97 + }
  98 + }
  99 +
  100 + @Override
  101 + public void init(LiteLoaderMods mods, ConfigManager configManager)
  102 + {
  103 + this.mods = mods;
  104 + this.configManager = configManager;
  105 + }
  106 +
  107 + @Override
  108 + public void onStartupComplete()
  109 + {
  110 + if (this.checkForUpdate)
  111 + {
  112 + LiteLoaderVersion.getUpdateSite().beginUpdateCheck();
  113 + }
  114 + }
  115 +
  116 + /* (non-Javadoc)
  117 + * @see com.mumfrey.liteloader.api.TickObserver#onTick(boolean, float, boolean)
  118 + */
  119 + @Override
  120 + public void onTick(boolean clock, float partialTicks, boolean inGame)
  121 + {
  122 + if (clock && this.panelHost != null && this.minecraft.currentScreen != this.panelHost)
  123 + {
  124 + this.panelHost.updateScreen();
  125 + }
  126 +
  127 + if (clock && this.checkForUpdate)
  128 + {
  129 + LiteLoaderUpdateSite updateSite = LiteLoaderVersion.getUpdateSite();
  130 + if (!updateSite.isCheckInProgress() && updateSite.isCheckComplete())
  131 + {
  132 + LiteLoaderLogger.debug("Scheduled update check completed, success=%s", updateSite.isCheckSucceess());
  133 + this.checkForUpdate = false;
  134 + if (updateSite.isCheckSucceess() && updateSite.isUpdateAvailable())
  135 + {
  136 + this.setNotification(I18n.format("gui.notifications.updateavailable"));
  137 + }
  138 + }
  139 + }
  140 + }
  141 +
  142 + /* (non-Javadoc)
  143 + * @see com.mumfrey.liteloader.api.PostRenderObserver#onPostRender(int, int, float)
  144 + */
  145 + @Override
  146 + public void onPostRender(int mouseX, int mouseY, float partialTicks)
  147 + {
  148 + if (this.mods == null) return;
  149 +
  150 + boolean tabHidden = this.isTabHidden() && this.minecraft.currentScreen instanceof GuiMainMenu;
  151 +
  152 + if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && ((this.displayModInfoScreenTab && !tabHidden) || (this.panelHost != null && this.panelHost.isOpen())))
  153 + {
  154 + // If we're at the main menu, prepare the overlay
  155 + if (this.panelHost == null || this.panelHost.getScreen() != this.minecraft.currentScreen)
  156 + {
  157 + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, this.minecraft.currentScreen, this.mods, this.environment, this.properties, this.configManager, !tabHidden);
  158 + if (this.notification != null)
  159 + {
  160 + this.panelHost.setNotification(this.notification);
  161 + }
  162 + }
  163 +
  164 + this.minecraft.entityRenderer.setupOverlayRendering();
  165 + this.panelHost.drawScreen(mouseX, mouseY, partialTicks, this.tabAlwaysExpanded);
  166 + }
  167 + else if (this.minecraft.currentScreen != this.panelHost && this.panelHost != null)
  168 + {
  169 + // If we're in any other screen, kill the overlay
  170 + this.panelHost.release();
  171 + this.panelHost = null;
  172 + }
  173 + else if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_TAB))
  174 + {
  175 + this.displayLiteLoaderPanel(this.minecraft.currentScreen);
  176 + }
  177 + }
  178 +
  179 + /**
  180 + * Set the "mod info" screen tab to hidden, regardless of the property setting
  181 + */
  182 + @Override
  183 + public void hideTab()
  184 + {
  185 + this.hideModInfoScreenTab = true;
  186 + }
  187 +
  188 + private boolean isTabHidden()
  189 + {
  190 + return this.hideModInfoScreenTab && this.getStartupErrorCount() == 0 && this.notification == null;
  191 + }
  192 +
  193 + /**
  194 + * Set whether the "mod info" screen tab should be shown in the main menu
  195 + */
  196 + @Override
  197 + public void setTabVisible(boolean show)
  198 + {
  199 + this.displayModInfoScreenTab = show;
  200 + this.properties.setBooleanProperty(LoaderProperties.OPTION_MOD_INFO_SCREEN, show);
  201 + this.properties.writeProperties();
  202 + }
  203 +
  204 + /**
  205 + * Get whether the "mod info" screen tab is shown in the main menu
  206 + */
  207 + @Override
  208 + public boolean isTabVisible()
  209 + {
  210 + return this.displayModInfoScreenTab;
  211 + }
  212 +
  213 + @Override
  214 + public void setTabAlwaysExpanded(boolean expand)
  215 + {
  216 + this.tabAlwaysExpanded = expand;
  217 + this.properties.setBooleanProperty(LoaderProperties.OPTION_NO_HIDE_TAB, expand);
  218 + this.properties.writeProperties();
  219 + }
  220 +
  221 + @Override
  222 + public boolean isTabAlwaysExpanded()
  223 + {
  224 + return this.tabAlwaysExpanded;
  225 + }
  226 +
  227 + @Override
  228 + public void setForceUpdateEnabled(boolean forceUpdate)
  229 + {
  230 + this.properties.setBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE, forceUpdate);
  231 + this.properties.writeProperties();
  232 + }
  233 +
  234 + @Override
  235 + public boolean isForceUpdateEnabled()
  236 + {
  237 + return this.properties.getBooleanProperty(LoaderProperties.OPTION_FORCE_UPDATE);
  238 + }
  239 +
  240 + /**
  241 + * Display the liteloader panel over the specified GUI
  242 + *
  243 + * @param parentScreen
  244 + */
  245 + @Override
  246 + public void displayLiteLoaderPanel(GuiScreen parentScreen)
  247 + {
  248 + if (this.isPanelSupportedOnScreen(parentScreen))
  249 + {
  250 + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, parentScreen, this.mods, this.environment, this.properties, this.configManager, !this.isTabHidden());
  251 + this.minecraft.displayGuiScreen(this.panelHost);
  252 + }
  253 + }
  254 +
  255 + @Override
  256 + public int getStartupErrorCount()
  257 + {
  258 + return this.mods.getStartupErrorCount();
  259 + }
  260 +
  261 + @Override
  262 + public int getCriticalErrorCount()
  263 + {
  264 + return this.mods.getCriticalErrorCount();
  265 + }
  266 +
  267 + @Override
  268 + public void setNotification(String notification)
  269 + {
  270 + LiteLoaderLogger.debug("Setting notification: " + notification);
  271 + this.notification = notification;
  272 +
  273 + if (this.panelHost != null)
  274 + {
  275 + this.panelHost.setNotification(notification);
  276 + }
  277 + }
  278 +
  279 + private boolean isPanelSupportedOnScreen(GuiScreen guiScreen)
  280 + {
  281 + return (
  282 + guiScreen instanceof GuiMainMenu ||
  283 + guiScreen instanceof GuiIngameMenu ||
  284 + guiScreen instanceof GuiOptions
  285 + );
  286 + }
287 } 287 }
src/client/java/com/mumfrey/liteloader/client/PacketEventsClient.java
@@ -43,212 +43,212 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -43,212 +43,212 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
43 */ 43 */
44 public class PacketEventsClient extends PacketEvents 44 public class PacketEventsClient extends PacketEvents
45 { 45 {
46 - private static RealmsServer joiningRealm;  
47 -  
48 - private FastIterableDeque<JoinGameListener> joinGameListeners = new HandlerList<JoinGameListener>(JoinGameListener.class);  
49 - private FastIterableDeque<ChatListener> chatListeners = new HandlerList<ChatListener>(ChatListener.class);  
50 - private FastIterableDeque<ChatFilter> chatFilters = new HandlerList<ChatFilter>(ChatFilter.class, ReturnLogicOp.AND_BREAK_ON_FALSE);  
51 - private FastIterableDeque<PreJoinGameListener> preJoinGameListeners = new HandlerList<PreJoinGameListener>(PreJoinGameListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE);  
52 - private FastIterableDeque<PostLoginListener> postLoginListeners = new HandlerList<PostLoginListener>(PostLoginListener.class);  
53 -  
54 - @Override  
55 - public void registerInterfaces(InterfaceRegistrationDelegate delegate)  
56 - {  
57 - super.registerInterfaces(delegate);  
58 -  
59 - delegate.registerInterface(JoinGameListener.class);  
60 - delegate.registerInterface(ChatListener.class);  
61 - delegate.registerInterface(ChatFilter.class);  
62 - delegate.registerInterface(PreJoinGameListener.class);  
63 - delegate.registerInterface(PostLoginListener.class);  
64 - }  
65 -  
66 - /**  
67 - * @param joinGameListener  
68 - */  
69 - public void registerJoinGameListener(JoinGameListener joinGameListener)  
70 - {  
71 - this.joinGameListeners.add(joinGameListener);  
72 - }  
73 -  
74 - /**  
75 - * @param chatFilter  
76 - */  
77 - public void registerChatFilter(ChatFilter chatFilter)  
78 - {  
79 - this.chatFilters.add(chatFilter);  
80 - }  
81 -  
82 - /**  
83 - * @param chatListener  
84 - */  
85 - public void registerChatListener(ChatListener chatListener)  
86 - {  
87 - if (chatListener instanceof ChatFilter)  
88 - {  
89 - LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! Remove one of these interfaces", chatListener.getName());  
90 - }  
91 - else  
92 - {  
93 - this.chatListeners.add(chatListener);  
94 - }  
95 - }  
96 -  
97 - /**  
98 - * @param joinGameListener  
99 - */  
100 - public void registerPreJoinGameListener(PreJoinGameListener joinGameListener)  
101 - {  
102 - this.preJoinGameListeners.add(joinGameListener);  
103 - }  
104 -  
105 - /**  
106 - * @param postLoginListener  
107 - */  
108 - public void registerPostLoginListener(PostLoginListener postLoginListener)  
109 - {  
110 - this.postLoginListeners.add(postLoginListener);  
111 - }  
112 -  
113 - public static void onJoinRealm(EventInfo<RealmsMainScreen> e, long arg1, RealmsServer server)  
114 - {  
115 - PacketEventsClient.joiningRealm = server;  
116 - }  
117 -  
118 - @Override  
119 - protected IThreadListener getPacketContextListener(Packets.Context context)  
120 - {  
121 - if (context == Packets.Context.SERVER)  
122 - {  
123 - return MinecraftServer.getServer();  
124 - }  
125 -  
126 - return Minecraft.getMinecraft();  
127 - }  
128 -  
129 - /* (non-Javadoc)  
130 - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S01PacketJoinGame)  
131 - */  
132 - @Override  
133 - protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet)  
134 - {  
135 - if (this.preJoinGame(e, netHandler, packet))  
136 - {  
137 - return;  
138 - }  
139 -  
140 - ((INetHandlerPlayClient)netHandler).handleJoinGame(packet);  
141 - super.handlePacket(e, netHandler, packet);  
142 -  
143 - this.postJoinGame(e, netHandler, packet);  
144 - }  
145 -  
146 - /**  
147 - * @param e  
148 - * @param netHandler  
149 - * @param packet  
150 - * @throws EventCancellationException  
151 - */  
152 - private boolean preJoinGame(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet) throws EventCancellationException  
153 - {  
154 - if (!(netHandler instanceof INetHandlerPlayClient))  
155 - {  
156 - return true;  
157 - }  
158 -  
159 - e.cancel();  
160 -  
161 - return !this.preJoinGameListeners.all().onPreJoinGame(netHandler, packet);  
162 - }  
163 -  
164 - /**  
165 - * @param e  
166 - * @param netHandler  
167 - * @param packet  
168 - */  
169 - private void postJoinGame(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet)  
170 - {  
171 - this.joinGameListeners.all().onJoinGame(netHandler, packet, Minecraft.getMinecraft().getCurrentServerData(), PacketEventsClient.joiningRealm);  
172 - PacketEventsClient.joiningRealm = null;  
173 -  
174 - ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();  
175 - if (clientPluginChannels instanceof ClientPluginChannelsClient)  
176 - {  
177 - ((ClientPluginChannelsClient)clientPluginChannels).onJoinGame(netHandler, packet);  
178 - }  
179 - }  
180 -  
181 - /* (non-Javadoc)  
182 - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.login.server.S02PacketLoginSuccess)  
183 - */  
184 - @Override  
185 - protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketLoginSuccess packet)  
186 - {  
187 - if (netHandler instanceof INetHandlerLoginClient)  
188 - {  
189 - INetHandlerLoginClient netHandlerLoginClient = (INetHandlerLoginClient)netHandler;  
190 -  
191 - ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();  
192 - if (clientPluginChannels instanceof ClientPluginChannelsClient)  
193 - {  
194 - ((ClientPluginChannelsClient)clientPluginChannels).onPostLogin(netHandlerLoginClient, packet);  
195 - }  
196 -  
197 - this.postLoginListeners.all().onPostLogin(netHandlerLoginClient, packet);  
198 - }  
199 - }  
200 -  
201 - /* (non-Javadoc)  
202 - * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S02PacketChat)  
203 - */  
204 - @Override  
205 - protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketChat packet)  
206 - {  
207 - if (packet.getChatComponent() == null)  
208 - return;  
209 -  
210 - IChatComponent originalChat = packet.getChatComponent();  
211 - IChatComponent chat = originalChat;  
212 - String message = chat.getFormattedText();  
213 -  
214 - // Chat filters get a stab at the chat first, if any filter returns false the chat is discarded  
215 - for (ChatFilter chatFilter : this.chatFilters)  
216 - {  
217 - ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>();  
218 -  
219 - if (chatFilter.onChat(chat, message, ret))  
220 - {  
221 - if (ret.isSet())  
222 - {  
223 - chat = ret.get();  
224 - if (chat == null)  
225 - {  
226 - chat = new ChatComponentText("");  
227 - }  
228 - message = chat.getFormattedText();  
229 - }  
230 - }  
231 - else  
232 - {  
233 - e.cancel();  
234 - return;  
235 - }  
236 - }  
237 -  
238 - if (chat != originalChat)  
239 - {  
240 - try  
241 - {  
242 - chat = ChatUtilities.convertLegacyCodes(chat);  
243 - PrivateFieldsClient.chatMessage.set(packet, chat);  
244 - }  
245 - catch (Exception ex)  
246 - {  
247 - ex.printStackTrace();  
248 - }  
249 - }  
250 -  
251 - // Chat listeners get the chat if no filter removed it  
252 - this.chatListeners.all().onChat(chat, message);  
253 - } 46 + private static RealmsServer joiningRealm;
  47 +
  48 + private FastIterableDeque<JoinGameListener> joinGameListeners = new HandlerList<JoinGameListener>(JoinGameListener.class);
  49 + private FastIterableDeque<ChatListener> chatListeners = new HandlerList<ChatListener>(ChatListener.class);
  50 + private FastIterableDeque<ChatFilter> chatFilters = new HandlerList<ChatFilter>(ChatFilter.class, ReturnLogicOp.AND_BREAK_ON_FALSE);
  51 + private FastIterableDeque<PreJoinGameListener> preJoinGameListeners = new HandlerList<PreJoinGameListener>(PreJoinGameListener.class, ReturnLogicOp.AND_BREAK_ON_FALSE);
  52 + private FastIterableDeque<PostLoginListener> postLoginListeners = new HandlerList<PostLoginListener>(PostLoginListener.class);
  53 +
  54 + @Override
  55 + public void registerInterfaces(InterfaceRegistrationDelegate delegate)
  56 + {
  57 + super.registerInterfaces(delegate);
  58 +
  59 + delegate.registerInterface(JoinGameListener.class);
  60 + delegate.registerInterface(ChatListener.class);
  61 + delegate.registerInterface(ChatFilter.class);
  62 + delegate.registerInterface(PreJoinGameListener.class);
  63 + delegate.registerInterface(PostLoginListener.class);
  64 + }
  65 +
  66 + /**
  67 + * @param joinGameListener
  68 + */
  69 + public void registerJoinGameListener(JoinGameListener joinGameListener)
  70 + {
  71 + this.joinGameListeners.add(joinGameListener);
  72 + }
  73 +
  74 + /**
  75 + * @param chatFilter
  76 + */
  77 + public void registerChatFilter(ChatFilter chatFilter)
  78 + {
  79 + this.chatFilters.add(chatFilter);
  80 + }
  81 +
  82 + /**
  83 + * @param chatListener
  84 + */
  85 + public void registerChatListener(ChatListener chatListener)
  86 + {
  87 + if (chatListener instanceof ChatFilter)
  88 + {
  89 + LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! Remove one of these interfaces", chatListener.getName());
  90 + }
  91 + else
  92 + {
  93 + this.chatListeners.add(chatListener);
  94 + }
  95 + }
  96 +
  97 + /**
  98 + * @param joinGameListener
  99 + */
  100 + public void registerPreJoinGameListener(PreJoinGameListener joinGameListener)
  101 + {
  102 + this.preJoinGameListeners.add(joinGameListener);
  103 + }
  104 +
  105 + /**
  106 + * @param postLoginListener
  107 + */
  108 + public void registerPostLoginListener(PostLoginListener postLoginListener)
  109 + {
  110 + this.postLoginListeners.add(postLoginListener);
  111 + }
  112 +
  113 + public static void onJoinRealm(EventInfo<RealmsMainScreen> e, long arg1, RealmsServer server)
  114 + {
  115 + PacketEventsClient.joiningRealm = server;
  116 + }
  117 +
  118 + @Override
  119 + protected IThreadListener getPacketContextListener(Packets.Context context)
  120 + {
  121 + if (context == Packets.Context.SERVER)
  122 + {
  123 + return MinecraftServer.getServer();
  124 + }
  125 +
  126 + return Minecraft.getMinecraft();
  127 + }
  128 +
  129 + /* (non-Javadoc)
  130 + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S01PacketJoinGame)
  131 + */
  132 + @Override
  133 + protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet)
  134 + {
  135 + if (this.preJoinGame(e, netHandler, packet))
  136 + {
  137 + return;
  138 + }
  139 +
  140 + ((INetHandlerPlayClient)netHandler).handleJoinGame(packet);
  141 + super.handlePacket(e, netHandler, packet);
  142 +
  143 + this.postJoinGame(e, netHandler, packet);
  144 + }
  145 +
  146 + /**
  147 + * @param e
  148 + * @param netHandler
  149 + * @param packet
  150 + * @throws EventCancellationException
  151 + */
  152 + private boolean preJoinGame(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet) throws EventCancellationException
  153 + {
  154 + if (!(netHandler instanceof INetHandlerPlayClient))
  155 + {
  156 + return true;
  157 + }
  158 +
  159 + e.cancel();
  160 +
  161 + return !this.preJoinGameListeners.all().onPreJoinGame(netHandler, packet);
  162 + }
  163 +
  164 + /**
  165 + * @param e
  166 + * @param netHandler
  167 + * @param packet
  168 + */
  169 + private void postJoinGame(PacketEventInfo<Packet> e, INetHandler netHandler, S01PacketJoinGame packet)
  170 + {
  171 + this.joinGameListeners.all().onJoinGame(netHandler, packet, Minecraft.getMinecraft().getCurrentServerData(), PacketEventsClient.joiningRealm);
  172 + PacketEventsClient.joiningRealm = null;
  173 +
  174 + ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();
  175 + if (clientPluginChannels instanceof ClientPluginChannelsClient)
  176 + {
  177 + ((ClientPluginChannelsClient)clientPluginChannels).onJoinGame(netHandler, packet);
  178 + }
  179 + }
  180 +
  181 + /* (non-Javadoc)
  182 + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.login.server.S02PacketLoginSuccess)
  183 + */
  184 + @Override
  185 + protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketLoginSuccess packet)
  186 + {
  187 + if (netHandler instanceof INetHandlerLoginClient)
  188 + {
  189 + INetHandlerLoginClient netHandlerLoginClient = (INetHandlerLoginClient)netHandler;
  190 +
  191 + ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();
  192 + if (clientPluginChannels instanceof ClientPluginChannelsClient)
  193 + {
  194 + ((ClientPluginChannelsClient)clientPluginChannels).onPostLogin(netHandlerLoginClient, packet);
  195 + }
  196 +
  197 + this.postLoginListeners.all().onPostLogin(netHandlerLoginClient, packet);
  198 + }
  199 + }
  200 +
  201 + /* (non-Javadoc)
  202 + * @see com.mumfrey.liteloader.core.PacketEvents#handlePacket(com.mumfrey.liteloader.common.transformers.PacketEventInfo, net.minecraft.network.INetHandler, net.minecraft.network.play.server.S02PacketChat)
  203 + */
  204 + @Override
  205 + protected void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler, S02PacketChat packet)
  206 + {
  207 + if (packet.getChatComponent() == null)
  208 + return;
  209 +
  210 + IChatComponent originalChat = packet.getChatComponent();
  211 + IChatComponent chat = originalChat;
  212 + String message = chat.getFormattedText();
  213 +
  214 + // Chat filters get a stab at the chat first, if any filter returns false the chat is discarded
  215 + for (ChatFilter chatFilter : this.chatFilters)
  216 + {
  217 + ReturnValue<IChatComponent> ret = new ReturnValue<IChatComponent>();
  218 +
  219 + if (chatFilter.onChat(chat, message, ret))
  220 + {
  221 + if (ret.isSet())
  222 + {
  223 + chat = ret.get();
  224 + if (chat == null)
  225 + {
  226 + chat = new ChatComponentText("");
  227 + }
  228 + message = chat.getFormattedText();
  229 + }
  230 + }
  231 + else
  232 + {
  233 + e.cancel();
  234 + return;
  235 + }
  236 + }
  237 +
  238 + if (chat != originalChat)
  239 + {
  240 + try
  241 + {
  242 + chat = ChatUtilities.convertLegacyCodes(chat);
  243 + PrivateFieldsClient.chatMessage.set(packet, chat);
  244 + }
  245 + catch (Exception ex)
  246 + {
  247 + ex.printStackTrace();
  248 + }
  249 + }
  250 +
  251 + // Chat listeners get the chat if no filter removed it
  252 + this.chatListeners.all().onChat(chat, message);
  253 + }
254 } 254 }
src/client/java/com/mumfrey/liteloader/client/ResourceObserver.java
@@ -24,92 +24,92 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -24,92 +24,92 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
24 */ 24 */
25 public class ResourceObserver implements ModLoadObserver 25 public class ResourceObserver implements ModLoadObserver
26 { 26 {
27 - private final Map<String, IResourcePack> resourcePacks = new HashMap<String, IResourcePack>();  
28 -  
29 - public ResourceObserver()  
30 - {  
31 - }  
32 -  
33 - @Override  
34 - public void onModLoaded(LiteMod mod)  
35 - {  
36 - }  
37 -  
38 - @SuppressWarnings("unchecked")  
39 - @Override  
40 - public void onPostModLoaded(ModInfo<LoadableMod<?>> handle)  
41 - {  
42 - if (!handle.hasContainer()) return;  
43 -  
44 - LoadableMod<?> container = handle.getContainer();  
45 - String modName = handle.getMod().getName();  
46 -  
47 - if (modName == null) return;  
48 -  
49 - if (container.hasResources())  
50 - {  
51 - LiteLoaderLogger.info("Adding \"%s\" to active resource pack set", container.getLocation());  
52 - IResourcePack resourcePack = this.initResourcePack(container, modName);  
53 - Resources<IResourceManager, IResourcePack> resources = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources();  
54 - if (resources.registerResourcePack(resourcePack))  
55 - {  
56 - LiteLoaderLogger.info("Successfully added \"%s\" to active resource pack set", container.getLocation());  
57 - }  
58 - }  
59 - }  
60 -  
61 - public IResourcePack initResourcePack(LoadableMod<?> container, String name)  
62 - {  
63 - IResourcePack resourcePack = this.getResourcePack(container);  
64 -  
65 - if (resourcePack == null)  
66 - {  
67 - if (container.isDirectory())  
68 - {  
69 - LiteLoaderLogger.info("Setting up \"%s/%s\" as mod resource pack with identifier \"%s\"", container.toFile().getParentFile().getName(), container.getName(), name);  
70 - resourcePack = new ModResourcePackDir(name, container.toFile());  
71 - }  
72 - else  
73 - {  
74 - LiteLoaderLogger.info("Setting up \"%s\" as mod resource pack with identifier \"%s\"", container.getName(), name);  
75 - resourcePack = new ModResourcePack(name, container.toFile());  
76 - }  
77 -  
78 - this.setResourcePack(container, resourcePack);  
79 - }  
80 -  
81 - return resourcePack;  
82 - }  
83 -  
84 - private IResourcePack getResourcePack(LoadableMod<?> container)  
85 - {  
86 - String path = container.getLocation();  
87 - return this.resourcePacks.get(path);  
88 - }  
89 -  
90 - private void setResourcePack(LoadableMod<?> container, IResourcePack resourcePack)  
91 - {  
92 - String path = container.getLocation();  
93 - this.resourcePacks.put(path, resourcePack);  
94 - }  
95 -  
96 - @Override  
97 - public void onModLoadFailed(LoadableMod<?> container, String identifier, String reason, Throwable th)  
98 - {  
99 - }  
100 -  
101 - @Override  
102 - public void onPreInitMod(LiteMod mod)  
103 - {  
104 - }  
105 -  
106 - @Override  
107 - public void onPostInitMod(LiteMod mod)  
108 - {  
109 - }  
110 -  
111 - @Override  
112 - public void onMigrateModConfig(LiteMod mod, File newConfigPath, File oldConfigPath)  
113 - {  
114 - } 27 + private final Map<String, IResourcePack> resourcePacks = new HashMap<String, IResourcePack>();
  28 +
  29 + public ResourceObserver()
  30 + {
  31 + }
  32 +
  33 + @Override
  34 + public void onModLoaded(LiteMod mod)
  35 + {
  36 + }
  37 +
  38 + @SuppressWarnings("unchecked")
  39 + @Override
  40 + public void onPostModLoaded(ModInfo<LoadableMod<?>> handle)
  41 + {
  42 + if (!handle.hasContainer()) return;
  43 +
  44 + LoadableMod<?> container = handle.getContainer();
  45 + String modName = handle.getMod().getName();
  46 +
  47 + if (modName == null) return;
  48 +
  49 + if (container.hasResources())
  50 + {
  51 + LiteLoaderLogger.info("Adding \"%s\" to active resource pack set", container.getLocation());
  52 + IResourcePack resourcePack = this.initResourcePack(container, modName);
  53 + Resources<IResourceManager, IResourcePack> resources = (Resources<IResourceManager, IResourcePack>)LiteLoader.getGameEngine().getResources();
  54 + if (resources.registerResourcePack(resourcePack))
  55 + {
  56 + LiteLoaderLogger.info("Successfully added \"%s\" to active resource pack set", container.getLocation());
  57 + }
  58 + }
  59 + }
  60 +
  61 + public IResourcePack initResourcePack(LoadableMod<?> container, String name)
  62 + {
  63 + IResourcePack resourcePack = this.getResourcePack(container);
  64 +
  65 + if (resourcePack == null)
  66 + {
  67 + if (container.isDirectory())
  68 + {
  69 + LiteLoaderLogger.info("Setting up \"%s/%s\" as mod resource pack with identifier \"%s\"", container.toFile().getParentFile().getName(), container.getName(), name);
  70 + resourcePack = new ModResourcePackDir(name, container.toFile());
  71 + }
  72 + else
  73 + {
  74 + LiteLoaderLogger.info("Setting up \"%s\" as mod resource pack with identifier \"%s\"", container.getName(), name);
  75 + resourcePack = new ModResourcePack(name, container.toFile());
  76 + }
  77 +
  78 + this.setResourcePack(container, resourcePack);
  79 + }
  80 +
  81 + return resourcePack;
  82 + }
  83 +
  84 + private IResourcePack getResourcePack(LoadableMod<?> container)
  85 + {
  86 + String path = container.getLocation();
  87 + return this.resourcePacks.get(path);
  88 + }
  89 +
  90 + private void setResourcePack(LoadableMod<?> container, IResourcePack resourcePack)
  91 + {
  92 + String path = container.getLocation();
  93 + this.resourcePacks.put(path, resourcePack);
  94 + }
  95 +
  96 + @Override
  97 + public void onModLoadFailed(LoadableMod<?> container, String identifier, String reason, Throwable th)
  98 + {
  99 + }
  100 +
  101 + @Override
  102 + public void onPreInitMod(LiteMod mod)
  103 + {
  104 + }
  105 +
  106 + @Override
  107 + public void onPostInitMod(LiteMod mod)
  108 + {
  109 + }
  110 +
  111 + @Override
  112 + public void onMigrateModConfig(LiteMod mod, File newConfigPath, File oldConfigPath)
  113 + {
  114 + }
115 } 115 }
src/client/java/com/mumfrey/liteloader/client/ResourcesClient.java
@@ -14,79 +14,79 @@ import com.mumfrey.liteloader.common.Resources; @@ -14,79 +14,79 @@ import com.mumfrey.liteloader.common.Resources;
14 14
15 public class ResourcesClient implements Resources<IResourceManager, IResourcePack> 15 public class ResourcesClient implements Resources<IResourceManager, IResourcePack>
16 { 16 {
17 - private final Minecraft engine = Minecraft.getMinecraft();  
18 -  
19 - /**  
20 - * Registered resource packs  
21 - */  
22 - private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>(); 17 + private final Minecraft engine = Minecraft.getMinecraft();
23 18
24 - /**  
25 - * True while initialising mods if we need to do a resource manager reload once the process is completed  
26 - */  
27 - private boolean pendingResourceReload; 19 + /**
  20 + * Registered resource packs
  21 + */
  22 + private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>();
28 23
29 - /* (non-Javadoc)  
30 - * @see com.mumfrey.liteloader.common.GameEngine#refreshResources(boolean)  
31 - */  
32 - @Override  
33 - public void refreshResources(boolean force)  
34 - {  
35 - if (this.pendingResourceReload || force)  
36 - {  
37 - LoadingProgress.setMessage("Reloading Resources...");  
38 - this.pendingResourceReload = false;  
39 - this.engine.refreshResources();  
40 - }  
41 - } 24 + /**
  25 + * True while initialising mods if we need to do a resource manager reload once the process is completed
  26 + */
  27 + private boolean pendingResourceReload;
42 28
43 - /* (non-Javadoc)  
44 - * @see com.mumfrey.liteloader.common.GameEngine#getResourceManager()  
45 - */  
46 - @Override  
47 - public IResourceManager getResourceManager()  
48 - {  
49 - return this.engine.getResourceManager();  
50 - }  
51 -  
52 - /* (non-Javadoc)  
53 - * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack(net.minecraft.client.resources.IResourcePack)  
54 - */  
55 - @Override  
56 - public boolean registerResourcePack(IResourcePack resourcePack)  
57 - {  
58 - if (!this.registeredResourcePacks.containsKey(resourcePack.getPackName()))  
59 - {  
60 - this.pendingResourceReload = true; 29 + /* (non-Javadoc)
  30 + * @see com.mumfrey.liteloader.common.GameEngine#refreshResources(boolean)
  31 + */
  32 + @Override
  33 + public void refreshResources(boolean force)
  34 + {
  35 + if (this.pendingResourceReload || force)
  36 + {
  37 + LoadingProgress.setMessage("Reloading Resources...");
  38 + this.pendingResourceReload = false;
  39 + this.engine.refreshResources();
  40 + }
  41 + }
61 42
62 - List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();  
63 - if (!defaultResourcePacks.contains(resourcePack))  
64 - {  
65 - defaultResourcePacks.add(resourcePack);  
66 - this.registeredResourcePacks.put(resourcePack.getPackName(), resourcePack);  
67 - return true;  
68 - }  
69 - }  
70 -  
71 - return false;  
72 - }  
73 -  
74 - /* (non-Javadoc)  
75 - * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack(net.minecraft.client.resources.IResourcePack)  
76 - */  
77 - @Override  
78 - public boolean unRegisterResourcePack(IResourcePack resourcePack)  
79 - {  
80 - if (this.registeredResourcePacks.containsValue(resourcePack))  
81 - {  
82 - this.pendingResourceReload = true; 43 + /* (non-Javadoc)
  44 + * @see com.mumfrey.liteloader.common.GameEngine#getResourceManager()
  45 + */
  46 + @Override
  47 + public IResourceManager getResourceManager()
  48 + {
  49 + return this.engine.getResourceManager();
  50 + }
83 51
84 - List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();  
85 - this.registeredResourcePacks.remove(resourcePack.getPackName());  
86 - defaultResourcePacks.remove(resourcePack);  
87 - return true;  
88 - }  
89 -  
90 - return false;  
91 - } 52 + /* (non-Javadoc)
  53 + * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack(net.minecraft.client.resources.IResourcePack)
  54 + */
  55 + @Override
  56 + public boolean registerResourcePack(IResourcePack resourcePack)
  57 + {
  58 + if (!this.registeredResourcePacks.containsKey(resourcePack.getPackName()))
  59 + {
  60 + this.pendingResourceReload = true;
  61 +
  62 + List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();
  63 + if (!defaultResourcePacks.contains(resourcePack))
  64 + {
  65 + defaultResourcePacks.add(resourcePack);
  66 + this.registeredResourcePacks.put(resourcePack.getPackName(), resourcePack);
  67 + return true;
  68 + }
  69 + }
  70 +
  71 + return false;
  72 + }
  73 +
  74 + /* (non-Javadoc)
  75 + * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack(net.minecraft.client.resources.IResourcePack)
  76 + */
  77 + @Override
  78 + public boolean unRegisterResourcePack(IResourcePack resourcePack)
  79 + {
  80 + if (this.registeredResourcePacks.containsValue(resourcePack))
  81 + {
  82 + this.pendingResourceReload = true;
  83 +
  84 + List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();
  85 + this.registeredResourcePacks.remove(resourcePack.getPackName());
  86 + defaultResourcePacks.remove(resourcePack);
  87 + return true;
  88 + }
  89 +
  90 + return false;
  91 + }
92 } 92 }
src/client/java/com/mumfrey/liteloader/client/SoundHandlerReloadInhibitor.java
@@ -16,112 +16,112 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -16,112 +16,112 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
16 */ 16 */
17 public class SoundHandlerReloadInhibitor 17 public class SoundHandlerReloadInhibitor
18 { 18 {
19 - /**  
20 - * Resource Manager  
21 - */  
22 - private SimpleReloadableResourceManager resourceManager;  
23 -  
24 - /**  
25 - * Sound manager  
26 - */  
27 - private SoundHandler soundHandler;  
28 -  
29 - /**  
30 - * True if inhibition is currently active  
31 - */  
32 - private boolean inhibited;  
33 -  
34 - /**  
35 - * So that we can re-insert the sound manager at the same index, we store the index we remove it from  
36 - */  
37 - private int storedIndex;  
38 -  
39 - SoundHandlerReloadInhibitor(SimpleReloadableResourceManager resourceManager, SoundHandler soundHandler)  
40 - {  
41 - this.resourceManager = resourceManager;  
42 - this.soundHandler = soundHandler;  
43 - }  
44 -  
45 - /**  
46 - * Inhibit the sound manager reload notification  
47 - *  
48 - * @return true if inhibit was applied  
49 - */  
50 - public boolean inhibit()  
51 - {  
52 - try  
53 - {  
54 - if (!this.inhibited)  
55 - {  
56 - List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);  
57 - if (reloadListeners != null)  
58 - {  
59 - this.storedIndex = reloadListeners.indexOf(this.soundHandler);  
60 - if (this.storedIndex > -1)  
61 - {  
62 - LiteLoaderLogger.info("Inhibiting sound handler reload");  
63 - reloadListeners.remove(this.soundHandler);  
64 - this.inhibited = true;  
65 - return true;  
66 - }  
67 - }  
68 - }  
69 - }  
70 - catch (Exception ex)  
71 - {  
72 - LiteLoaderLogger.warning("Error inhibiting sound handler reload");  
73 - }  
74 -  
75 - return false;  
76 - }  
77 -  
78 - /**  
79 - * Remove the sound manager reload inhibit  
80 - *  
81 - * @param reload True to reload the sound manager now  
82 - * @return true if the sound manager was successfully restored  
83 - */  
84 - public boolean unInhibit(boolean reload)  
85 - {  
86 - try  
87 - {  
88 - if (this.inhibited)  
89 - {  
90 - List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);  
91 - if (reloadListeners != null)  
92 - {  
93 - if (this.storedIndex > -1)  
94 - {  
95 - reloadListeners.add(this.storedIndex, this.soundHandler);  
96 - }  
97 - else  
98 - {  
99 - reloadListeners.add(this.soundHandler);  
100 - }  
101 -  
102 - LiteLoaderLogger.info("Sound handler reload inhibit removed");  
103 -  
104 - if (reload)  
105 - {  
106 - LiteLoaderLogger.info("Reloading sound handler");  
107 - this.soundHandler.onResourceManagerReload(this.resourceManager);  
108 - }  
109 -  
110 - this.inhibited = false;  
111 - return true;  
112 - }  
113 - }  
114 - }  
115 - catch (Exception ex)  
116 - {  
117 - LiteLoaderLogger.warning("Error removing sound handler reload inhibit");  
118 - }  
119 -  
120 - return false;  
121 - }  
122 -  
123 - public boolean isInhibited()  
124 - {  
125 - return this.inhibited;  
126 - } 19 + /**
  20 + * Resource Manager
  21 + */
  22 + private SimpleReloadableResourceManager resourceManager;
  23 +
  24 + /**
  25 + * Sound manager
  26 + */
  27 + private SoundHandler soundHandler;
  28 +
  29 + /**
  30 + * True if inhibition is currently active
  31 + */
  32 + private boolean inhibited;
  33 +
  34 + /**
  35 + * So that we can re-insert the sound manager at the same index, we store the index we remove it from
  36 + */
  37 + private int storedIndex;
  38 +
  39 + SoundHandlerReloadInhibitor(SimpleReloadableResourceManager resourceManager, SoundHandler soundHandler)
  40 + {
  41 + this.resourceManager = resourceManager;
  42 + this.soundHandler = soundHandler;
  43 + }
  44 +
  45 + /**
  46 + * Inhibit the sound manager reload notification
  47 + *
  48 + * @return true if inhibit was applied
  49 + */
  50 + public boolean inhibit()
  51 + {
  52 + try
  53 + {
  54 + if (!this.inhibited)
  55 + {
  56 + List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);
  57 + if (reloadListeners != null)
  58 + {
  59 + this.storedIndex = reloadListeners.indexOf(this.soundHandler);
  60 + if (this.storedIndex > -1)
  61 + {
  62 + LiteLoaderLogger.info("Inhibiting sound handler reload");
  63 + reloadListeners.remove(this.soundHandler);
  64 + this.inhibited = true;
  65 + return true;
  66 + }
  67 + }
  68 + }
  69 + }
  70 + catch (Exception ex)
  71 + {
  72 + LiteLoaderLogger.warning("Error inhibiting sound handler reload");
  73 + }
  74 +
  75 + return false;
  76 + }
  77 +
  78 + /**
  79 + * Remove the sound manager reload inhibit
  80 + *
  81 + * @param reload True to reload the sound manager now
  82 + * @return true if the sound manager was successfully restored
  83 + */
  84 + public boolean unInhibit(boolean reload)
  85 + {
  86 + try
  87 + {
  88 + if (this.inhibited)
  89 + {
  90 + List<IResourceManagerReloadListener> reloadListeners = PrivateFieldsClient.reloadListeners.get(this.resourceManager);
  91 + if (reloadListeners != null)
  92 + {
  93 + if (this.storedIndex > -1)
  94 + {
  95 + reloadListeners.add(this.storedIndex, this.soundHandler);
  96 + }
  97 + else
  98 + {
  99 + reloadListeners.add(this.soundHandler);
  100 + }
  101 +
  102 + LiteLoaderLogger.info("Sound handler reload inhibit removed");
  103 +
  104 + if (reload)
  105 + {
  106 + LiteLoaderLogger.info("Reloading sound handler");
  107 + this.soundHandler.onResourceManagerReload(this.resourceManager);
  108 + }
  109 +
  110 + this.inhibited = false;
  111 + return true;
  112 + }
  113 + }
  114 + }
  115 + catch (Exception ex)
  116 + {
  117 + LiteLoaderLogger.warning("Error removing sound handler reload inhibit");
  118 + }
  119 +
  120 + return false;
  121 + }
  122 +
  123 + public boolean isInhibited()
  124 + {
  125 + return this.inhibited;
  126 + }
127 } 127 }
src/client/java/com/mumfrey/liteloader/client/Translator.java
@@ -6,23 +6,23 @@ import com.mumfrey.liteloader.api.TranslationProvider; @@ -6,23 +6,23 @@ import com.mumfrey.liteloader.api.TranslationProvider;
6 6
7 public class Translator implements TranslationProvider 7 public class Translator implements TranslationProvider
8 { 8 {
9 - /* (non-Javadoc)  
10 - * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.Object[])  
11 - */  
12 - @Override  
13 - public String translate(String key, Object... args)  
14 - {  
15 - // TODO doesn't currently honour the contract of TranslationProvider::translate, should return null if translation is missing  
16 - return I18n.format(key, args);  
17 - }  
18 -  
19 - /* (non-Javadoc)  
20 - * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.String, java.lang.Object[])  
21 - */  
22 - @Override  
23 - public String translate(String locale, String key, Object... args)  
24 - {  
25 - // TODO doesn't currently honour the contract of TranslationProvider::translate, should return null if translation is missing  
26 - return I18n.format(key, args);  
27 - } 9 + /* (non-Javadoc)
  10 + * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.Object[])
  11 + */
  12 + @Override
  13 + public String translate(String key, Object... args)
  14 + {
  15 + // TODO doesn't currently honour the contract of TranslationProvider::translate, should return null if translation is missing
  16 + return I18n.format(key, args);
  17 + }
  18 +
  19 + /* (non-Javadoc)
  20 + * @see com.mumfrey.liteloader.api.TranslationProvider#translate(java.lang.String, java.lang.String, java.lang.Object[])
  21 + */
  22 + @Override
  23 + public String translate(String locale, String key, Object... args)
  24 + {
  25 + // TODO doesn't currently honour the contract of TranslationProvider::translate, should return null if translation is missing
  26 + return I18n.format(key, args);
  27 + }
28 } 28 }
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderBrandingProvider.java
@@ -17,120 +17,120 @@ import com.mumfrey.liteloader.util.render.Icon; @@ -17,120 +17,120 @@ import com.mumfrey.liteloader.util.render.Icon;
17 */ 17 */
18 public class LiteLoaderBrandingProvider implements BrandingProvider 18 public class LiteLoaderBrandingProvider implements BrandingProvider
19 { 19 {
20 - public static final int BRANDING_COLOUR = 0xFF4785D1;  
21 -  
22 - public static final ResourceLocation ABOUT_TEXTURE = new ResourceLocation("liteloader", "textures/gui/about.png");  
23 - public static final IconAbsolute LOGO_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "logo", 128, 40, 0, 0, 256, 80);  
24 - public static final IconAbsolute ICON_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "chicken", 32, 45, 0, 80, 64, 170);  
25 - public static final IconAbsolute TWITTER_AVATAR_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "twitter_avatar", 32, 32, 192, 80, 256, 144);  
26 -  
27 - public static final URI LITELOADER_URI = URI.create("http://www.liteloader.com/");  
28 -  
29 - /* (non-Javadoc)  
30 - * @see com.mumfrey.liteloader.api.BrandingProvider#getPriority()  
31 - */  
32 - @Override  
33 - public int getPriority()  
34 - {  
35 - return -1000;  
36 - }  
37 -  
38 - /* (non-Javadoc)  
39 - * @see com.mumfrey.liteloader.api.BrandingProvider#getDisplayName()  
40 - */  
41 - @Override  
42 - public String getDisplayName()  
43 - {  
44 - return "LiteLoader " + I18n.format("gui.about.versiontext", LiteLoader.getVersion());  
45 - }  
46 -  
47 - /* (non-Javadoc)  
48 - * @see com.mumfrey.liteloader.api.BrandingProvider#getCopyrightText()  
49 - */  
50 - @Override  
51 - public String getCopyrightText()  
52 - {  
53 - return "Copyright (c) 2012-2014 Adam Mummery-Smith";  
54 - }  
55 -  
56 - /* (non-Javadoc)  
57 - * @see com.mumfrey.liteloader.api.BrandingProvider#getHomepage()  
58 - */  
59 - @Override  
60 - public URI getHomepage()  
61 - {  
62 - return LiteLoaderBrandingProvider.LITELOADER_URI;  
63 - }  
64 -  
65 - /* (non-Javadoc)  
66 - * @see com.mumfrey.liteloader.api.BrandingProvider#getBrandingColour()  
67 - */  
68 - @Override  
69 - public int getBrandingColour()  
70 - {  
71 - return LiteLoaderBrandingProvider.BRANDING_COLOUR;  
72 - }  
73 -  
74 - /* (non-Javadoc)  
75 - * @see com.mumfrey.liteloader.api.BrandingProvider#getLogoResource()  
76 - */  
77 - @Override  
78 - public ResourceLocation getLogoResource()  
79 - {  
80 - return LiteLoaderBrandingProvider.ABOUT_TEXTURE;  
81 - }  
82 -  
83 - /* (non-Javadoc)  
84 - * @see com.mumfrey.liteloader.api.BrandingProvider#getLogoCoords()  
85 - */  
86 - @Override  
87 - public Icon getLogoCoords()  
88 - {  
89 - return LiteLoaderBrandingProvider.LOGO_COORDS;  
90 - }  
91 -  
92 - /* (non-Javadoc)  
93 - * @see com.mumfrey.liteloader.api.BrandingProvider#getIconResource()  
94 - */  
95 - @Override  
96 - public ResourceLocation getIconResource()  
97 - {  
98 - return LiteLoaderBrandingProvider.ABOUT_TEXTURE;  
99 - }  
100 -  
101 - /* (non-Javadoc)  
102 - * @see com.mumfrey.liteloader.api.BrandingProvider#getIconCoords()  
103 - */  
104 - @Override  
105 - public Icon getIconCoords()  
106 - {  
107 - return LiteLoaderBrandingProvider.ICON_COORDS;  
108 - }  
109 -  
110 - /* (non-Javadoc)  
111 - * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterUserName()  
112 - */  
113 - @Override  
114 - public String getTwitterUserName()  
115 - {  
116 - return "therealeq2";  
117 - }  
118 -  
119 - /* (non-Javadoc)  
120 - * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarResource()  
121 - */  
122 - @Override  
123 - public ResourceLocation getTwitterAvatarResource()  
124 - {  
125 - return LiteLoaderBrandingProvider.ABOUT_TEXTURE;  
126 - }  
127 -  
128 - /* (non-Javadoc)  
129 - * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarCoords()  
130 - */  
131 - @Override  
132 - public Icon getTwitterAvatarCoords()  
133 - {  
134 - return LiteLoaderBrandingProvider.TWITTER_AVATAR_COORDS;  
135 - } 20 + public static final int BRANDING_COLOUR = 0xFF4785D1;
  21 +
  22 + public static final ResourceLocation ABOUT_TEXTURE = new ResourceLocation("liteloader", "textures/gui/about.png");
  23 + public static final IconAbsolute LOGO_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "logo", 128, 40, 0, 0, 256, 80);
  24 + public static final IconAbsolute ICON_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "chicken", 32, 45, 0, 80, 64, 170);
  25 + public static final IconAbsolute TWITTER_AVATAR_COORDS = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "twitter_avatar", 32, 32, 192, 80, 256, 144);
  26 +
  27 + public static final URI LITELOADER_URI = URI.create("http://www.liteloader.com/");
  28 +
  29 + /* (non-Javadoc)
  30 + * @see com.mumfrey.liteloader.api.BrandingProvider#getPriority()
  31 + */
  32 + @Override
  33 + public int getPriority()
  34 + {
  35 + return -1000;
  36 + }
  37 +
  38 + /* (non-Javadoc)
  39 + * @see com.mumfrey.liteloader.api.BrandingProvider#getDisplayName()
  40 + */
  41 + @Override
  42 + public String getDisplayName()
  43 + {
  44 + return "LiteLoader " + I18n.format("gui.about.versiontext", LiteLoader.getVersion());
  45 + }
  46 +
  47 + /* (non-Javadoc)
  48 + * @see com.mumfrey.liteloader.api.BrandingProvider#getCopyrightText()
  49 + */
  50 + @Override
  51 + public String getCopyrightText()
  52 + {
  53 + return "Copyright (c) 2012-2014 Adam Mummery-Smith";
  54 + }
  55 +
  56 + /* (non-Javadoc)
  57 + * @see com.mumfrey.liteloader.api.BrandingProvider#getHomepage()
  58 + */
  59 + @Override
  60 + public URI getHomepage()
  61 + {
  62 + return LiteLoaderBrandingProvider.LITELOADER_URI;
  63 + }
  64 +
  65 + /* (non-Javadoc)
  66 + * @see com.mumfrey.liteloader.api.BrandingProvider#getBrandingColour()
  67 + */
  68 + @Override
  69 + public int getBrandingColour()
  70 + {
  71 + return LiteLoaderBrandingProvider.BRANDING_COLOUR;
  72 + }
  73 +
  74 + /* (non-Javadoc)
  75 + * @see com.mumfrey.liteloader.api.BrandingProvider#getLogoResource()
  76 + */
  77 + @Override
  78 + public ResourceLocation getLogoResource()
  79 + {
  80 + return LiteLoaderBrandingProvider.ABOUT_TEXTURE;
  81 + }
  82 +
  83 + /* (non-Javadoc)
  84 + * @see com.mumfrey.liteloader.api.BrandingProvider#getLogoCoords()
  85 + */
  86 + @Override
  87 + public Icon getLogoCoords()
  88 + {
  89 + return LiteLoaderBrandingProvider.LOGO_COORDS;
  90 + }
  91 +
  92 + /* (non-Javadoc)
  93 + * @see com.mumfrey.liteloader.api.BrandingProvider#getIconResource()
  94 + */
  95 + @Override
  96 + public ResourceLocation getIconResource()
  97 + {
  98 + return LiteLoaderBrandingProvider.ABOUT_TEXTURE;
  99 + }
  100 +
  101 + /* (non-Javadoc)
  102 + * @see com.mumfrey.liteloader.api.BrandingProvider#getIconCoords()
  103 + */
  104 + @Override
  105 + public Icon getIconCoords()
  106 + {
  107 + return LiteLoaderBrandingProvider.ICON_COORDS;
  108 + }
  109 +
  110 + /* (non-Javadoc)
  111 + * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterUserName()
  112 + */
  113 + @Override
  114 + public String getTwitterUserName()
  115 + {
  116 + return "therealeq2";
  117 + }
  118 +
  119 + /* (non-Javadoc)
  120 + * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarResource()
  121 + */
  122 + @Override
  123 + public ResourceLocation getTwitterAvatarResource()
  124 + {
  125 + return LiteLoaderBrandingProvider.ABOUT_TEXTURE;
  126 + }
  127 +
  128 + /* (non-Javadoc)
  129 + * @see com.mumfrey.liteloader.api.BrandingProvider#getTwitterAvatarCoords()
  130 + */
  131 + @Override
  132 + public Icon getTwitterAvatarCoords()
  133 + {
  134 + return LiteLoaderBrandingProvider.TWITTER_AVATAR_COORDS;
  135 + }
136 } 136 }
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java
@@ -26,126 +26,126 @@ import com.mumfrey.liteloader.transformers.event.json.ModEvents; @@ -26,126 +26,126 @@ import com.mumfrey.liteloader.transformers.event.json.ModEvents;
26 */ 26 */
27 public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI 27 public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
28 { 28 {
29 - private static final String PKG_LITELOADER_CLIENT = LiteLoaderCoreAPI.PKG_LITELOADER + ".client";  
30 -  
31 - private static final String[] requiredTransformers = {  
32 - LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.EventProxyTransformer",  
33 - LiteLoaderCoreAPI.PKG_LITELOADER + ".launch.LiteLoaderTransformer",  
34 - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.CrashReportTransformer"  
35 - };  
36 -  
37 - private static final String[] requiredDownstreamTransformers = {  
38 - LiteLoaderCoreAPI.PKG_LITELOADER_COMMON + ".transformers.LiteLoaderPacketTransformer",  
39 - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",  
40 - LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftTransformer",  
41 - LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.json.ModEventInjectionTransformer"  
42 - };  
43 -  
44 - private ObjectFactory<Minecraft, IntegratedServer> objectFactory;  
45 -  
46 - /* (non-Javadoc)  
47 - * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers()  
48 - */  
49 - @Override  
50 - public String[] getRequiredTransformers()  
51 - {  
52 - return LiteLoaderCoreAPIClient.requiredTransformers;  
53 - }  
54 -  
55 - /* (non-Javadoc)  
56 - * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredDownstreamTransformers()  
57 - */  
58 - @Override  
59 - public String[] getRequiredDownstreamTransformers()  
60 - {  
61 - return LiteLoaderCoreAPIClient.requiredDownstreamTransformers;  
62 - }  
63 -  
64 - /* (non-Javadoc)  
65 - * @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders()  
66 - */  
67 - @Override  
68 - public List<CustomisationProvider> getCustomisationProviders()  
69 - {  
70 - return ImmutableList.<CustomisationProvider>of  
71 - (  
72 - new LiteLoaderBrandingProvider(),  
73 - new LiteLoaderModInfoDecorator(),  
74 - new Translator()  
75 - );  
76 - }  
77 -  
78 - /* (non-Javadoc)  
79 - * @see com.mumfrey.liteloader.api.LiteAPI#getCoreProviders()  
80 - */  
81 - @Override  
82 - public List<CoreProvider> getCoreProviders()  
83 - {  
84 - return ImmutableList.<CoreProvider>of  
85 - (  
86 - new LiteLoaderCoreProviderClient(this.properties),  
87 - LiteLoader.getInput()  
88 - );  
89 - }  
90 -  
91 -  
92 - /* (non-Javadoc)  
93 - * @see com.mumfrey.liteloader.api.LiteAPI#getInterfaceProviders()  
94 - */  
95 - @Override  
96 - public List<InterfaceProvider> getInterfaceProviders()  
97 - {  
98 - ObjectFactory<?, ?> objectFactory = this.getObjectFactory();  
99 -  
100 - return ImmutableList.<InterfaceProvider>of  
101 - (  
102 - objectFactory.getEventBroker(),  
103 - objectFactory.getPacketEventBroker(),  
104 - objectFactory.getClientPluginChannels(),  
105 - objectFactory.getServerPluginChannels(),  
106 - MessageBus.getInstance()  
107 - );  
108 - }  
109 -  
110 - /* (non-Javadoc)  
111 - * @see com.mumfrey.liteloader.api.LiteAPI#getPreInitObservers()  
112 - */  
113 - @Override  
114 - public List<Observer> getPreInitObservers()  
115 - {  
116 - return ImmutableList.<Observer>of  
117 - (  
118 - new ModEvents()  
119 - );  
120 - }  
121 -  
122 - /* (non-Javadoc)  
123 - * @see com.mumfrey.liteloader.api.LiteAPI#getObservers()  
124 - */  
125 - @Override  
126 - public List<Observer> getObservers()  
127 - {  
128 - ObjectFactory<?, ?> objectFactory = this.getObjectFactory();  
129 -  
130 - return ImmutableList.<Observer>of  
131 - (  
132 - new ResourceObserver(),  
133 - objectFactory.getPanelManager(),  
134 - objectFactory.getEventBroker()  
135 - );  
136 - }  
137 -  
138 - /* (non-Javadoc)  
139 - * @see com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI#getObjectFactory()  
140 - */  
141 - @Override  
142 - public ObjectFactory<?, ?> getObjectFactory()  
143 - {  
144 - if (this.objectFactory == null)  
145 - {  
146 - this.objectFactory = new ObjectFactoryClient(this.environment, this.properties);  
147 - }  
148 -  
149 - return this.objectFactory;  
150 - } 29 + private static final String PKG_LITELOADER_CLIENT = LiteLoaderCoreAPI.PKG_LITELOADER + ".client";
  30 +
  31 + private static final String[] requiredTransformers = {
  32 + LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.EventProxyTransformer",
  33 + LiteLoaderCoreAPI.PKG_LITELOADER + ".launch.LiteLoaderTransformer",
  34 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.CrashReportTransformer"
  35 + };
  36 +
  37 + private static final String[] requiredDownstreamTransformers = {
  38 + LiteLoaderCoreAPI.PKG_LITELOADER_COMMON + ".transformers.LiteLoaderPacketTransformer",
  39 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",
  40 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftTransformer",
  41 + LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.json.ModEventInjectionTransformer"
  42 + };
  43 +
  44 + private ObjectFactory<Minecraft, IntegratedServer> objectFactory;
  45 +
  46 + /* (non-Javadoc)
  47 + * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers()
  48 + */
  49 + @Override
  50 + public String[] getRequiredTransformers()
  51 + {
  52 + return LiteLoaderCoreAPIClient.requiredTransformers;
  53 + }
  54 +
  55 + /* (non-Javadoc)
  56 + * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredDownstreamTransformers()
  57 + */
  58 + @Override
  59 + public String[] getRequiredDownstreamTransformers()
  60 + {
  61 + return LiteLoaderCoreAPIClient.requiredDownstreamTransformers;
  62 + }
  63 +
  64 + /* (non-Javadoc)
  65 + * @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders()
  66 + */
  67 + @Override
  68 + public List<CustomisationProvider> getCustomisationProviders()
  69 + {
  70 + return ImmutableList.<CustomisationProvider>of
  71 + (
  72 + new LiteLoaderBrandingProvider(),
  73 + new LiteLoaderModInfoDecorator(),
  74 + new Translator()
  75 + );
  76 + }
  77 +
  78 + /* (non-Javadoc)
  79 + * @see com.mumfrey.liteloader.api.LiteAPI#getCoreProviders()
  80 + */
  81 + @Override
  82 + public List<CoreProvider> getCoreProviders()
  83 + {
  84 + return ImmutableList.<CoreProvider>of
  85 + (
  86 + new LiteLoaderCoreProviderClient(this.properties),
  87 + LiteLoader.getInput()
  88 + );
  89 + }
  90 +
  91 +
  92 + /* (non-Javadoc)
  93 + * @see com.mumfrey.liteloader.api.LiteAPI#getInterfaceProviders()
  94 + */
  95 + @Override
  96 + public List<InterfaceProvider> getInterfaceProviders()
  97 + {
  98 + ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
  99 +
  100 + return ImmutableList.<InterfaceProvider>of
  101 + (
  102 + objectFactory.getEventBroker(),
  103 + objectFactory.getPacketEventBroker(),
  104 + objectFactory.getClientPluginChannels(),
  105 + objectFactory.getServerPluginChannels(),
  106 + MessageBus.getInstance()
  107 + );
  108 + }
  109 +
  110 + /* (non-Javadoc)
  111 + * @see com.mumfrey.liteloader.api.LiteAPI#getPreInitObservers()
  112 + */
  113 + @Override
  114 + public List<Observer> getPreInitObservers()
  115 + {
  116 + return ImmutableList.<Observer>of
  117 + (
  118 + new ModEvents()
  119 + );
  120 + }
  121 +
  122 + /* (non-Javadoc)
  123 + * @see com.mumfrey.liteloader.api.LiteAPI#getObservers()
  124 + */
  125 + @Override
  126 + public List<Observer> getObservers()
  127 + {
  128 + ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
  129 +
  130 + return ImmutableList.<Observer>of
  131 + (
  132 + new ResourceObserver(),
  133 + objectFactory.getPanelManager(),
  134 + objectFactory.getEventBroker()
  135 + );
  136 + }
  137 +
  138 + /* (non-Javadoc)
  139 + * @see com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI#getObjectFactory()
  140 + */
  141 + @Override
  142 + public ObjectFactory<?, ?> getObjectFactory()
  143 + {
  144 + if (this.objectFactory == null)
  145 + {
  146 + this.objectFactory = new ObjectFactoryClient(this.environment, this.properties);
  147 + }
  148 +
  149 + return this.objectFactory;
  150 + }
151 } 151 }
src/client/java/com/mumfrey/liteloader/client/api/LiteLoaderModInfoDecorator.java
@@ -19,89 +19,89 @@ import com.mumfrey.liteloader.util.render.IconTextured; @@ -19,89 +19,89 @@ import com.mumfrey.liteloader.util.render.IconTextured;
19 */ 19 */
20 public class LiteLoaderModInfoDecorator implements ModInfoDecorator 20 public class LiteLoaderModInfoDecorator implements ModInfoDecorator
21 { 21 {
22 - /* (non-Javadoc)  
23 - * @see com.mumfrey.liteloader.api.ModInfoDecorator#addIcons(com.mumfrey.liteloader.core.ModInfo, java.util.List)  
24 - */  
25 - @Override  
26 - public void addIcons(final ModInfo<?> mod, List<IconTextured> icons)  
27 - {  
28 - if (mod.hasTweakClass())  
29 - {  
30 - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestweak"), 12, 12, 158, 80, 170, 92){  
31 - @Override  
32 - public void onClicked(Object source, Object container)  
33 - {  
34 - if (container instanceof GuiModListPanel)  
35 - {  
36 - ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providestweak", "gui.mod.help.tweak");  
37 - }  
38 - }  
39 - });  
40 - }  
41 -  
42 - if (mod.hasEventTransformers())  
43 - {  
44 - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providesevents"), 12, 12, 170, 92, 182, 104){  
45 - @Override  
46 - public void onClicked(Object source, Object container)  
47 - {  
48 - if (container instanceof GuiModListPanel)  
49 - {  
50 - ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providesevents", "gui.mod.help.events");  
51 - }  
52 - }  
53 - });  
54 - }  
55 -  
56 - if (mod.hasClassTransformers())  
57 - {  
58 - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestransformer"), 12, 12, 170, 80, 182, 92){  
59 - @Override  
60 - public void onClicked(Object source, Object container)  
61 - {  
62 - if (container instanceof GuiModListPanel)  
63 - {  
64 - ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providestransformer", "gui.mod.help.transformer");  
65 - }  
66 - }  
67 - });  
68 - }  
69 -  
70 - if (mod.usesAPI())  
71 - {  
72 - icons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.usingapi"), 12, 12, 122, 92, 134, 104));  
73 - }  
74 -  
75 - List<Throwable> startupErrors = mod.getStartupErrors();  
76 - if (startupErrors != null && startupErrors.size() > 0)  
77 - {  
78 - icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.startuperror", startupErrors.size()), 12, 12, 134, 92, 146, 104){  
79 - @Override  
80 - public void onClicked(Object source, Object container)  
81 - {  
82 - if (source instanceof GuiLiteLoaderPanel)  
83 - {  
84 - ((GuiLiteLoaderPanel)source).showErrorPanel(mod);  
85 - }  
86 - }  
87 - });  
88 - }  
89 - }  
90 -  
91 - /* (non-Javadoc)  
92 - * @see com.mumfrey.liteloader.api.ModInfoDecorator#modifyStatusText(com.mumfrey.liteloader.core.ModInfo, java.lang.String)  
93 - */  
94 - @Override  
95 - public String modifyStatusText(ModInfo<?> mod, String statusText)  
96 - {  
97 - return null;  
98 - }  
99 -  
100 - /* (non-Javadoc)  
101 - * @see com.mumfrey.liteloader.api.ModInfoDecorator#onDrawListEntry(int, int, float, int, int, int, int, boolean, com.mumfrey.liteloader.core.ModInfo, int, int, int)  
102 - */  
103 - @Override  
104 - public void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour)  
105 - {  
106 - } 22 + /* (non-Javadoc)
  23 + * @see com.mumfrey.liteloader.api.ModInfoDecorator#addIcons(com.mumfrey.liteloader.core.ModInfo, java.util.List)
  24 + */
  25 + @Override
  26 + public void addIcons(final ModInfo<?> mod, List<IconTextured> icons)
  27 + {
  28 + if (mod.hasTweakClass())
  29 + {
  30 + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestweak"), 12, 12, 158, 80, 170, 92){
  31 + @Override
  32 + public void onClicked(Object source, Object container)
  33 + {
  34 + if (container instanceof GuiModListPanel)
  35 + {
  36 + ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providestweak", "gui.mod.help.tweak");
  37 + }
  38 + }
  39 + });
  40 + }
  41 +
  42 + if (mod.hasEventTransformers())
  43 + {
  44 + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providesevents"), 12, 12, 170, 92, 182, 104){
  45 + @Override
  46 + public void onClicked(Object source, Object container)
  47 + {
  48 + if (container instanceof GuiModListPanel)
  49 + {
  50 + ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providesevents", "gui.mod.help.events");
  51 + }
  52 + }
  53 + });
  54 + }
  55 +
  56 + if (mod.hasClassTransformers())
  57 + {
  58 + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestransformer"), 12, 12, 170, 80, 182, 92){
  59 + @Override
  60 + public void onClicked(Object source, Object container)
  61 + {
  62 + if (container instanceof GuiModListPanel)
  63 + {
  64 + ((GuiModListPanel)container).displayModHelpMessage(mod, "gui.mod.providestransformer", "gui.mod.help.transformer");
  65 + }
  66 + }
  67 + });
  68 + }
  69 +
  70 + if (mod.usesAPI())
  71 + {
  72 + icons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.usingapi"), 12, 12, 122, 92, 134, 104));
  73 + }
  74 +
  75 + List<Throwable> startupErrors = mod.getStartupErrors();
  76 + if (startupErrors != null && startupErrors.size() > 0)
  77 + {
  78 + icons.add(new IconAbsoluteClickable(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.startuperror", startupErrors.size()), 12, 12, 134, 92, 146, 104){
  79 + @Override
  80 + public void onClicked(Object source, Object container)
  81 + {
  82 + if (source instanceof GuiLiteLoaderPanel)
  83 + {
  84 + ((GuiLiteLoaderPanel)source).showErrorPanel(mod);
  85 + }
  86 + }
  87 + });
  88 + }
  89 + }
  90 +
  91 + /* (non-Javadoc)
  92 + * @see com.mumfrey.liteloader.api.ModInfoDecorator#modifyStatusText(com.mumfrey.liteloader.core.ModInfo, java.lang.String)
  93 + */
  94 + @Override
  95 + public String modifyStatusText(ModInfo<?> mod, String statusText)
  96 + {
  97 + return null;
  98 + }
  99 +
  100 + /* (non-Javadoc)
  101 + * @see com.mumfrey.liteloader.api.ModInfoDecorator#onDrawListEntry(int, int, float, int, int, int, int, boolean, com.mumfrey.liteloader.core.ModInfo, int, int, int)
  102 + */
  103 + @Override
  104 + public void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour)
  105 + {
  106 + }
107 } 107 }