Commit ebb3c2be879520fd607b4a7f2763bf7536b7468c

Authored by Mumfrey
2 parents 11a9a320 fdb36ae1

The great style update

Showing 33 changed files with 2401 additions and 2203 deletions

Too many changes to show.

To preserve performance only 33 of 282 files are displayed.

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