Commit 3a391e329e8007d4382bf141ddf660318e91e58b

Authored by Mumfrey
1 parent d7a488cd

Relocate client sources

Showing 27 changed files with 2338 additions and 2338 deletions

Too many changes to show.

To preserve performance only 27 of 72 files are displayed.

java/client/com/mumfrey/liteloader/ChatFilter.java renamed to src/client/java/com/mumfrey/liteloader/ChatFilter.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;  
4 -  
5 -import net.minecraft.util.IChatComponent;  
6 -  
7 -  
8 -/**  
9 - * Interface for mods which can filter inbound chat  
10 - *  
11 - * @author Adam Mummery-Smith  
12 - */  
13 -public interface ChatFilter extends LiteMod  
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);  
25 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
  4 +
  5 +import net.minecraft.util.IChatComponent;
  6 +
  7 +
  8 +/**
  9 + * Interface for mods which can filter inbound chat
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface ChatFilter extends LiteMod
  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);
  25 +}
java/client/com/mumfrey/liteloader/ChatListener.java renamed to src/client/java/com/mumfrey/liteloader/ChatListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.util.IChatComponent;  
4 -  
5 -  
6 -/**  
7 - * Interface for mods which receive inbound chat  
8 - *  
9 - * @author Adam Mummery-Smith  
10 - */  
11 -public interface ChatListener extends LiteMod  
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);  
20 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.util.IChatComponent;
  4 +
  5 +
  6 +/**
  7 + * Interface for mods which receive inbound chat
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface ChatListener extends LiteMod
  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);
  20 +}
java/client/com/mumfrey/liteloader/ChatRenderListener.java renamed to src/client/java/com/mumfrey/liteloader/ChatRenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.gui.GuiNewChat;  
4 -  
5 -/**  
6 - * Interface for mods which want to alter the chat display  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface ChatRenderListener extends LiteMod  
11 -{  
12 - public abstract void onPreRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);  
13 -  
14 - public abstract void onPostRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);  
15 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.gui.GuiNewChat;
  4 +
  5 +/**
  6 + * Interface for mods which want to alter the chat display
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface ChatRenderListener extends LiteMod
  11 +{
  12 + public abstract void onPreRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);
  13 +
  14 + public abstract void onPostRenderChat(int screenWidth, int screenHeight, GuiNewChat chat);
  15 +}
java/client/com/mumfrey/liteloader/EntityRenderListener.java renamed to src/client/java/com/mumfrey/liteloader/EntityRenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.renderer.entity.Render;  
4 -import net.minecraft.entity.Entity;  
5 -  
6 -/**  
7 - * Interface for mods which want to receive callbacks when entities are rendered into the world  
8 - *  
9 - * @author Adam Mummery-Smith  
10 - */  
11 -public interface EntityRenderListener extends LiteMod  
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);  
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);  
38 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.renderer.entity.Render;
  4 +import net.minecraft.entity.Entity;
  5 +
  6 +/**
  7 + * Interface for mods which want to receive callbacks when entities are rendered into the world
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface EntityRenderListener extends LiteMod
  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);
  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);
  38 +}
java/client/com/mumfrey/liteloader/FrameBufferListener.java renamed to src/client/java/com/mumfrey/liteloader/FrameBufferListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.shader.Framebuffer;  
4 -  
5 -/**  
6 - * Interface for mods which want to interact with Minecraft's main Frame Buffer Object  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface FrameBufferListener extends LiteMod  
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);  
26 -  
27 - /**  
28 - * Called after the FBO is rendered whilst still inside the FBO transform  
29 - */  
30 - public abstract void postRenderFBO(Framebuffer fbo);  
31 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.shader.Framebuffer;
  4 +
  5 +/**
  6 + * Interface for mods which want to interact with Minecraft's main Frame Buffer Object
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface FrameBufferListener extends LiteMod
  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);
  26 +
  27 + /**
  28 + * Called after the FBO is rendered whilst still inside the FBO transform
  29 + */
  30 + public abstract void postRenderFBO(Framebuffer fbo);
  31 +}
java/client/com/mumfrey/liteloader/GameLoopListener.java renamed to src/client/java/com/mumfrey/liteloader/GameLoopListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -  
5 -/**  
6 - * Interface for mods which want a frame notification every single game loop  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface GameLoopListener extends LiteMod  
11 -{  
12 - /**  
13 - * Called every frame, before the world is ticked  
14 - *  
15 - * @param minecraft  
16 - */  
17 - public abstract void onRunGameLoop(Minecraft minecraft);  
18 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +
  5 +/**
  6 + * Interface for mods which want a frame notification every single game loop
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface GameLoopListener extends LiteMod
  11 +{
  12 + /**
  13 + * Called every frame, before the world is ticked
  14 + *
  15 + * @param minecraft
  16 + */
  17 + public abstract void onRunGameLoop(Minecraft minecraft);
  18 +}
java/client/com/mumfrey/liteloader/HUDRenderListener.java renamed to src/client/java/com/mumfrey/liteloader/HUDRenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -/**  
4 - * Interface for mods which want callbacks when the HUD is rendered  
5 - *  
6 - * @author Adam Mummery-Smith  
7 - */  
8 -public interface HUDRenderListener extends LiteMod  
9 -{  
10 - public abstract void onPreRenderHUD(int screenWidth, int screenHeight);  
11 -  
12 - public abstract void onPostRenderHUD(int screenWidth, int screenHeight);  
13 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +/**
  4 + * Interface for mods which want callbacks when the HUD is rendered
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface HUDRenderListener extends LiteMod
  9 +{
  10 + public abstract void onPreRenderHUD(int screenWidth, int screenHeight);
  11 +
  12 + public abstract void onPostRenderHUD(int screenWidth, int screenHeight);
  13 +}
java/client/com/mumfrey/liteloader/InitCompleteListener.java renamed to src/client/java/com/mumfrey/liteloader/InitCompleteListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -  
5 -import com.mumfrey.liteloader.core.LiteLoader;  
6 -  
7 -/**  
8 - * Interface for mods which need to initialise stuff once the game initialisation is completed,  
9 - * for example mods which need to register new renderers.  
10 - *  
11 - * @author Adam Mummery-Smith  
12 - */  
13 -public interface InitCompleteListener extends Tickable  
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);  
22 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +
  5 +import com.mumfrey.liteloader.core.LiteLoader;
  6 +
  7 +/**
  8 + * Interface for mods which need to initialise stuff once the game initialisation is completed,
  9 + * for example mods which need to register new renderers.
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface InitCompleteListener extends Tickable
  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);
  22 +}
java/client/com/mumfrey/liteloader/JoinGameListener.java renamed to src/client/java/com/mumfrey/liteloader/JoinGameListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.multiplayer.ServerData;  
4 -import net.minecraft.network.INetHandler;  
5 -import net.minecraft.network.play.server.S01PacketJoinGame;  
6 -  
7 -import com.mojang.realmsclient.dto.RealmsServer;  
8 -  
9 -  
10 -/**  
11 - * Interface for mods which wish to be notified when the player connects to a server (or local game)  
12 - *  
13 - * @author Adam Mummery-Smith  
14 - */  
15 -public interface JoinGameListener extends LiteMod  
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);  
26 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.multiplayer.ServerData;
  4 +import net.minecraft.network.INetHandler;
  5 +import net.minecraft.network.play.server.S01PacketJoinGame;
  6 +
  7 +import com.mojang.realmsclient.dto.RealmsServer;
  8 +
  9 +
  10 +/**
  11 + * Interface for mods which wish to be notified when the player connects to a server (or local game)
  12 + *
  13 + * @author Adam Mummery-Smith
  14 + */
  15 +public interface JoinGameListener extends LiteMod
  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);
  26 +}
java/client/com/mumfrey/liteloader/OutboundChatFilter.java renamed to src/client/java/com/mumfrey/liteloader/OutboundChatFilter.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -/**  
4 - * Interface for mods which want to filter outbound chat  
5 - *  
6 - * @author Adam Mummery-Smith  
7 - */  
8 -public interface OutboundChatFilter extends LiteMod  
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);  
16 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +/**
  4 + * Interface for mods which want to filter outbound chat
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface OutboundChatFilter extends LiteMod
  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);
  16 +}
java/client/com/mumfrey/liteloader/OutboundChatListener.java renamed to src/client/java/com/mumfrey/liteloader/OutboundChatListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.network.play.client.C01PacketChatMessage;  
4 -  
5 -/**  
6 - * Interface for mods which want to monitor outbound chat  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface OutboundChatListener extends LiteMod  
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);  
19 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.network.play.client.C01PacketChatMessage;
  4 +
  5 +/**
  6 + * Interface for mods which want to monitor outbound chat
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface OutboundChatListener extends LiteMod
  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);
  19 +}
java/client/com/mumfrey/liteloader/PostLoginListener.java renamed to src/client/java/com/mumfrey/liteloader/PostLoginListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.network.login.INetHandlerLoginClient;  
4 -import net.minecraft.network.login.server.S02PacketLoginSuccess;  
5 -  
6 -/**  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface PostLoginListener extends LiteMod  
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);  
20 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.network.login.INetHandlerLoginClient;
  4 +import net.minecraft.network.login.server.S02PacketLoginSuccess;
  5 +
  6 +/**
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface PostLoginListener extends LiteMod
  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);
  20 +}
java/client/com/mumfrey/liteloader/PostRenderListener.java renamed to src/client/java/com/mumfrey/liteloader/PostRenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -/**  
4 - * Render callback that gets called AFTER entities are rendered  
5 - *  
6 - * @author Adam Mummery-Smith  
7 - */  
8 -public interface PostRenderListener extends LiteMod  
9 -{  
10 - /**  
11 - * Called after entities are rendered but before particles  
12 - *  
13 - * @param partialTicks  
14 - */  
15 - public abstract void onPostRenderEntities(float partialTicks);  
16 -  
17 - /**  
18 - * Called after all world rendering is completed  
19 - *  
20 - * @param partialTicks  
21 - */  
22 - public abstract void onPostRender(float partialTicks);  
23 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +/**
  4 + * Render callback that gets called AFTER entities are rendered
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface PostRenderListener extends LiteMod
  9 +{
  10 + /**
  11 + * Called after entities are rendered but before particles
  12 + *
  13 + * @param partialTicks
  14 + */
  15 + public abstract void onPostRenderEntities(float partialTicks);
  16 +
  17 + /**
  18 + * Called after all world rendering is completed
  19 + *
  20 + * @param partialTicks
  21 + */
  22 + public abstract void onPostRender(float partialTicks);
  23 +}
java/client/com/mumfrey/liteloader/PreRenderListener.java renamed to src/client/java/com/mumfrey/liteloader/PreRenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.renderer.RenderGlobal;  
4 -  
5 -/**  
6 - * Render callbacks that get called before certain render events  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface PreRenderListener extends LiteMod  
11 -{  
12 - /**  
13 - * Called immediately before rendering of the world (including the sky) is started.  
14 - *  
15 - * @param partialTicks  
16 - */  
17 - public abstract void onRenderWorld(float partialTicks);  
18 -  
19 - /**  
20 - * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled  
21 - *  
22 - * @param partialTicks  
23 - * @param pass  
24 - * @param timeSlice  
25 - */  
26 - public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice);  
27 -  
28 - /**  
29 - * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled  
30 - *  
31 - * @param partialTicks  
32 - * @param pass  
33 - */  
34 - public abstract void onRenderSky(float partialTicks, int pass);  
35 -  
36 - /**  
37 - * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled  
38 - *  
39 - * @param renderGlobal  
40 - * @param partialTicks  
41 - * @param pass  
42 - */  
43 - public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal);  
44 -  
45 - /**  
46 - * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled  
47 - *  
48 - * @param partialTicks  
49 - * @param pass  
50 - */  
51 - public abstract void onRenderTerrain(float partialTicks, int pass);  
52 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.renderer.RenderGlobal;
  4 +
  5 +/**
  6 + * Render callbacks that get called before certain render events
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface PreRenderListener extends LiteMod
  11 +{
  12 + /**
  13 + * Called immediately before rendering of the world (including the sky) is started.
  14 + *
  15 + * @param partialTicks
  16 + */
  17 + public abstract void onRenderWorld(float partialTicks);
  18 +
  19 + /**
  20 + * Called <b>after</b> the world camera transform is initialised, may be called more than once per frame if anaglyph is enabled
  21 + *
  22 + * @param partialTicks
  23 + * @param pass
  24 + * @param timeSlice
  25 + */
  26 + public abstract void onSetupCameraTransform(float partialTicks, int pass, long timeSlice);
  27 +
  28 + /**
  29 + * Called when the sky is rendered, may be called more than once per frame if anaglyph is enabled
  30 + *
  31 + * @param partialTicks
  32 + * @param pass
  33 + */
  34 + public abstract void onRenderSky(float partialTicks, int pass);
  35 +
  36 + /**
  37 + * Called immediately before the clouds are rendered, may be called more than once per frame if anaglyph is enabled
  38 + *
  39 + * @param renderGlobal
  40 + * @param partialTicks
  41 + * @param pass
  42 + */
  43 + public abstract void onRenderClouds(float partialTicks, int pass, RenderGlobal renderGlobal);
  44 +
  45 + /**
  46 + * Called before the terrain is rendered, may be called more than once per frame if anaglyph is enabled
  47 + *
  48 + * @param partialTicks
  49 + * @param pass
  50 + */
  51 + public abstract void onRenderTerrain(float partialTicks, int pass);
  52 +}
java/client/com/mumfrey/liteloader/RenderListener.java renamed to src/client/java/com/mumfrey/liteloader/RenderListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.gui.GuiScreen;  
4 -  
5 -/**  
6 - * Interface for objects which want a pre-render callback  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface RenderListener extends LiteMod  
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();  
31 -  
32 - /**  
33 - * Called immediately after the world/camera transform is initialised  
34 - */  
35 - public abstract void onSetupCameraTransform();  
36 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.gui.GuiScreen;
  4 +
  5 +/**
  6 + * Interface for objects which want a pre-render callback
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface RenderListener extends LiteMod
  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();
  31 +
  32 + /**
  33 + * Called immediately after the world/camera transform is initialised
  34 + */
  35 + public abstract void onSetupCameraTransform();
  36 +}
java/client/com/mumfrey/liteloader/ScreenshotListener.java renamed to src/client/java/com/mumfrey/liteloader/ScreenshotListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.shader.Framebuffer;  
4 -import net.minecraft.util.IChatComponent;  
5 -  
6 -import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;  
7 -  
8 -/**  
9 - * Interface for mods which want to handle or inhibit the saving of screenshots  
10 - *  
11 - * @author Adam Mummery-Smith  
12 - */  
13 -public interface ScreenshotListener extends LiteMod  
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);  
27 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.shader.Framebuffer;
  4 +import net.minecraft.util.IChatComponent;
  5 +
  6 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
  7 +
  8 +/**
  9 + * Interface for mods which want to handle or inhibit the saving of screenshots
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface ScreenshotListener extends LiteMod
  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);
  27 +}
java/client/com/mumfrey/liteloader/Tickable.java renamed to src/client/java/com/mumfrey/liteloader/Tickable.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -  
5 -/**  
6 - * Interface for mods which want tick events  
7 - *  
8 - * @author Adam Mummery-Smith  
9 - */  
10 -public interface Tickable extends LiteMod  
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);  
21 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +
  5 +/**
  6 + * Interface for mods which want tick events
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface Tickable extends LiteMod
  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);
  21 +}
java/client/com/mumfrey/liteloader/ViewportListener.java renamed to src/client/java/com/mumfrey/liteloader/ViewportListener.java
1 -package com.mumfrey.liteloader;  
2 -  
3 -import net.minecraft.client.gui.ScaledResolution;  
4 -  
5 -public interface ViewportListener extends LiteMod  
6 -{  
7 - public abstract void onViewportResized(ScaledResolution resolution, int displayWidth, int displayHeight);  
8 -  
9 - public abstract void onFullScreenToggled(boolean fullScreen);  
10 -} 1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.gui.ScaledResolution;
  4 +
  5 +public interface ViewportListener extends LiteMod
  6 +{
  7 + public abstract void onViewportResized(ScaledResolution resolution, int displayWidth, int displayHeight);
  8 +
  9 + public abstract void onFullScreenToggled(boolean fullScreen);
  10 +}
java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java renamed to src/client/java/com/mumfrey/liteloader/client/CallbackProxyClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import java.io.File;  
4 -import java.util.UUID;  
5 -  
6 -import net.minecraft.client.Minecraft;  
7 -import net.minecraft.client.entity.EntityPlayerSP;  
8 -import net.minecraft.client.gui.GuiIngame;  
9 -import net.minecraft.client.renderer.EntityRenderer;  
10 -import net.minecraft.client.renderer.OpenGlHelper;  
11 -import net.minecraft.client.renderer.RenderGlobal;  
12 -import net.minecraft.client.renderer.entity.Render;  
13 -import net.minecraft.client.renderer.entity.RenderManager;  
14 -import net.minecraft.client.shader.Framebuffer;  
15 -import net.minecraft.entity.Entity;  
16 -import net.minecraft.entity.player.EntityPlayer;  
17 -import net.minecraft.server.integrated.IntegratedServer;  
18 -import net.minecraft.util.IChatComponent;  
19 -import net.minecraft.util.ScreenShotHelper;  
20 -import net.minecraft.util.Session;  
21 -import net.minecraft.world.WorldSettings;  
22 -  
23 -import com.mojang.authlib.GameProfile;  
24 -import com.mumfrey.liteloader.core.CallbackProxyCommon;  
25 -import com.mumfrey.liteloader.transformers.event.EventInfo;  
26 -import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;  
27 -  
28 -/**  
29 - * Proxy class which handles the redirected calls from the injected callbacks and routes them to the  
30 - * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet  
31 - * classes themselves because this is easier to maintain.  
32 - *  
33 - * @author Adam Mummery-Smith  
34 - */  
35 -public abstract class CallbackProxyClient extends CallbackProxyCommon  
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 - }  
213 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.io.File;
  4 +import java.util.UUID;
  5 +
  6 +import net.minecraft.client.Minecraft;
  7 +import net.minecraft.client.entity.EntityPlayerSP;
  8 +import net.minecraft.client.gui.GuiIngame;
  9 +import net.minecraft.client.renderer.EntityRenderer;
  10 +import net.minecraft.client.renderer.OpenGlHelper;
  11 +import net.minecraft.client.renderer.RenderGlobal;
  12 +import net.minecraft.client.renderer.entity.Render;
  13 +import net.minecraft.client.renderer.entity.RenderManager;
  14 +import net.minecraft.client.shader.Framebuffer;
  15 +import net.minecraft.entity.Entity;
  16 +import net.minecraft.entity.player.EntityPlayer;
  17 +import net.minecraft.server.integrated.IntegratedServer;
  18 +import net.minecraft.util.IChatComponent;
  19 +import net.minecraft.util.ScreenShotHelper;
  20 +import net.minecraft.util.Session;
  21 +import net.minecraft.world.WorldSettings;
  22 +
  23 +import com.mojang.authlib.GameProfile;
  24 +import com.mumfrey.liteloader.core.CallbackProxyCommon;
  25 +import com.mumfrey.liteloader.transformers.event.EventInfo;
  26 +import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
  27 +
  28 +/**
  29 + * Proxy class which handles the redirected calls from the injected callbacks and routes them to the
  30 + * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet
  31 + * classes themselves because this is easier to maintain.
  32 + *
  33 + * @author Adam Mummery-Smith
  34 + */
  35 +public abstract class CallbackProxyClient extends CallbackProxyCommon
  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 + }
  213 +}
java/client/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java renamed to src/client/java/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -import net.minecraft.client.network.NetHandlerLoginClient;  
5 -import net.minecraft.network.INetHandler;  
6 -import net.minecraft.network.NetworkManager;  
7 -import net.minecraft.network.PacketBuffer;  
8 -import net.minecraft.network.login.INetHandlerLoginClient;  
9 -import net.minecraft.network.login.server.S02PacketLoginSuccess;  
10 -import net.minecraft.network.play.INetHandlerPlayClient;  
11 -import net.minecraft.network.play.client.C17PacketCustomPayload;  
12 -import net.minecraft.network.play.server.S01PacketJoinGame;  
13 -import net.minecraft.network.play.server.S3FPacketCustomPayload;  
14 -  
15 -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;  
16 -import com.mumfrey.liteloader.core.ClientPluginChannels;  
17 -import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;  
18 -  
19 -/**  
20 - * Handler for client plugin channels  
21 - *  
22 - * @author Adam Mummery-Smith  
23 - */  
24 -public class ClientPluginChannelsClient extends ClientPluginChannels  
25 -{  
26 - /**  
27 - * @param netHandler  
28 - * @param loginPacket  
29 - */  
30 - void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)  
31 - {  
32 - this.clearPluginChannels(netHandler);  
33 - }  
34 -  
35 - /**  
36 - * @param netHandler  
37 - * @param loginPacket  
38 - */  
39 - void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)  
40 - {  
41 - this.sendRegisteredPluginChannels(netHandler);  
42 - }  
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 - }  
60 -  
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 - }  
78 -  
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 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.network.NetHandlerLoginClient;
  5 +import net.minecraft.network.INetHandler;
  6 +import net.minecraft.network.NetworkManager;
  7 +import net.minecraft.network.PacketBuffer;
  8 +import net.minecraft.network.login.INetHandlerLoginClient;
  9 +import net.minecraft.network.login.server.S02PacketLoginSuccess;
  10 +import net.minecraft.network.play.INetHandlerPlayClient;
  11 +import net.minecraft.network.play.client.C17PacketCustomPayload;
  12 +import net.minecraft.network.play.server.S01PacketJoinGame;
  13 +import net.minecraft.network.play.server.S3FPacketCustomPayload;
  14 +
  15 +import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
  16 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  17 +import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;
  18 +
  19 +/**
  20 + * Handler for client plugin channels
  21 + *
  22 + * @author Adam Mummery-Smith
  23 + */
  24 +public class ClientPluginChannelsClient extends ClientPluginChannels
  25 +{
  26 + /**
  27 + * @param netHandler
  28 + * @param loginPacket
  29 + */
  30 + void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)
  31 + {
  32 + this.clearPluginChannels(netHandler);
  33 + }
  34 +
  35 + /**
  36 + * @param netHandler
  37 + * @param loginPacket
  38 + */
  39 + void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
  40 + {
  41 + this.sendRegisteredPluginChannels(netHandler);
  42 + }
  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 + }
  60 +
  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 + }
  78 +
  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 +}
java/client/com/mumfrey/liteloader/client/GameEngineClient.java renamed to src/client/java/com/mumfrey/liteloader/client/GameEngineClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import java.util.Arrays;  
4 -import java.util.LinkedList;  
5 -import java.util.List;  
6 -  
7 -import net.minecraft.client.Minecraft;  
8 -import net.minecraft.client.audio.SoundHandler;  
9 -import net.minecraft.client.gui.GuiNewChat;  
10 -import net.minecraft.client.gui.GuiScreen;  
11 -import net.minecraft.client.gui.ScaledResolution;  
12 -import net.minecraft.client.settings.GameSettings;  
13 -import net.minecraft.client.settings.KeyBinding;  
14 -import net.minecraft.profiler.Profiler;  
15 -import net.minecraft.server.integrated.IntegratedServer;  
16 -  
17 -import com.mumfrey.liteloader.client.overlays.IMinecraft;  
18 -import com.mumfrey.liteloader.common.GameEngine;  
19 -import com.mumfrey.liteloader.common.Resources;  
20 -  
21 -/**  
22 - *  
23 - * @author Adam Mummery-Smith  
24 - */  
25 -public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer>  
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 - }  
158 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.util.Arrays;
  4 +import java.util.LinkedList;
  5 +import java.util.List;
  6 +
  7 +import net.minecraft.client.Minecraft;
  8 +import net.minecraft.client.audio.SoundHandler;
  9 +import net.minecraft.client.gui.GuiNewChat;
  10 +import net.minecraft.client.gui.GuiScreen;
  11 +import net.minecraft.client.gui.ScaledResolution;
  12 +import net.minecraft.client.settings.GameSettings;
  13 +import net.minecraft.client.settings.KeyBinding;
  14 +import net.minecraft.profiler.Profiler;
  15 +import net.minecraft.server.integrated.IntegratedServer;
  16 +
  17 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  18 +import com.mumfrey.liteloader.common.GameEngine;
  19 +import com.mumfrey.liteloader.common.Resources;
  20 +
  21 +/**
  22 + *
  23 + * @author Adam Mummery-Smith
  24 + */
  25 +public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer>
  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 + }
  158 +}
java/client/com/mumfrey/liteloader/client/LiteLoaderCoreProviderClient.java renamed to src/client/java/com/mumfrey/liteloader/client/LiteLoaderCoreProviderClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import net.minecraft.client.resources.IResourceManager;  
4 -import net.minecraft.client.resources.IResourcePack;  
5 -import net.minecraft.client.resources.SimpleReloadableResourceManager;  
6 -import net.minecraft.network.INetHandler;  
7 -import net.minecraft.network.play.server.S01PacketJoinGame;  
8 -import net.minecraft.world.World;  
9 -  
10 -import com.mumfrey.liteloader.api.CoreProvider;  
11 -import com.mumfrey.liteloader.common.GameEngine;  
12 -import com.mumfrey.liteloader.common.Resources;  
13 -import com.mumfrey.liteloader.core.LiteLoader;  
14 -import com.mumfrey.liteloader.core.LiteLoaderMods;  
15 -import com.mumfrey.liteloader.launch.LoaderProperties;  
16 -import com.mumfrey.liteloader.resources.InternalResourcePack;  
17 -  
18 -/**  
19 - * CoreProvider which fixes SoundManager derping up at startup  
20 - *  
21 - * @author Adam Mummery-Smith  
22 - */  
23 -public class LiteLoaderCoreProviderClient implements CoreProvider  
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 - }  
105 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.resources.IResourceManager;
  4 +import net.minecraft.client.resources.IResourcePack;
  5 +import net.minecraft.client.resources.SimpleReloadableResourceManager;
  6 +import net.minecraft.network.INetHandler;
  7 +import net.minecraft.network.play.server.S01PacketJoinGame;
  8 +import net.minecraft.world.World;
  9 +
  10 +import com.mumfrey.liteloader.api.CoreProvider;
  11 +import com.mumfrey.liteloader.common.GameEngine;
  12 +import com.mumfrey.liteloader.common.Resources;
  13 +import com.mumfrey.liteloader.core.LiteLoader;
  14 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  15 +import com.mumfrey.liteloader.launch.LoaderProperties;
  16 +import com.mumfrey.liteloader.resources.InternalResourcePack;
  17 +
  18 +/**
  19 + * CoreProvider which fixes SoundManager derping up at startup
  20 + *
  21 + * @author Adam Mummery-Smith
  22 + */
  23 +public class LiteLoaderCoreProviderClient implements CoreProvider
  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 + }
  105 +}
java/client/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java renamed to src/client/java/com/mumfrey/liteloader/client/LiteLoaderEventBrokerClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -import net.minecraft.client.entity.EntityPlayerSP;  
5 -import net.minecraft.client.gui.GuiNewChat;  
6 -import net.minecraft.client.gui.ScaledResolution;  
7 -import net.minecraft.client.renderer.RenderGlobal;  
8 -import net.minecraft.client.renderer.entity.Render;  
9 -import net.minecraft.client.renderer.entity.RenderManager;  
10 -import net.minecraft.client.resources.IResourceManager;  
11 -import net.minecraft.client.resources.IResourceManagerReloadListener;  
12 -import net.minecraft.client.shader.Framebuffer;  
13 -import net.minecraft.entity.Entity;  
14 -import net.minecraft.network.play.client.C01PacketChatMessage;  
15 -import net.minecraft.server.integrated.IntegratedServer;  
16 -import net.minecraft.util.IChatComponent;  
17 -import net.minecraft.util.ScreenShotHelper;  
18 -import net.minecraft.util.Timer;  
19 -  
20 -import org.lwjgl.input.Mouse;  
21 -  
22 -import com.mumfrey.liteloader.*;  
23 -import com.mumfrey.liteloader.client.overlays.IEntityRenderer;  
24 -import com.mumfrey.liteloader.client.overlays.IMinecraft;  
25 -import com.mumfrey.liteloader.common.LoadingProgress;  
26 -import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;  
27 -import com.mumfrey.liteloader.core.LiteLoader;  
28 -import com.mumfrey.liteloader.core.LiteLoaderEventBroker;  
29 -import com.mumfrey.liteloader.core.event.HandlerList;  
30 -import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;  
31 -import com.mumfrey.liteloader.core.event.ProfilingHandlerList;  
32 -import com.mumfrey.liteloader.interfaces.FastIterableDeque;  
33 -import com.mumfrey.liteloader.launch.LoaderProperties;  
34 -import com.mumfrey.liteloader.transformers.event.EventInfo;  
35 -import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;  
36 -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;  
37 -  
38 -public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener  
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 - }  
562 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.entity.EntityPlayerSP;
  5 +import net.minecraft.client.gui.GuiNewChat;
  6 +import net.minecraft.client.gui.ScaledResolution;
  7 +import net.minecraft.client.renderer.RenderGlobal;
  8 +import net.minecraft.client.renderer.entity.Render;
  9 +import net.minecraft.client.renderer.entity.RenderManager;
  10 +import net.minecraft.client.resources.IResourceManager;
  11 +import net.minecraft.client.resources.IResourceManagerReloadListener;
  12 +import net.minecraft.client.shader.Framebuffer;
  13 +import net.minecraft.entity.Entity;
  14 +import net.minecraft.network.play.client.C01PacketChatMessage;
  15 +import net.minecraft.server.integrated.IntegratedServer;
  16 +import net.minecraft.util.IChatComponent;
  17 +import net.minecraft.util.ScreenShotHelper;
  18 +import net.minecraft.util.Timer;
  19 +
  20 +import org.lwjgl.input.Mouse;
  21 +
  22 +import com.mumfrey.liteloader.*;
  23 +import com.mumfrey.liteloader.client.overlays.IEntityRenderer;
  24 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  25 +import com.mumfrey.liteloader.common.LoadingProgress;
  26 +import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
  27 +import com.mumfrey.liteloader.core.LiteLoader;
  28 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker;
  29 +import com.mumfrey.liteloader.core.event.HandlerList;
  30 +import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
  31 +import com.mumfrey.liteloader.core.event.ProfilingHandlerList;
  32 +import com.mumfrey.liteloader.interfaces.FastIterableDeque;
  33 +import com.mumfrey.liteloader.launch.LoaderProperties;
  34 +import com.mumfrey.liteloader.transformers.event.EventInfo;
  35 +import com.mumfrey.liteloader.transformers.event.ReturnEventInfo;
  36 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  37 +
  38 +public class LiteLoaderEventBrokerClient extends LiteLoaderEventBroker<Minecraft, IntegratedServer> implements IResourceManagerReloadListener
  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 + }
  562 +}
java/client/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java renamed to src/client/java/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -import net.minecraft.client.gui.GuiIngameMenu;  
5 -import net.minecraft.client.gui.GuiMainMenu;  
6 -import net.minecraft.client.gui.GuiOptions;  
7 -import net.minecraft.client.gui.GuiScreen;  
8 -import net.minecraft.client.resources.I18n;  
9 -  
10 -import org.lwjgl.input.Keyboard;  
11 -  
12 -import com.mumfrey.liteloader.client.gui.GuiLiteLoaderPanel;  
13 -import com.mumfrey.liteloader.common.GameEngine;  
14 -import com.mumfrey.liteloader.core.LiteLoaderMods;  
15 -import com.mumfrey.liteloader.core.LiteLoaderUpdateSite;  
16 -import com.mumfrey.liteloader.core.LiteLoaderVersion;  
17 -import com.mumfrey.liteloader.interfaces.PanelManager;  
18 -import com.mumfrey.liteloader.launch.LoaderEnvironment;  
19 -import com.mumfrey.liteloader.launch.LoaderProperties;  
20 -import com.mumfrey.liteloader.modconfig.ConfigManager;  
21 -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;  
22 -  
23 -/**  
24 - * Observer which handles the display of the mod panel  
25 - *  
26 - * @author Adam Mummery-Smith  
27 - */  
28 -public class LiteLoaderPanelManager implements PanelManager<GuiScreen>  
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 - }  
287 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.gui.GuiIngameMenu;
  5 +import net.minecraft.client.gui.GuiMainMenu;
  6 +import net.minecraft.client.gui.GuiOptions;
  7 +import net.minecraft.client.gui.GuiScreen;
  8 +import net.minecraft.client.resources.I18n;
  9 +
  10 +import org.lwjgl.input.Keyboard;
  11 +
  12 +import com.mumfrey.liteloader.client.gui.GuiLiteLoaderPanel;
  13 +import com.mumfrey.liteloader.common.GameEngine;
  14 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  15 +import com.mumfrey.liteloader.core.LiteLoaderUpdateSite;
  16 +import com.mumfrey.liteloader.core.LiteLoaderVersion;
  17 +import com.mumfrey.liteloader.interfaces.PanelManager;
  18 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  19 +import com.mumfrey.liteloader.launch.LoaderProperties;
  20 +import com.mumfrey.liteloader.modconfig.ConfigManager;
  21 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  22 +
  23 +/**
  24 + * Observer which handles the display of the mod panel
  25 + *
  26 + * @author Adam Mummery-Smith
  27 + */
  28 +public class LiteLoaderPanelManager implements PanelManager<GuiScreen>
  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 + }
  287 +}
java/client/com/mumfrey/liteloader/client/PacketEventsClient.java renamed to src/client/java/com/mumfrey/liteloader/client/PacketEventsClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import net.minecraft.client.Minecraft;  
4 -import net.minecraft.network.INetHandler;  
5 -import net.minecraft.network.Packet;  
6 -import net.minecraft.network.login.INetHandlerLoginClient;  
7 -import net.minecraft.network.login.server.S02PacketLoginSuccess;  
8 -import net.minecraft.network.play.INetHandlerPlayClient;  
9 -import net.minecraft.network.play.server.S01PacketJoinGame;  
10 -import net.minecraft.network.play.server.S02PacketChat;  
11 -import net.minecraft.server.MinecraftServer;  
12 -import net.minecraft.util.ChatComponentText;  
13 -import net.minecraft.util.IChatComponent;  
14 -import net.minecraft.util.IThreadListener;  
15 -  
16 -import com.mojang.realmsclient.RealmsMainScreen;  
17 -import com.mojang.realmsclient.dto.RealmsServer;  
18 -import com.mumfrey.liteloader.ChatFilter;  
19 -import com.mumfrey.liteloader.ChatListener;  
20 -import com.mumfrey.liteloader.JoinGameListener;  
21 -import com.mumfrey.liteloader.PostLoginListener;  
22 -import com.mumfrey.liteloader.PreJoinGameListener;  
23 -import com.mumfrey.liteloader.client.util.PrivateFieldsClient;  
24 -import com.mumfrey.liteloader.common.transformers.PacketEventInfo;  
25 -import com.mumfrey.liteloader.core.ClientPluginChannels;  
26 -import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;  
27 -import com.mumfrey.liteloader.core.LiteLoader;  
28 -import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;  
29 -import com.mumfrey.liteloader.core.PacketEvents;  
30 -import com.mumfrey.liteloader.core.event.EventCancellationException;  
31 -import com.mumfrey.liteloader.core.event.HandlerList;  
32 -import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;  
33 -import com.mumfrey.liteloader.core.runtime.Packets;  
34 -import com.mumfrey.liteloader.interfaces.FastIterableDeque;  
35 -import com.mumfrey.liteloader.transformers.event.EventInfo;  
36 -import com.mumfrey.liteloader.util.ChatUtilities;  
37 -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;  
38 -  
39 -/**  
40 - * Client-side packet event handlers  
41 - *  
42 - * @author Adam Mummery-Smith  
43 - */  
44 -public class PacketEventsClient extends PacketEvents  
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 - }  
254 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.network.INetHandler;
  5 +import net.minecraft.network.Packet;
  6 +import net.minecraft.network.login.INetHandlerLoginClient;
  7 +import net.minecraft.network.login.server.S02PacketLoginSuccess;
  8 +import net.minecraft.network.play.INetHandlerPlayClient;
  9 +import net.minecraft.network.play.server.S01PacketJoinGame;
  10 +import net.minecraft.network.play.server.S02PacketChat;
  11 +import net.minecraft.server.MinecraftServer;
  12 +import net.minecraft.util.ChatComponentText;
  13 +import net.minecraft.util.IChatComponent;
  14 +import net.minecraft.util.IThreadListener;
  15 +
  16 +import com.mojang.realmsclient.RealmsMainScreen;
  17 +import com.mojang.realmsclient.dto.RealmsServer;
  18 +import com.mumfrey.liteloader.ChatFilter;
  19 +import com.mumfrey.liteloader.ChatListener;
  20 +import com.mumfrey.liteloader.JoinGameListener;
  21 +import com.mumfrey.liteloader.PostLoginListener;
  22 +import com.mumfrey.liteloader.PreJoinGameListener;
  23 +import com.mumfrey.liteloader.client.util.PrivateFieldsClient;
  24 +import com.mumfrey.liteloader.common.transformers.PacketEventInfo;
  25 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  26 +import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
  27 +import com.mumfrey.liteloader.core.LiteLoader;
  28 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
  29 +import com.mumfrey.liteloader.core.PacketEvents;
  30 +import com.mumfrey.liteloader.core.event.EventCancellationException;
  31 +import com.mumfrey.liteloader.core.event.HandlerList;
  32 +import com.mumfrey.liteloader.core.event.HandlerList.ReturnLogicOp;
  33 +import com.mumfrey.liteloader.core.runtime.Packets;
  34 +import com.mumfrey.liteloader.interfaces.FastIterableDeque;
  35 +import com.mumfrey.liteloader.transformers.event.EventInfo;
  36 +import com.mumfrey.liteloader.util.ChatUtilities;
  37 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  38 +
  39 +/**
  40 + * Client-side packet event handlers
  41 + *
  42 + * @author Adam Mummery-Smith
  43 + */
  44 +public class PacketEventsClient extends PacketEvents
  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 + }
  254 +}
java/client/com/mumfrey/liteloader/client/ResourceObserver.java renamed to src/client/java/com/mumfrey/liteloader/client/ResourceObserver.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import java.io.File;  
4 -import java.util.HashMap;  
5 -import java.util.Map;  
6 -  
7 -import net.minecraft.client.resources.IResourceManager;  
8 -import net.minecraft.client.resources.IResourcePack;  
9 -  
10 -import com.mumfrey.liteloader.LiteMod;  
11 -import com.mumfrey.liteloader.api.ModLoadObserver;  
12 -import com.mumfrey.liteloader.common.Resources;  
13 -import com.mumfrey.liteloader.core.LiteLoader;  
14 -import com.mumfrey.liteloader.core.ModInfo;  
15 -import com.mumfrey.liteloader.interfaces.LoadableMod;  
16 -import com.mumfrey.liteloader.resources.ModResourcePack;  
17 -import com.mumfrey.liteloader.resources.ModResourcePackDir;  
18 -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;  
19 -  
20 -/**  
21 - * Observer which handles registering mods on the client as resource packs  
22 - *  
23 - * @author Adam Mummery-Smith  
24 - */  
25 -public class ResourceObserver implements ModLoadObserver  
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 - }  
115 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.io.File;
  4 +import java.util.HashMap;
  5 +import java.util.Map;
  6 +
  7 +import net.minecraft.client.resources.IResourceManager;
  8 +import net.minecraft.client.resources.IResourcePack;
  9 +
  10 +import com.mumfrey.liteloader.LiteMod;
  11 +import com.mumfrey.liteloader.api.ModLoadObserver;
  12 +import com.mumfrey.liteloader.common.Resources;
  13 +import com.mumfrey.liteloader.core.LiteLoader;
  14 +import com.mumfrey.liteloader.core.ModInfo;
  15 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  16 +import com.mumfrey.liteloader.resources.ModResourcePack;
  17 +import com.mumfrey.liteloader.resources.ModResourcePackDir;
  18 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  19 +
  20 +/**
  21 + * Observer which handles registering mods on the client as resource packs
  22 + *
  23 + * @author Adam Mummery-Smith
  24 + */
  25 +public class ResourceObserver implements ModLoadObserver
  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 + }
  115 +}
java/client/com/mumfrey/liteloader/client/ResourcesClient.java renamed to src/client/java/com/mumfrey/liteloader/client/ResourcesClient.java
1 -package com.mumfrey.liteloader.client;  
2 -  
3 -import java.util.HashMap;  
4 -import java.util.List;  
5 -import java.util.Map;  
6 -  
7 -import net.minecraft.client.Minecraft;  
8 -import net.minecraft.client.resources.IResourceManager;  
9 -import net.minecraft.client.resources.IResourcePack;  
10 -  
11 -import com.mumfrey.liteloader.client.overlays.IMinecraft;  
12 -import com.mumfrey.liteloader.common.LoadingProgress;  
13 -import com.mumfrey.liteloader.common.Resources;  
14 -  
15 -public class ResourcesClient implements Resources<IResourceManager, IResourcePack>  
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>();  
23 -  
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;  
28 -  
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 - }  
42 -  
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;  
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 -} 1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import net.minecraft.client.Minecraft;
  8 +import net.minecraft.client.resources.IResourceManager;
  9 +import net.minecraft.client.resources.IResourcePack;
  10 +
  11 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  12 +import com.mumfrey.liteloader.common.LoadingProgress;
  13 +import com.mumfrey.liteloader.common.Resources;
  14 +
  15 +public class ResourcesClient implements Resources<IResourceManager, IResourcePack>
  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>();
  23 +
  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;
  28 +
  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 + }
  42 +
  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;
  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 +}