Commit 3e955ef14767cfd7d077ef86c2f00db1cdce761e

Authored by Mumfrey
1 parent 3db66fd3

1.7.10 initial update merging branch "apidev" into trunk

Showing 40 changed files with 2297 additions and 1130 deletions

Too many changes to show.

To preserve performance only 40 of 221 files are displayed.

.classpath
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <classpath> 2 <classpath>
3 - <classpathentry kind="src" path="java"/>  
4 <classpathentry kind="src" path="debug"/> 3 <classpathentry kind="src" path="debug"/>
5 <classpathentry kind="src" path="resources"/> 4 <classpathentry kind="src" path="resources"/>
  5 + <classpathentry kind="src" path="java/common"/>
  6 + <classpathentry kind="src" path="java/client"/>
6 <classpathentry combineaccessrules="false" exported="true" kind="src" path="/Client"/> 7 <classpathentry combineaccessrules="false" exported="true" kind="src" path="/Client"/>
7 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 8 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
8 - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.0/lwjgl-2.9.0.jar"/>  
9 - <classpathentry kind="lib" path="/Client/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"/>  
10 - <classpathentry kind="lib" path="/Client/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar"/>  
11 - <classpathentry kind="lib" path="/Client/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar"/> 9 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"/>
  10 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar"/>
  11 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
12 <classpathentry exported="true" kind="lib" path="lib/launchwrapper-1.9.jar" sourcepath="externals/launchwrapper/src"/> 12 <classpathentry exported="true" kind="lib" path="lib/launchwrapper-1.9.jar" sourcepath="externals/launchwrapper/src"/>
13 - <classpathentry exported="true" kind="lib" path="lib/asm-debug-all-4.1.jar"/>  
14 - <classpathentry kind="lib" path="/Client/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar"/> 13 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar"/>
15 <classpathentry kind="lib" path="/Client/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar"/> 14 <classpathentry kind="lib" path="/Client/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar"/>
16 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar"/> 15 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar"/>
17 - <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/mojang/authlib/1.3/authlib-1.3.jar"/>  
18 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar"/> 16 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar"/>
19 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar"/> 17 <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar"/>
20 - <classpathentry kind="lib" path="/Client/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar"/> 18 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar"/>
  19 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/com/mojang/authlib/1.5.13/authlib-1.5.13.jar"/>
  20 + <classpathentry exported="true" kind="lib" path="/Client/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar"/>
  21 + <classpathentry exported="true" kind="lib" path="lib/asm-debug-all-5.0.3.jar"/>
21 <classpathentry kind="output" path="bin"/> 22 <classpathentry kind="output" path="bin"/>
22 </classpath> 23 </classpath>
LiteLoader.iml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <module type="JAVA_MODULE" version="4"> 2 <module type="JAVA_MODULE" version="4">
3 <component name="EclipseModuleManager"> 3 <component name="EclipseModuleManager">
4 - <libelement value="jar://$MCP_LOC$/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.0/lwjgl-2.9.0.jar!/" />  
5 - <libelement value="jar://$MCP_LOC$/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/" />  
6 - <libelement value="jar://$MCP_LOC$/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar!/" />  
7 - <libelement value="jar://$MCP_LOC$/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar!/" /> 4 + <libelement value="file:///Client/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" />
  5 + <libelement value="file:///Client/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar" />
  6 + <libelement value="file:///Client/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar" />
8 <libelement value="jar://$MODULE_DIR$/lib/launchwrapper-1.9.jar!/" /> 7 <libelement value="jar://$MODULE_DIR$/lib/launchwrapper-1.9.jar!/" />
9 <libelement value="jar://$MODULE_DIR$/lib/asm-debug-all-4.1.jar!/" /> 8 <libelement value="jar://$MODULE_DIR$/lib/asm-debug-all-4.1.jar!/" />
10 - <libelement value="jar://$MCP_LOC$/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar!/" />  
11 - <libelement value="jar://$MCP_LOC$/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar!/" />  
12 - <libelement value="jar://$MCP_LOC$/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar!/" />  
13 - <libelement value="jar://$MCP_LOC$/jars/libraries/com/mojang/authlib/1.3/authlib-1.3.jar!/" />  
14 - <libelement value="jar://$MCP_LOC$/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar!/" />  
15 - <libelement value="jar://$MCP_LOC$/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar!/" />  
16 - <libelement value="jar://$MCP_LOC$/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar!/" /> 9 + <libelement value="file:///Client/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar" />
  10 + <libelement value="file:///Client/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar" />
  11 + <libelement value="file:///Client/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar" />
  12 + <libelement value="file:///Client/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar" />
  13 + <libelement value="file:///Client/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar" />
  14 + <libelement value="file:///Client/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar" />
  15 + <libelement value="file:///Client/jars/libraries/com/mojang/authlib/1.5.13/authlib-1.5.13.jar" />
  16 + <libelement value="file:///Client/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar" />
17 <src_description expected_position="0"> 17 <src_description expected_position="0">
18 - <src_folder value="file://$MODULE_DIR$/java" expected_position="0" />  
19 - <src_folder value="file://$MODULE_DIR$/debug" expected_position="1" />  
20 - <src_folder value="file://$MODULE_DIR$/resources" expected_position="2" /> 18 + <src_folder value="file://$MODULE_DIR$/debug" expected_position="0" />
  19 + <src_folder value="file://$MODULE_DIR$/resources" expected_position="1" />
  20 + <src_folder value="file://$MODULE_DIR$/java/common" expected_position="2" />
  21 + <src_folder value="file://$MODULE_DIR$/java/client" expected_position="3" />
21 </src_description> 22 </src_description>
22 </component> 23 </component>
23 <component name="NewModuleRootManager" inherit-compiler-output="false"> 24 <component name="NewModuleRootManager" inherit-compiler-output="false">
24 <output url="file://$MODULE_DIR$/bin" /> 25 <output url="file://$MODULE_DIR$/bin" />
25 <exclude-output /> 26 <exclude-output />
26 <content url="file://$MODULE_DIR$"> 27 <content url="file://$MODULE_DIR$">
27 - <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />  
28 <sourceFolder url="file://$MODULE_DIR$/debug" isTestSource="false" /> 28 <sourceFolder url="file://$MODULE_DIR$/debug" isTestSource="false" />
29 <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" /> 29 <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
  30 + <sourceFolder url="file://$MODULE_DIR$/java/common" isTestSource="false" />
  31 + <sourceFolder url="file://$MODULE_DIR$/java/client" isTestSource="false" />
30 </content> 32 </content>
31 <orderEntry type="sourceFolder" forTests="false" /> 33 <orderEntry type="sourceFolder" forTests="false" />
32 <orderEntry type="module" module-name="Client" exported="" /> 34 <orderEntry type="module" module-name="Client" exported="" />
33 <orderEntry type="jdk" jdkName="JavaSE-1.6" jdkType="JavaSDK" /> 35 <orderEntry type="jdk" jdkName="JavaSE-1.6" jdkType="JavaSDK" />
34 <orderEntry type="module-library" exported=""> 36 <orderEntry type="module-library" exported="">
35 - <library name="lwjgl-2.9.0.jar">  
36 - <CLASSES>  
37 - <root url="jar://$MCP_LOC$/jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.0/lwjgl-2.9.0.jar!/" />  
38 - </CLASSES>  
39 - <JAVADOC />  
40 - <SOURCES />  
41 - </library>  
42 - </orderEntry>  
43 - <orderEntry type="module-library">  
44 - <library name="gson-2.2.4.jar">  
45 - <CLASSES>  
46 - <root url="jar://$MCP_LOC$/jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/" />  
47 - </CLASSES>  
48 - <JAVADOC />  
49 - <SOURCES />  
50 - </library>  
51 - </orderEntry>  
52 - <orderEntry type="module-library">  
53 - <library name="guava-15.0.jar">  
54 - <CLASSES>  
55 - <root url="jar://$MCP_LOC$/jars/libraries/com/google/guava/guava/15.0/guava-15.0.jar!/" />  
56 - </CLASSES>  
57 - <JAVADOC />  
58 - <SOURCES />  
59 - </library>  
60 - </orderEntry>  
61 - <orderEntry type="module-library">  
62 - <library name="commons-io-2.4.jar">  
63 - <CLASSES>  
64 - <root url="jar://$MCP_LOC$/jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar!/" />  
65 - </CLASSES>  
66 - <JAVADOC />  
67 - <SOURCES />  
68 - </library>  
69 - </orderEntry>  
70 - <orderEntry type="module-library" exported="">  
71 <library name="launchwrapper-1.9.jar"> 37 <library name="launchwrapper-1.9.jar">
72 <CLASSES> 38 <CLASSES>
73 <root url="jar://$MODULE_DIR$/lib/launchwrapper-1.9.jar!/" /> 39 <root url="jar://$MODULE_DIR$/lib/launchwrapper-1.9.jar!/" />
@@ -79,72 +45,9 @@ @@ -79,72 +45,9 @@
79 </library> 45 </library>
80 </orderEntry> 46 </orderEntry>
81 <orderEntry type="module-library" exported=""> 47 <orderEntry type="module-library" exported="">
82 - <library name="asm-debug-all-4.1.jar">  
83 - <CLASSES>  
84 - <root url="jar://$MODULE_DIR$/lib/asm-debug-all-4.1.jar!/" />  
85 - </CLASSES>  
86 - <JAVADOC />  
87 - <SOURCES />  
88 - </library>  
89 - </orderEntry>  
90 - <orderEntry type="module-library">  
91 - <library name="commons-lang3-3.1.jar">  
92 - <CLASSES>  
93 - <root url="jar://$MCP_LOC$/jars/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar!/" />  
94 - </CLASSES>  
95 - <JAVADOC />  
96 - <SOURCES />  
97 - </library>  
98 - </orderEntry>  
99 - <orderEntry type="module-library">  
100 - <library name="jopt-simple-4.5.jar">  
101 - <CLASSES>  
102 - <root url="jar://$MCP_LOC$/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar!/" />  
103 - </CLASSES>  
104 - <JAVADOC />  
105 - <SOURCES />  
106 - </library>  
107 - </orderEntry>  
108 - <orderEntry type="module-library" exported="">  
109 - <library name="netty-all-4.0.10.Final.jar">  
110 - <CLASSES>  
111 - <root url="jar://$MCP_LOC$/jars/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar!/" />  
112 - </CLASSES>  
113 - <JAVADOC />  
114 - <SOURCES />  
115 - </library>  
116 - </orderEntry>  
117 - <orderEntry type="module-library" exported="">  
118 - <library name="authlib-1.3.jar">  
119 - <CLASSES>  
120 - <root url="jar://$MCP_LOC$/jars/libraries/com/mojang/authlib/1.3/authlib-1.3.jar!/" />  
121 - </CLASSES>  
122 - <JAVADOC />  
123 - <SOURCES />  
124 - </library>  
125 - </orderEntry>  
126 - <orderEntry type="module-library" exported="">  
127 - <library name="log4j-api-2.0-beta9.jar">  
128 - <CLASSES>  
129 - <root url="jar://$MCP_LOC$/jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar!/" />  
130 - </CLASSES>  
131 - <JAVADOC />  
132 - <SOURCES />  
133 - </library>  
134 - </orderEntry>  
135 - <orderEntry type="module-library" exported="">  
136 - <library name="log4j-core-2.0-beta9.jar">  
137 - <CLASSES>  
138 - <root url="jar://$MCP_LOC$/jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar!/" />  
139 - </CLASSES>  
140 - <JAVADOC />  
141 - <SOURCES />  
142 - </library>  
143 - </orderEntry>  
144 - <orderEntry type="module-library">  
145 - <library name="jinput-2.0.5.jar"> 48 + <library>
146 <CLASSES> 49 <CLASSES>
147 - <root url="jar://$MCP_LOC$/jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar!/" /> 50 + <root url="jar://$MODULE_DIR$/lib/asm-debug-all-5.0.3.jar!/" />
148 </CLASSES> 51 </CLASSES>
149 <JAVADOC /> 52 <JAVADOC />
150 <SOURCES /> 53 <SOURCES />
README.md 0 โ†’ 100644
  1 +LiteLoader
  2 +----------
  3 +
  4 +Important Setup Note
  5 +--------------------
  6 +MCP 9.08 does not include the latest MCPBot mappings, since developing mods without these updated
  7 +mappings is a massive nuisance LiteLoader is built using a recent snapshot of the MCP mappings.
  8 +
  9 +Getting the updated mappings
  10 +----------------------------
  11 +
  12 +To get the updated mappings, perform these steps **before** decompiling minecraft for the first
  13 +time. If you have already decompiled minecraft, run the MPC **cleanup** task first to remove the
  14 +invalid sources.
  15 +
  16 +- Using a text editor, open **/mcp908/conf/mcp.conf**
  17 +- Locate the setting **UpdateUrl** and change the domain to *dl.liteloader.com* as shown
  18 +
  19 + UpdateUrl = http://dl.liteloader.com/files/mcprolling_{version}/
  20 +
  21 +- Save the file and run the **updatemcp** script, it should prompt you to download 6 files.
  22 +- Run **decompile** as normal
0 \ No newline at end of file 23 \ No newline at end of file
ant/build_liteloader.xml
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="tasks/ant-contrib.jar" /> 4 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="tasks/ant-contrib.jar" />
5 5
6 <!-- Versions !!IMPORTANT --> 6 <!-- Versions !!IMPORTANT -->
7 - <property name="version" value="1.7.2_04" />  
8 - <property name="mcversion" value="1.7.2" /> 7 + <property name="version" value="1.7.10" />
  8 + <property name="mcversion" value="1.7.10" />
9 <property name="author" value="Mumfrey" /> 9 <property name="author" value="Mumfrey" />
10 10
11 <!-- Project definitions and dependencies --> 11 <!-- Project definitions and dependencies -->
@@ -97,6 +97,21 @@ @@ -97,6 +97,21 @@
97 </copy> 97 </copy>
98 </target> 98 </target>
99 99
  100 + <target name="contributeloadersource" description="Contribute a liteloader source code set to the source path">
  101 + <echo level="info" message="Contributing source set '${set}' for project ${lib}" />
  102 + <copy todir="${src}" verbose="false" overwrite="true" failonerror="false">
  103 + <fileset dir="${eclipse}/${lib}/java/${set}">
  104 + <exclude name="**/debug" />
  105 + <exclude name="**/debug/*.java" />
  106 + </fileset>
  107 + <filterchain>
  108 + <linecontains negate="true">
  109 + <contains value="@MCPONLY${skipremoval}" />
  110 + </linecontains>
  111 + </filterchain>
  112 + </copy>
  113 + </target>
  114 +
100 <target name="contributeresources" description="Contribute resources to the staging path"> 115 <target name="contributeresources" description="Contribute resources to the staging path">
101 <echo level="info" message="Contributing project resources for ${lib}" /> 116 <echo level="info" message="Contributing project resources for ${lib}" />
102 <copy todir="${stage.dir}" verbose="false" failonerror="false"> 117 <copy todir="${stage.dir}" verbose="false" failonerror="false">
@@ -155,8 +170,14 @@ @@ -155,8 +170,14 @@
155 <echo level="info" message="Contributing upstream projects" /> 170 <echo level="info" message="Contributing upstream projects" />
156 <foreach list="${upstream}" param="lib" target="contributesource" /> 171 <foreach list="${upstream}" param="lib" target="contributesource" />
157 172
158 - <antcall target="contributesource"> 173 + <antcall target="contributeloadersource">
  174 + <param name="lib" value="${project}" />
  175 + <param name="set" value="common" />
  176 + </antcall>
  177 +
  178 + <antcall target="contributeloadersource">
159 <param name="lib" value="${project}" /> 179 <param name="lib" value="${project}" />
  180 + <param name="set" value="client" />
160 </antcall> 181 </antcall>
161 </target> 182 </target>
162 183
@@ -258,8 +279,8 @@ @@ -258,8 +279,8 @@
258 <property environment="env" /> 279 <property environment="env" />
259 280
260 <target name="deploy" depends="production" description="Deploy artifact to local minecraft installation in APPDATA"> 281 <target name="deploy" depends="production" description="Deploy artifact to local minecraft installation in APPDATA">
261 - <mkdir dir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/1.7.2"/>  
262 - <copy todir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/1.7.2" file="${dist.dir}/${ant.project.name}-${mcversion}.${filetype}" failonerror="false" overwrite="true" /> 282 + <mkdir dir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}"/>
  283 + <copy todir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}" file="${dist.dir}/${ant.project.name}-${mcversion}.${filetype}" failonerror="false" overwrite="true" />
263 <copy todir="${eclipse}/Installer/src/main/resources" file="${dist.dir}/${ant.project.name}-${mcversion}.${filetype}" failonerror="false" overwrite="true" /> 284 <copy todir="${eclipse}/Installer/src/main/resources" file="${dist.dir}/${ant.project.name}-${mcversion}.${filetype}" failonerror="false" overwrite="true" />
264 </target> 285 </target>
265 </project> 286 </project>
266 \ No newline at end of file 287 \ No newline at end of file
debug/com/mumfrey/liteloader/debug/LoginManager.java
@@ -17,8 +17,10 @@ import com.google.gson.GsonBuilder; @@ -17,8 +17,10 @@ import com.google.gson.GsonBuilder;
17 import com.google.gson.annotations.SerializedName; 17 import com.google.gson.annotations.SerializedName;
18 import com.mojang.authlib.Agent; 18 import com.mojang.authlib.Agent;
19 import com.mojang.authlib.GameProfile; 19 import com.mojang.authlib.GameProfile;
  20 +import com.mojang.authlib.UserType;
20 import com.mojang.authlib.exceptions.AuthenticationException; 21 import com.mojang.authlib.exceptions.AuthenticationException;
21 import com.mojang.authlib.exceptions.InvalidCredentialsException; 22 import com.mojang.authlib.exceptions.InvalidCredentialsException;
  23 +import com.mojang.authlib.properties.PropertyMap;
22 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; 24 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
23 import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; 25 import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
24 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 26 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
@@ -292,7 +294,7 @@ public class LoginManager @@ -292,7 +294,7 @@ public class LoginManager
292 public String getUUID() 294 public String getUUID()
293 { 295 {
294 GameProfile selectedProfile = this.authentication.getSelectedProfile(); 296 GameProfile selectedProfile = this.authentication.getSelectedProfile();
295 - return selectedProfile != null ? selectedProfile.getId() : this.defaultDisplayName; 297 + return selectedProfile != null ? selectedProfile.getId().toString().replace("-", "") : this.defaultDisplayName;
296 } 298 }
297 299
298 /** 300 /**
@@ -304,6 +306,18 @@ public class LoginManager @@ -304,6 +306,18 @@ public class LoginManager
304 return accessToken != null ? accessToken : "-"; 306 return accessToken != null ? accessToken : "-";
305 } 307 }
306 308
  309 + public String getUserType()
  310 + {
  311 + UserType userType = this.authentication.getUserType();
  312 + return (userType != null ? userType : UserType.LEGACY).toString().toLowerCase();
  313 + }
  314 +
  315 + public String getUserProperties()
  316 + {
  317 + PropertyMap userProperties = this.authentication.getUserProperties();
  318 + return userProperties != null ? userProperties.toString() : "{}";
  319 + }
  320 +
307 /** 321 /**
308 * Struct for Gson serialisation of authenticaion settings 322 * Struct for Gson serialisation of authenticaion settings
309 * 323 *
@@ -318,7 +332,7 @@ public class LoginManager @@ -318,7 +332,7 @@ public class LoginManager
318 private boolean workOffline; 332 private boolean workOffline;
319 333
320 @SerializedName("authData") 334 @SerializedName("authData")
321 - private Map<String, String> credentials; 335 + private Map<String, Object> credentials;
322 336
323 public AuthData() 337 public AuthData()
324 { 338 {
@@ -344,7 +358,7 @@ public class LoginManager @@ -344,7 +358,7 @@ public class LoginManager
344 public boolean validate() 358 public boolean validate()
345 { 359 {
346 if (this.clientToken == null) this.clientToken = UUID.randomUUID().toString(); 360 if (this.clientToken == null) this.clientToken = UUID.randomUUID().toString();
347 - if (this.credentials == null) this.credentials = new HashMap<String, String>(); 361 + if (this.credentials == null) this.credentials = new HashMap<String, Object>();
348 return true; 362 return true;
349 } 363 }
350 364
@@ -370,12 +384,12 @@ public class LoginManager @@ -370,12 +384,12 @@ public class LoginManager
370 384
371 public String getUsername() 385 public String getUsername()
372 { 386 {
373 - return this.credentials != null ? this.credentials.get("username") : null; 387 + return this.credentials != null ? this.credentials.get("username").toString() : null;
374 } 388 }
375 389
376 public String getDisplayName() 390 public String getDisplayName()
377 { 391 {
378 - return this.credentials != null && this.credentials.containsKey("displayName") ? this.credentials.get("displayName") : System.getProperty("user.name"); 392 + return this.credentials != null && this.credentials.containsKey("displayName") ? this.credentials.get("displayName").toString() : System.getProperty("user.name");
379 } 393 }
380 } 394 }
381 } 395 }
debug/com/mumfrey/liteloader/debug/ServerStart.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.debug;
  2 +import java.io.File;
  3 +import java.util.ArrayList;
  4 +import java.util.Arrays;
  5 +import java.util.List;
  6 +
  7 +import net.minecraft.launchwrapper.Launch;
  8 +
  9 +import com.mumfrey.liteloader.launch.LiteLoaderTweakerServer;
  10 +
  11 +/**
  12 + * Wrapper class for LaunchWrapper Main class, which logs into minecraft.net first so that online shizzle can be tested
  13 + *
  14 + * @author Adam Mummery-Smith
  15 + * @version 0.6.2
  16 + */
  17 +public abstract class ServerStart
  18 +{
  19 + private static final String FML_TWEAKER_NAME = "cpw.mods.fml.common.launcher.FMLTweaker";
  20 +
  21 + /**
  22 + * Entry point.
  23 + *
  24 + * @param args
  25 + */
  26 + public static void main(String[] args)
  27 + {
  28 + System.setProperty("mcpenv", "true");
  29 +
  30 + boolean fmlDetected = false;
  31 + List<String> argsList = new ArrayList<String>(Arrays.asList(args));
  32 +
  33 + // Detect the FML tweaker specified on the command line, this likely means someone has pulled us
  34 + // into a Forge MCP workspace
  35 + for (String arg : argsList) fmlDetected |= FML_TWEAKER_NAME.equals(arg);
  36 +
  37 + if (fmlDetected)
  38 + {
  39 + argsList.clear();
  40 + argsList.add("--tweakClass");argsList.add(FML_TWEAKER_NAME);
  41 + }
  42 +
  43 + File gameDir = new File(System.getProperty("user.dir"));
  44 + File assetsDir = new File(gameDir, "assets");
  45 +
  46 + argsList.add("--tweakClass"); argsList.add(LiteLoaderTweakerServer.class.getName());
  47 + argsList.add("--version"); argsList.add("mcp");
  48 + argsList.add("--gameDir"); argsList.add(gameDir.getAbsolutePath());
  49 + argsList.add("--assetsDir"); argsList.add(assetsDir.getAbsolutePath());
  50 +
  51 + Launch.main(argsList.toArray(args));
  52 + }
  53 +}
debug/com/mumfrey/liteloader/debug/Start.java
1 package com.mumfrey.liteloader.debug; 1 package com.mumfrey.liteloader.debug;
2 import java.io.File; 2 import java.io.File;
3 import java.util.ArrayList; 3 import java.util.ArrayList;
  4 +import java.util.Arrays;
4 import java.util.List; 5 import java.util.List;
5 6
6 import net.minecraft.launchwrapper.Launch; 7 import net.minecraft.launchwrapper.Launch;
@@ -12,7 +13,6 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger; @@ -12,7 +13,6 @@ import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
12 * Wrapper class for LaunchWrapper Main class, which logs into minecraft.net first so that online shizzle can be tested 13 * Wrapper class for LaunchWrapper Main class, which logs into minecraft.net first so that online shizzle can be tested
13 * 14 *
14 * @author Adam Mummery-Smith 15 * @author Adam Mummery-Smith
15 - * @version 0.6.2  
16 */ 16 */
17 public abstract class Start 17 public abstract class Start
18 { 18 {
@@ -28,20 +28,28 @@ public abstract class Start @@ -28,20 +28,28 @@ public abstract class Start
28 System.setProperty("mcpenv", "true"); 28 System.setProperty("mcpenv", "true");
29 29
30 boolean fmlDetected = false; 30 boolean fmlDetected = false;
31 - List<String> argsList = new ArrayList<String>(); 31 + List<String> argsList = new ArrayList<String>(Arrays.asList(args));
32 32
33 // Detect the FML tweaker specified on the command line, this likely means someone has pulled us 33 // Detect the FML tweaker specified on the command line, this likely means someone has pulled us
34 // into a Forge MCP workspace 34 // into a Forge MCP workspace
35 - for (String arg : args) fmlDetected |= FML_TWEAKER_NAME.equals(arg); 35 + for (String arg : argsList) fmlDetected |= FML_TWEAKER_NAME.equals(arg);
36 36
37 if (fmlDetected) 37 if (fmlDetected)
38 { 38 {
39 - args = new String[0]; 39 + argsList.clear();
40 argsList.add("--tweakClass");argsList.add(FML_TWEAKER_NAME); 40 argsList.add("--tweakClass");argsList.add(FML_TWEAKER_NAME);
41 } 41 }
  42 +
  43 + String usernameFromCmdLine = null;
  44 + String passwordFromCmdLine = null;
  45 +
  46 + if (argsList.size() > 0 && !argsList.get(0).startsWith("-"))
  47 + {
  48 + usernameFromCmdLine = argsList.remove(0);
42 49
43 - String usernameFromCmdLine = (args.length > 0) ? args[0] : null;  
44 - String passwordFromCmdLine = (args.length > 1) ? args[1] : null; 50 + if (argsList.size() > 0 && !argsList.get(0).startsWith("-"))
  51 + passwordFromCmdLine = argsList.remove(0);
  52 + }
45 53
46 File loginJson = new File(new File(System.getProperty("user.dir")), ".auth.json"); 54 File loginJson = new File(new File(System.getProperty("user.dir")), ".auth.json");
47 LoginManager loginManager = new LoginManager(loginJson); 55 LoginManager loginManager = new LoginManager(loginJson);
@@ -50,15 +58,18 @@ public abstract class Start @@ -50,15 +58,18 @@ public abstract class Start
50 LiteLoaderLogger.info("Launching game as %s", loginManager.getProfileName()); 58 LiteLoaderLogger.info("Launching game as %s", loginManager.getProfileName());
51 59
52 File gameDir = new File(System.getProperty("user.dir")); 60 File gameDir = new File(System.getProperty("user.dir"));
53 - File assetsDir = new File(gameDir, "assets/virtual/legacy"); 61 + File assetsDir = new File(gameDir, "assets");
54 62
55 - argsList.add("--tweakClass"); argsList.add(LiteLoaderTweaker.class.getName());  
56 - argsList.add("--username"); argsList.add(loginManager.getProfileName());  
57 - argsList.add("--uuid"); argsList.add(loginManager.getUUID());  
58 - argsList.add("--accessToken"); argsList.add(loginManager.getAuthenticatedToken());  
59 - argsList.add("--version"); argsList.add("mcp");  
60 - argsList.add("--gameDir"); argsList.add(gameDir.getAbsolutePath());  
61 - argsList.add("--assetsDir"); argsList.add(assetsDir.getAbsolutePath()); 63 + argsList.add("--tweakClass"); argsList.add(LiteLoaderTweaker.class.getName());
  64 + argsList.add("--username"); argsList.add(loginManager.getProfileName());
  65 + argsList.add("--uuid"); argsList.add(loginManager.getUUID());
  66 + argsList.add("--accessToken"); argsList.add(loginManager.getAuthenticatedToken());
  67 + argsList.add("--userType"); argsList.add(loginManager.getUserType());
  68 + argsList.add("--userProperties"); argsList.add(loginManager.getUserProperties());
  69 + argsList.add("--version"); argsList.add("mcp");
  70 + argsList.add("--gameDir"); argsList.add(gameDir.getAbsolutePath());
  71 + argsList.add("--assetIndex"); argsList.add(LiteLoaderTweaker.VERSION);
  72 + argsList.add("--assetsDir"); argsList.add(assetsDir.getAbsolutePath());
62 73
63 Launch.main(argsList.toArray(args)); 74 Launch.main(argsList.toArray(args));
64 } 75 }
debug/obfuscation.properties 0 โ†’ 100644
  1 +field_71424_I=mcProfiler
  2 +field_78729_o=entityRenderMap field_110546_b=reloadListeners
  3 +func_148833_a=processPacket func_71411_J=runGameLoop func_71407_l=runTick func_78480_b=updateCameraAndRender func_78471_a=renderWorld func_73830_a=renderGameOverlay func_76320_a=startSection func_76319_b=endSection func_76318_c=endStartSection
  4 +func_72368_a=recreatePlayerEntity func_72355_a=initializeConnectionToPlayer func_72377_c=playerLoggedIn func_72367_e=playerLoggedOut
  5 +func_71384_a=startGame
  6 +func_71197_b=startServer
  7 +func_71256_s=startServerThread
  8 +func_71165_d=sendChatMessage
  9 +func_148545_a=createPlayerForUser
  10 +func_147119_ah=updateFramebufferSize
  11 +field_82596_a=registryObjects
  12 +field_148759_a=underlyingIntegerMap
  13 +#field_148749_a=
  14 +#field_148748_b=
  15 +field_147559_m=mapSpecialRenderers
  16 +field_145855_i=nameToClassMap
  17 +field_145853_j=classToNameMap
0 \ No newline at end of file 18 \ No newline at end of file
java/com/mumfrey/liteloader/ChatFilter.java renamed to java/client/com/mumfrey/liteloader/ChatFilter.java
java/com/mumfrey/liteloader/ChatListener.java renamed to java/client/com/mumfrey/liteloader/ChatListener.java
java/com/mumfrey/liteloader/ChatRenderListener.java renamed to java/client/com/mumfrey/liteloader/ChatRenderListener.java
java/com/mumfrey/liteloader/GameLoopListener.java renamed to java/client/com/mumfrey/liteloader/GameLoopListener.java
@@ -7,7 +7,7 @@ import net.minecraft.client.Minecraft; @@ -7,7 +7,7 @@ import net.minecraft.client.Minecraft;
7 * 7 *
8 * @author Adam Mummery-Smith 8 * @author Adam Mummery-Smith
9 */ 9 */
10 -public interface GameLoopListener 10 +public interface GameLoopListener extends LiteMod
11 { 11 {
12 /** 12 /**
13 * Called every frame, before the world is ticked 13 * Called every frame, before the world is ticked
java/com/mumfrey/liteloader/HUDRenderListener.java renamed to java/client/com/mumfrey/liteloader/HUDRenderListener.java
@@ -5,7 +5,7 @@ package com.mumfrey.liteloader; @@ -5,7 +5,7 @@ package com.mumfrey.liteloader;
5 * 5 *
6 * @author Adam Mummery-Smith 6 * @author Adam Mummery-Smith
7 */ 7 */
8 -public interface HUDRenderListener 8 +public interface HUDRenderListener extends LiteMod
9 { 9 {
10 public abstract void onPreRenderHUD(int screenWidth, int screenHeight); 10 public abstract void onPreRenderHUD(int screenWidth, int screenHeight);
11 11
java/com/mumfrey/liteloader/InitCompleteListener.java renamed to java/client/com/mumfrey/liteloader/InitCompleteListener.java
java/client/com/mumfrey/liteloader/OutboundChatFilter.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader;
  2 +
  3 +/**
  4 + * Interface for mods which want to filter outbound chat
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface OutboundChatFilter extends LiteMod
  9 +{
  10 + /**
  11 + * Raised when a chat message is being sent, return false to filter this message or true to allow it to be sent
  12 + *
  13 + * @param message
  14 + */
  15 + public abstract boolean onSendChatMessage(String message);
  16 +}
java/com/mumfrey/liteloader/OutboundChatListener.java renamed to java/client/com/mumfrey/liteloader/OutboundChatListener.java
java/com/mumfrey/liteloader/PostLoginListener.java renamed to java/client/com/mumfrey/liteloader/PostLoginListener.java
java/com/mumfrey/liteloader/PostRenderListener.java renamed to java/client/com/mumfrey/liteloader/PostRenderListener.java
java/com/mumfrey/liteloader/RenderListener.java renamed to java/client/com/mumfrey/liteloader/RenderListener.java
java/com/mumfrey/liteloader/Tickable.java renamed to java/client/com/mumfrey/liteloader/Tickable.java
java/client/com/mumfrey/liteloader/ViewportListener.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.client.gui.ScaledResolution;
  4 +
  5 +public interface ViewportListener extends LiteMod
  6 +{
  7 + public abstract void onViewportResized(ScaledResolution resolution, int displayWidth, int displayHeight);
  8 +
  9 + public abstract void onFullScreenToggled(boolean fullScreen);
  10 +}
java/com/mumfrey/liteloader/core/transformers/InjectedCallbackProxy.java renamed to java/client/com/mumfrey/liteloader/client/CallbackProxyClient.java
1 -package com.mumfrey.liteloader.core.transformers; 1 +package com.mumfrey.liteloader.client;
2 2
3 import net.minecraft.client.Minecraft; 3 import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.entity.EntityClientPlayerMP;
4 import net.minecraft.entity.player.EntityPlayerMP; 5 import net.minecraft.entity.player.EntityPlayerMP;
5 import net.minecraft.network.INetHandler; 6 import net.minecraft.network.INetHandler;
6 import net.minecraft.network.NetworkManager; 7 import net.minecraft.network.NetworkManager;
@@ -19,35 +20,30 @@ import net.minecraft.world.WorldSettings; @@ -19,35 +20,30 @@ import net.minecraft.world.WorldSettings;
19 20
20 import com.mojang.authlib.GameProfile; 21 import com.mojang.authlib.GameProfile;
21 import com.mumfrey.liteloader.core.ClientPluginChannels; 22 import com.mumfrey.liteloader.core.ClientPluginChannels;
22 -import com.mumfrey.liteloader.core.Events;  
23 import com.mumfrey.liteloader.core.LiteLoader; 23 import com.mumfrey.liteloader.core.LiteLoader;
24 import com.mumfrey.liteloader.core.ServerPluginChannels; 24 import com.mumfrey.liteloader.core.ServerPluginChannels;
  25 +import com.mumfrey.liteloader.transformers.event.EventInfo;
25 26
26 /** 27 /**
27 - * Proxy class which handles the redirected calls from the injected packet hooks and routes them to the 28 + * Proxy class which handles the redirected calls from the injected callbacks and routes them to the
28 * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet 29 * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet
29 * classes themselves because this is easier to maintain. 30 * classes themselves because this is easier to maintain.
30 * 31 *
31 * @author Adam Mummery-Smith 32 * @author Adam Mummery-Smith
32 */ 33 */
33 -public class InjectedCallbackProxy 34 +public class CallbackProxyClient
34 { 35 {
35 /** 36 /**
36 - * Initialisation done  
37 - */  
38 - private static boolean initDone = false;  
39 -  
40 - /**  
41 * Tick clock, sent as a flag to the core onTick so that mods know it's a new tick 37 * Tick clock, sent as a flag to the core onTick so that mods know it's a new tick
42 */ 38 */
43 private static boolean clock = false; 39 private static boolean clock = false;
44 40
45 - private static Events events; 41 + private static ClientEvents events;
46 42
47 public static void handleLoginSuccessPacket(INetHandler netHandler, S02PacketLoginSuccess packet) 43 public static void handleLoginSuccessPacket(INetHandler netHandler, S02PacketLoginSuccess packet)
48 { 44 {
49 ((INetHandlerLoginClient)netHandler).handleLoginSuccess(packet); 45 ((INetHandlerLoginClient)netHandler).handleLoginSuccess(packet);
50 - InjectedCallbackProxy.events.onPostLogin((INetHandlerLoginClient)netHandler, packet); 46 + CallbackProxyClient.events.onPostLogin((INetHandlerLoginClient)netHandler, packet);
51 } 47 }
52 48
53 /** 49 /**
@@ -58,8 +54,7 @@ public class InjectedCallbackProxy @@ -58,8 +54,7 @@ public class InjectedCallbackProxy
58 */ 54 */
59 public static void handleChatPacket(INetHandler netHandler, S02PacketChat packet) 55 public static void handleChatPacket(INetHandler netHandler, S02PacketChat packet)
60 { 56 {
61 -// Events events = LiteLoader.getEvents();  
62 - if (InjectedCallbackProxy.events.onChat(packet)) 57 + if (CallbackProxyClient.events.onChat(packet))
63 { 58 {
64 ((INetHandlerPlayClient)netHandler).handleChat(packet); 59 ((INetHandlerPlayClient)netHandler).handleChat(packet);
65 } 60 }
@@ -73,8 +68,7 @@ public class InjectedCallbackProxy @@ -73,8 +68,7 @@ public class InjectedCallbackProxy
73 */ 68 */
74 public static void handleServerChatPacket(INetHandler netHandler, C01PacketChatMessage packet) 69 public static void handleServerChatPacket(INetHandler netHandler, C01PacketChatMessage packet)
75 { 70 {
76 -// Events events = LiteLoader.getEvents();  
77 - if (InjectedCallbackProxy.events.onServerChat((INetHandlerPlayServer)netHandler, packet)) 71 + if (CallbackProxyClient.events.onServerChat((INetHandlerPlayServer)netHandler, packet))
78 { 72 {
79 ((INetHandlerPlayServer)netHandler).processChatMessage(packet); 73 ((INetHandlerPlayServer)netHandler).processChatMessage(packet);
80 } 74 }
@@ -88,11 +82,10 @@ public class InjectedCallbackProxy @@ -88,11 +82,10 @@ public class InjectedCallbackProxy
88 */ 82 */
89 public static void handleJoinGamePacket(INetHandler netHandler, S01PacketJoinGame packet) 83 public static void handleJoinGamePacket(INetHandler netHandler, S01PacketJoinGame packet)
90 { 84 {
91 -// Events events = LiteLoader.getEvents();  
92 - if (InjectedCallbackProxy.events.onPreJoinGame(netHandler, packet)) 85 + if (CallbackProxyClient.events.onPreJoinGame(netHandler, packet))
93 { 86 {
94 ((INetHandlerPlayClient)netHandler).handleJoinGame(packet); 87 ((INetHandlerPlayClient)netHandler).handleJoinGame(packet);
95 - InjectedCallbackProxy.events.onJoinGame(netHandler, packet); 88 + CallbackProxyClient.events.onJoinGame(netHandler, packet);
96 } 89 }
97 } 90 }
98 91
@@ -124,74 +117,74 @@ public class InjectedCallbackProxy @@ -124,74 +117,74 @@ public class InjectedCallbackProxy
124 pluginChannels.onPluginChannelMessage((INetHandlerPlayServer)netHandler, packet); 117 pluginChannels.onPluginChannelMessage((INetHandlerPlayServer)netHandler, packet);
125 } 118 }
126 119
  120 + public static void onStartupComplete(int ref, Minecraft minecraft)
  121 + {
  122 + CallbackProxyClient.events = ClientEvents.getInstance();
  123 + CallbackProxyClient.events.onStartupComplete();
  124 + }
  125 +
127 public static void onTimerUpdate(int ref) 126 public static void onTimerUpdate(int ref)
128 { 127 {
129 - if (!InjectedCallbackProxy.initDone)  
130 - {  
131 - InjectedCallbackProxy.initDone = true;  
132 - InjectedCallbackProxy.events = LiteLoader.getEvents();  
133 - InjectedCallbackProxy.events.preBeginGame();  
134 - }  
135 -  
136 - InjectedCallbackProxy.events.onTimerUpdate(); 128 + CallbackProxyClient.events.onTimerUpdate();
137 } 129 }
138 130
139 public static void onAnimateTick(int ref) 131 public static void onAnimateTick(int ref)
140 { 132 {
141 - InjectedCallbackProxy.clock = true; 133 + CallbackProxyClient.clock = true;
142 } 134 }
143 135
144 public static void onTick(int ref) 136 public static void onTick(int ref)
145 { 137 {
146 if (ref == 2) 138 if (ref == 2)
147 { 139 {
148 - InjectedCallbackProxy.events.onTick(InjectedCallbackProxy.clock); 140 + CallbackProxyClient.events.onTick(CallbackProxyClient.clock);
  141 + CallbackProxyClient.clock = false;
149 } 142 }
150 } 143 }
151 144
152 public static void onRender(int ref) 145 public static void onRender(int ref)
153 { 146 {
154 - InjectedCallbackProxy.events.onRender(); 147 + CallbackProxyClient.events.onRender();
155 } 148 }
156 149
157 public static void preRenderGUI(int ref) 150 public static void preRenderGUI(int ref)
158 { 151 {
159 if (ref == 1) 152 if (ref == 1)
160 { 153 {
161 - InjectedCallbackProxy.events.preRenderGUI(ref); 154 + CallbackProxyClient.events.preRenderGUI(ref);
162 } 155 }
163 } 156 }
164 157
165 public static void onSetupCameraTransform(int ref) 158 public static void onSetupCameraTransform(int ref)
166 { 159 {
167 - InjectedCallbackProxy.events.onSetupCameraTransform(); 160 + CallbackProxyClient.events.onSetupCameraTransform();
168 } 161 }
169 162
170 public static void postRenderEntities(int ref) 163 public static void postRenderEntities(int ref)
171 { 164 {
172 - InjectedCallbackProxy.events.postRenderEntities(); 165 + CallbackProxyClient.events.postRenderEntities();
173 } 166 }
174 167
175 public static void postRender(int ref) 168 public static void postRender(int ref)
176 { 169 {
177 - InjectedCallbackProxy.events.postRender(); 170 + CallbackProxyClient.events.postRender();
178 } 171 }
179 172
180 public static void onRenderHUD(int ref) 173 public static void onRenderHUD(int ref)
181 { 174 {
182 - InjectedCallbackProxy.events.onRenderHUD(); 175 + CallbackProxyClient.events.onRenderHUD();
183 } 176 }
184 177
185 public static void onRenderChat(int ref) 178 public static void onRenderChat(int ref)
186 { 179 {
187 - InjectedCallbackProxy.events.onRenderChat(); 180 + CallbackProxyClient.events.onRenderChat();
188 } 181 }
189 182
190 public static void postRenderChat(int ref) 183 public static void postRenderChat(int ref)
191 { 184 {
192 if (ref == 10) 185 if (ref == 10)
193 { 186 {
194 - InjectedCallbackProxy.events.postRenderChat(); 187 + CallbackProxyClient.events.postRenderChat();
195 } 188 }
196 } 189 }
197 190
@@ -199,8 +192,8 @@ public class InjectedCallbackProxy @@ -199,8 +192,8 @@ public class InjectedCallbackProxy
199 { 192 {
200 if (ref == 2) 193 if (ref == 2)
201 { 194 {
202 - InjectedCallbackProxy.events.postRenderHUD();  
203 - InjectedCallbackProxy.events.preRenderGUI(ref); 195 + CallbackProxyClient.events.postRenderHUD();
  196 + CallbackProxyClient.events.preRenderGUI(ref);
204 } 197 }
205 } 198 }
206 199
@@ -208,7 +201,7 @@ public class InjectedCallbackProxy @@ -208,7 +201,7 @@ public class InjectedCallbackProxy
208 { 201 {
209 if (ref == 0) 202 if (ref == 0)
210 { 203 {
211 - InjectedCallbackProxy.events.onStartIntegratedServer(instance, folderName, worldName, worldSettings); 204 + CallbackProxyClient.events.onStartServer(instance, folderName, worldName, worldSettings);
212 } 205 }
213 } 206 }
214 207
@@ -216,7 +209,7 @@ public class InjectedCallbackProxy @@ -216,7 +209,7 @@ public class InjectedCallbackProxy
216 { 209 {
217 if (ref == 0) 210 if (ref == 0)
218 { 211 {
219 - InjectedCallbackProxy.events.onInitializePlayerConnection(scm, netManager, player); 212 + CallbackProxyClient.events.onInitializePlayerConnection(scm, netManager, player);
220 } 213 }
221 } 214 }
222 215
@@ -224,7 +217,7 @@ public class InjectedCallbackProxy @@ -224,7 +217,7 @@ public class InjectedCallbackProxy
224 { 217 {
225 if (ref == 0) 218 if (ref == 0)
226 { 219 {
227 - InjectedCallbackProxy.events.onPlayerLogin(scm, player); 220 + CallbackProxyClient.events.onPlayerLogin(scm, player);
228 } 221 }
229 } 222 }
230 223
@@ -232,7 +225,7 @@ public class InjectedCallbackProxy @@ -232,7 +225,7 @@ public class InjectedCallbackProxy
232 { 225 {
233 if (ref == 0) 226 if (ref == 0)
234 { 227 {
235 - InjectedCallbackProxy.events.onPlayerLogout(scm, player); 228 + CallbackProxyClient.events.onPlayerLogout(scm, player);
236 } 229 }
237 } 230 }
238 231
@@ -240,7 +233,7 @@ public class InjectedCallbackProxy @@ -240,7 +233,7 @@ public class InjectedCallbackProxy
240 { 233 {
241 if (ref == 0) 234 if (ref == 0)
242 { 235 {
243 - InjectedCallbackProxy.events.onSpawnPlayer(scm, returnValue, profile); 236 + CallbackProxyClient.events.onSpawnPlayer(scm, returnValue, profile);
244 } 237 }
245 238
246 return returnValue; 239 return returnValue;
@@ -250,7 +243,7 @@ public class InjectedCallbackProxy @@ -250,7 +243,7 @@ public class InjectedCallbackProxy
250 { 243 {
251 if (ref == 0) 244 if (ref == 0)
252 { 245 {
253 - InjectedCallbackProxy.events.onRespawnPlayer(scm, returnValue, oldPlayer, dimension, won); 246 + CallbackProxyClient.events.onRespawnPlayer(scm, returnValue, oldPlayer, dimension, won);
254 } 247 }
255 248
256 return returnValue; 249 return returnValue;
@@ -260,7 +253,17 @@ public class InjectedCallbackProxy @@ -260,7 +253,17 @@ public class InjectedCallbackProxy
260 { 253 {
261 if (ref == 0) 254 if (ref == 0)
262 { 255 {
263 - InjectedCallbackProxy.events.onSendChatMessage(packet, message); 256 + CallbackProxyClient.events.onSendChatMessage(packet, message);
264 } 257 }
265 } 258 }
  259 +
  260 + public static void onOutboundChat(EventInfo<EntityClientPlayerMP> e, String message)
  261 + {
  262 + CallbackProxyClient.events.onSendChatMessage(e, message);
  263 + }
  264 +
  265 + public static void onResize(EventInfo<Minecraft> e)
  266 + {
  267 + CallbackProxyClient.events.onResize(e.getSource());
  268 + }
266 } 269 }
java/com/mumfrey/liteloader/core/Events.java renamed to java/client/com/mumfrey/liteloader/client/ClientEvents.java
1 -package com.mumfrey.liteloader.core; 1 +package com.mumfrey.liteloader.client;
2 2
3 import java.util.LinkedList; 3 import java.util.LinkedList;
4 4
5 import net.minecraft.client.Minecraft; 5 import net.minecraft.client.Minecraft;
  6 +import net.minecraft.client.entity.EntityClientPlayerMP;
6 import net.minecraft.client.gui.GuiNewChat; 7 import net.minecraft.client.gui.GuiNewChat;
7 import net.minecraft.client.gui.ScaledResolution; 8 import net.minecraft.client.gui.ScaledResolution;
8 -import net.minecraft.command.ICommandManager;  
9 -import net.minecraft.command.ServerCommandManager;  
10 -import net.minecraft.entity.player.EntityPlayerMP;  
11 import net.minecraft.network.INetHandler; 9 import net.minecraft.network.INetHandler;
12 -import net.minecraft.network.NetHandlerPlayServer;  
13 -import net.minecraft.network.NetworkManager;  
14 import net.minecraft.network.login.INetHandlerLoginClient; 10 import net.minecraft.network.login.INetHandlerLoginClient;
15 import net.minecraft.network.login.server.S02PacketLoginSuccess; 11 import net.minecraft.network.login.server.S02PacketLoginSuccess;
16 -import net.minecraft.network.play.INetHandlerPlayServer;  
17 import net.minecraft.network.play.client.C01PacketChatMessage; 12 import net.minecraft.network.play.client.C01PacketChatMessage;
18 import net.minecraft.network.play.server.S01PacketJoinGame; 13 import net.minecraft.network.play.server.S01PacketJoinGame;
19 import net.minecraft.network.play.server.S02PacketChat; 14 import net.minecraft.network.play.server.S02PacketChat;
20 import net.minecraft.profiler.Profiler; 15 import net.minecraft.profiler.Profiler;
21 import net.minecraft.server.integrated.IntegratedServer; 16 import net.minecraft.server.integrated.IntegratedServer;
22 -import net.minecraft.server.management.ServerConfigurationManager;  
23 import net.minecraft.util.IChatComponent; 17 import net.minecraft.util.IChatComponent;
24 import net.minecraft.util.Timer; 18 import net.minecraft.util.Timer;
25 -import net.minecraft.world.WorldSettings;  
26 19
27 import org.lwjgl.input.Mouse; 20 import org.lwjgl.input.Mouse;
28 21
29 -import com.mojang.authlib.GameProfile;  
30 import com.mumfrey.liteloader.*; 22 import com.mumfrey.liteloader.*;
31 -import com.mumfrey.liteloader.core.gen.GenProfiler;  
32 -import com.mumfrey.liteloader.core.overlays.IMinecraft;  
33 -import com.mumfrey.liteloader.util.PrivateFields; 23 +import com.mumfrey.liteloader.client.gen.GenProfiler;
  24 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  25 +import com.mumfrey.liteloader.client.util.PrivateFields;
  26 +import com.mumfrey.liteloader.common.LoadingProgress;
  27 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  28 +import com.mumfrey.liteloader.core.Events;
  29 +import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
  30 +import com.mumfrey.liteloader.core.LiteLoader;
  31 +import com.mumfrey.liteloader.launch.LoaderProperties;
  32 +import com.mumfrey.liteloader.transformers.event.EventInfo;
34 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 33 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
35 34
36 -/**  
37 - *  
38 - * @author Adam Mummery-Smith  
39 - */  
40 -public class Events  
41 -{  
42 - /**  
43 - * Reference to the loader instance  
44 - */  
45 - private final LiteLoader loader;  
46 - 35 +public class ClientEvents extends Events<Minecraft, IntegratedServer>
  36 +{
  37 + private static ClientEvents instance;
  38 +
47 /** 39 /**
48 * Reference to the game 40 * Reference to the game
49 */ 41 */
50 - private final Minecraft minecraft;  
51 -  
52 - /**  
53 - * Client plugin channel manager  
54 - */  
55 - private final ClientPluginChannels clientPluginChannels;  
56 -  
57 - /**  
58 - * Server plugin channel manager  
59 - */  
60 - private final ServerPluginChannels serverPluginChannels;  
61 - 42 + protected final GameEngineClient engineClient;
  43 +
62 /** 44 /**
63 * Reference to the minecraft timer 45 * Reference to the minecraft timer
64 */ 46 */
@@ -67,8 +49,8 @@ public class Events @@ -67,8 +49,8 @@ public class Events
67 /** 49 /**
68 * Flags which keep track of whether hooks have been applied 50 * Flags which keep track of whether hooks have been applied
69 */ 51 */
70 - private boolean hookInitDone, lateInitDone, profilerHooked;  
71 - 52 + private boolean lateInitDone, profilerHooked;
  53 +
72 /** 54 /**
73 * Profiler hook objects 55 * Profiler hook objects
74 */ 56 */
@@ -88,7 +70,11 @@ public class Events @@ -88,7 +70,11 @@ public class Events
88 * Current screen height 70 * Current screen height
89 */ 71 */
90 private int screenHeight = 480; 72 private int screenHeight = 480;
91 - 73 +
  74 + /**
  75 + *
  76 + */
  77 + private boolean wasFullScreen = false;
92 78
93 /** 79 /**
94 * List of mods which implement Tickable interface and will receive tick 80 * List of mods which implement Tickable interface and will receive tick
@@ -160,47 +146,37 @@ public class Events @@ -160,47 +146,37 @@ public class Events
160 private LinkedList<PreJoinGameListener> preJoinGameListeners = new LinkedList<PreJoinGameListener>(); 146 private LinkedList<PreJoinGameListener> preJoinGameListeners = new LinkedList<PreJoinGameListener>();
161 147
162 /** 148 /**
163 - * List of mods which can filter server chat  
164 - */  
165 - private LinkedList<ServerChatFilter> serverChatFilters = new LinkedList<ServerChatFilter>();  
166 -  
167 - /**  
168 - * List of mods which provide server commands 149 + * List of mods which monitor outbound chat
169 */ 150 */
170 - private LinkedList<ServerCommandProvider> serverCommandProviders = new LinkedList<ServerCommandProvider>(); 151 + private LinkedList<OutboundChatListener> outboundChatListeners = new LinkedList<OutboundChatListener>();
171 152
172 /** 153 /**
173 - * List of mods which monitor server player events 154 + * List of mods which filter outbound chat
174 */ 155 */
175 - private LinkedList<ServerPlayerListener> serverPlayerListeners = new LinkedList<ServerPlayerListener>();  
176 - 156 + private LinkedList<OutboundChatFilter> outboundChatFilters = new LinkedList<OutboundChatFilter>();
  157 +
177 /** 158 /**
178 - * List of mods which monitor outbound chat 159 + * List of mods which monitor changes in the viewport
179 */ 160 */
180 - private LinkedList<OutboundChatListener> outboundChatListeners = new LinkedList<OutboundChatListener>();  
181 - 161 + private LinkedList<ViewportListener> viewportListeners = new LinkedList<ViewportListener>();
  162 +
182 /** 163 /**
183 * Hash code of the current world. We don't store the world reference here because we don't want 164 * Hash code of the current world. We don't store the world reference here because we don't want
184 * to mess with world GC by mistake 165 * to mess with world GC by mistake
185 */ 166 */
186 private int worldHashCode = 0; 167 private int worldHashCode = 0;
187 168
188 - /**  
189 - * Package private ctor  
190 - *  
191 - * @param loader  
192 - * @param minecraft  
193 - * @param pluginChannels  
194 - */  
195 - Events(LiteLoader loader, Minecraft minecraft, ClientPluginChannels pluginChannels, ServerPluginChannels serverPluginChannels, boolean genMappings) 169 + @SuppressWarnings("cast")
  170 + public ClientEvents(LiteLoader loader, GameEngineClient engine, LoaderProperties properties)
196 { 171 {
197 - this.loader = loader;  
198 - this.minecraft = minecraft;  
199 - this.clientPluginChannels = pluginChannels;  
200 - this.serverPluginChannels = serverPluginChannels; 172 + super(loader, engine, properties);
  173 +
  174 + ClientEvents.instance = this;
  175 +
  176 + this.engineClient = (GameEngineClient)engine;
201 try 177 try
202 { 178 {
203 - if (genMappings) 179 + if (properties.getBooleanProperty(LoaderProperties.OPTION_GENERATE_MAPPINGS))
204 { 180 {
205 this.genProfiler = GenProfiler.class.newInstance(); 181 this.genProfiler = GenProfiler.class.newInstance();
206 } 182 }
@@ -210,109 +186,39 @@ public class Events @@ -210,109 +186,39 @@ public class Events
210 // th.printStackTrace(); 186 // th.printStackTrace();
211 } 187 }
212 } 188 }
213 -  
214 - /**  
215 - * Add a listener to the relevant listener lists  
216 - *  
217 - * @param listener 189 +
  190 + static ClientEvents getInstance()
  191 + {
  192 + return ClientEvents.instance;
  193 + }
  194 +
  195 + /* (non-Javadoc)
  196 + * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate)
218 */ 197 */
219 - public void addListener(LiteMod listener) 198 + @Override
  199 + public void registerInterfaces(InterfaceRegistrationDelegate delegate)
220 { 200 {
221 - if (listener instanceof Tickable)  
222 - {  
223 - this.addTickListener((Tickable)listener);  
224 - }  
225 -  
226 - if (listener instanceof GameLoopListener)  
227 - {  
228 - this.addLoopListener((GameLoopListener)listener);  
229 - }  
230 -  
231 - if (listener instanceof InitCompleteListener)  
232 - {  
233 - this.addInitListener((InitCompleteListener)listener);  
234 - }  
235 -  
236 - if (listener instanceof RenderListener)  
237 - {  
238 - this.addRenderListener((RenderListener)listener);  
239 - }  
240 -  
241 - if (listener instanceof PostRenderListener)  
242 - {  
243 - this.addPostRenderListener((PostRenderListener)listener);  
244 - }  
245 -  
246 - if (listener instanceof ChatFilter)  
247 - {  
248 - this.addChatFilter((ChatFilter)listener);  
249 - }  
250 -  
251 - if (listener instanceof ChatListener)  
252 - {  
253 - if (listener instanceof ChatFilter)  
254 - {  
255 - LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! Remove one of these interfaces", listener.getName());  
256 - }  
257 - else  
258 - {  
259 - this.addChatListener((ChatListener)listener);  
260 - }  
261 - }  
262 -  
263 - if (listener instanceof ChatRenderListener)  
264 - {  
265 - this.addChatRenderListener((ChatRenderListener)listener);  
266 - }  
267 -  
268 - if (listener instanceof HUDRenderListener)  
269 - {  
270 - this.addHUDRenderListener((HUDRenderListener)listener);  
271 - }  
272 -  
273 - if (listener instanceof PreJoinGameListener)  
274 - {  
275 - this.addPreJoinGameListener((PreJoinGameListener)listener);  
276 - }  
277 -  
278 - if (listener instanceof JoinGameListener)  
279 - {  
280 - this.addJoinGameListener((JoinGameListener)listener);  
281 - }  
282 -  
283 - if (listener instanceof ServerChatFilter)  
284 - {  
285 - this.addServerChatFilter((ServerChatFilter)listener);  
286 - }  
287 -  
288 - if (listener instanceof ServerCommandProvider)  
289 - {  
290 - this.addServerCommandProvider((ServerCommandProvider)listener);  
291 - }  
292 -  
293 - if (listener instanceof ServerPlayerListener)  
294 - {  
295 - this.addServerPlayerListener((ServerPlayerListener)listener);  
296 - }  
297 -  
298 - if (listener instanceof OutboundChatListener)  
299 - {  
300 - this.addOutboundChatListener((OutboundChatListener)listener);  
301 - }  
302 -  
303 - this.clientPluginChannels.addListener(listener);  
304 - this.serverPluginChannels.addListener(listener);  
305 -  
306 - if (listener instanceof CommonPluginChannelListener && !(listener instanceof PluginChannelListener) && !(listener instanceof ServerPluginChannelListener))  
307 - {  
308 - LiteLoaderLogger.warning("Interface error for mod '%1s'. Implementing CommonPluginChannelListener has no effect! Use PluginChannelListener or ServerPluginChannelListener instead", listener.getName());  
309 - } 201 + delegate.registerInterface(Tickable.class);
  202 + delegate.registerInterface(GameLoopListener.class);
  203 + delegate.registerInterface(InitCompleteListener.class);
  204 + delegate.registerInterface(RenderListener.class);
  205 + delegate.registerInterface(PostRenderListener.class);
  206 + delegate.registerInterface(ChatFilter.class);
  207 + delegate.registerInterface(ChatListener.class);
  208 + delegate.registerInterface(ChatRenderListener.class);
  209 + delegate.registerInterface(HUDRenderListener.class);
  210 + delegate.registerInterface(PreJoinGameListener.class);
  211 + delegate.registerInterface(JoinGameListener.class);
  212 + delegate.registerInterface(OutboundChatListener.class);
  213 + delegate.registerInterface(OutboundChatFilter.class);
  214 + delegate.registerInterface(ViewportListener.class);
310 } 215 }
311 216
312 /** 217 /**
313 * Initialise hooks 218 * Initialise hooks
314 */ 219 */
315 - public void initHooks() 220 + @Override
  221 + public void initProvider()
316 { 222 {
317 if (this.genProfiler != null) 223 if (this.genProfiler != null)
318 { 224 {
@@ -324,7 +230,7 @@ public class Events @@ -324,7 +230,7 @@ public class Events
324 if (!this.profilerHooked) 230 if (!this.profilerHooked)
325 { 231 {
326 this.profilerHooked = true; 232 this.profilerHooked = true;
327 - PrivateFields.minecraftProfiler.setFinal(this.minecraft, this.genProfiler); 233 + PrivateFields.minecraftProfiler.setFinal(this.engine.getClient(), this.genProfiler);
328 } 234 }
329 } 235 }
330 catch (Exception ex) 236 catch (Exception ex)
@@ -333,10 +239,22 @@ public class Events @@ -333,10 +239,22 @@ public class Events
333 ex.printStackTrace(); 239 ex.printStackTrace();
334 } 240 }
335 } 241 }
336 -  
337 - this.hookInitDone = true;  
338 } 242 }
339 - 243 +
  244 + /**
  245 + * @deprecated use LiteLoader.getInterfaceManager().registerListener(listener); instead
  246 + * @param tickListener
  247 + */
  248 + @Deprecated
  249 + @Override
  250 + public void addTickListener(Object tickListener)
  251 + {
  252 + if (tickListener instanceof Tickable)
  253 + {
  254 + this.addTickListener((Tickable)tickListener);
  255 + }
  256 + }
  257 +
340 /** 258 /**
341 * @param tickable 259 * @param tickable
342 */ 260 */
@@ -345,8 +263,6 @@ public class Events @@ -345,8 +263,6 @@ public class Events
345 if (!this.tickListeners.contains(tickable)) 263 if (!this.tickListeners.contains(tickable))
346 { 264 {
347 this.tickListeners.add(tickable); 265 this.tickListeners.add(tickable);
348 - if (this.hookInitDone)  
349 - this.initHooks();  
350 } 266 }
351 } 267 }
352 268
@@ -358,8 +274,6 @@ public class Events @@ -358,8 +274,6 @@ public class Events
358 if (!this.loopListeners.contains(loopListener)) 274 if (!this.loopListeners.contains(loopListener))
359 { 275 {
360 this.loopListeners.add(loopListener); 276 this.loopListeners.add(loopListener);
361 - if (this.hookInitDone)  
362 - this.initHooks();  
363 } 277 }
364 } 278 }
365 279
@@ -371,8 +285,6 @@ public class Events @@ -371,8 +285,6 @@ public class Events
371 if (!this.initListeners.contains(initCompleteListener)) 285 if (!this.initListeners.contains(initCompleteListener))
372 { 286 {
373 this.initListeners.add(initCompleteListener); 287 this.initListeners.add(initCompleteListener);
374 - if (this.hookInitDone)  
375 - this.initHooks();  
376 } 288 }
377 } 289 }
378 290
@@ -384,8 +296,6 @@ public class Events @@ -384,8 +296,6 @@ public class Events
384 if (!this.renderListeners.contains(renderListener)) 296 if (!this.renderListeners.contains(renderListener))
385 { 297 {
386 this.renderListeners.add(renderListener); 298 this.renderListeners.add(renderListener);
387 - if (this.hookInitDone)  
388 - this.initHooks();  
389 } 299 }
390 } 300 }
391 301
@@ -397,12 +307,24 @@ public class Events @@ -397,12 +307,24 @@ public class Events
397 if (!this.postRenderListeners.contains(postRenderListener)) 307 if (!this.postRenderListeners.contains(postRenderListener))
398 { 308 {
399 this.postRenderListeners.add(postRenderListener); 309 this.postRenderListeners.add(postRenderListener);
400 - if (this.hookInitDone)  
401 - this.initHooks();  
402 } 310 }
403 } 311 }
404 312
405 /** 313 /**
  314 + * @deprecated use LiteLoader.getInterfaceManager().registerListener(listener); instead
  315 + * @param chatFilter
  316 + */
  317 + @Deprecated
  318 + @Override
  319 + public void addChatFilter(Object chatFilter)
  320 + {
  321 + if (chatFilter instanceof ChatFilter)
  322 + {
  323 + this.addChatFilter((ChatFilter)chatFilter);
  324 + }
  325 + }
  326 +
  327 + /**
406 * @param chatFilter 328 * @param chatFilter
407 */ 329 */
408 public void addChatFilter(ChatFilter chatFilter) 330 public void addChatFilter(ChatFilter chatFilter)
@@ -418,7 +340,11 @@ public class Events @@ -418,7 +340,11 @@ public class Events
418 */ 340 */
419 public void addChatListener(ChatListener chatListener) 341 public void addChatListener(ChatListener chatListener)
420 { 342 {
421 - if (!this.chatListeners.contains(chatListener)) 343 + if (chatListener instanceof ChatFilter)
  344 + {
  345 + LiteLoaderLogger.warning("Interface error initialising mod '%1s'. A mod implementing ChatFilter and ChatListener is not supported! Remove one of these interfaces", chatListener.getName());
  346 + }
  347 + else if (!this.chatListeners.contains(chatListener))
422 { 348 {
423 this.chatListeners.add(chatListener); 349 this.chatListeners.add(chatListener);
424 } 350 }
@@ -432,8 +358,6 @@ public class Events @@ -432,8 +358,6 @@ public class Events
432 if (!this.chatRenderListeners.contains(chatRenderListener)) 358 if (!this.chatRenderListeners.contains(chatRenderListener))
433 { 359 {
434 this.chatRenderListeners.add(chatRenderListener); 360 this.chatRenderListeners.add(chatRenderListener);
435 - if (this.hookInitDone)  
436 - this.initHooks();  
437 } 361 }
438 } 362 }
439 363
@@ -445,8 +369,6 @@ public class Events @@ -445,8 +369,6 @@ public class Events
445 if (!this.hudRenderListeners.contains(hudRenderListener)) 369 if (!this.hudRenderListeners.contains(hudRenderListener))
446 { 370 {
447 this.hudRenderListeners.add(hudRenderListener); 371 this.hudRenderListeners.add(hudRenderListener);
448 - if (this.hookInitDone)  
449 - this.initHooks();  
450 } 372 }
451 } 373 }
452 374
@@ -484,55 +406,45 @@ public class Events @@ -484,55 +406,45 @@ public class Events
484 } 406 }
485 407
486 /** 408 /**
487 - * @param serverChatFilter  
488 - */  
489 - public void addServerChatFilter(ServerChatFilter serverChatFilter)  
490 - {  
491 - if (!this.serverChatFilters.contains(serverChatFilter))  
492 - {  
493 - this.serverChatFilters.add(serverChatFilter);  
494 - }  
495 - }  
496 -  
497 - /**  
498 - * @param serverCommandProvider 409 + * @param outboundChatListener
499 */ 410 */
500 - public void addServerCommandProvider(ServerCommandProvider serverCommandProvider) 411 + public void addOutboundChatListener(OutboundChatListener outboundChatListener)
501 { 412 {
502 - if (!this.serverCommandProviders.contains(serverCommandProvider)) 413 + if (!this.outboundChatListeners.contains(outboundChatListener))
503 { 414 {
504 - this.serverCommandProviders.add(serverCommandProvider); 415 + this.outboundChatListeners.add(outboundChatListener);
505 } 416 }
506 } 417 }
507 - 418 +
508 /** 419 /**
509 - * @param serverPlayerListener 420 + * @param outboundChatFilter
510 */ 421 */
511 - public void addServerPlayerListener(ServerPlayerListener serverPlayerListener) 422 + public void addOutboundChatFiler(OutboundChatFilter outboundChatFilter)
512 { 423 {
513 - if (!this.serverPlayerListeners.contains(serverPlayerListener)) 424 + if (!this.outboundChatFilters.contains(outboundChatFilter))
514 { 425 {
515 - this.serverPlayerListeners.add(serverPlayerListener); 426 + this.outboundChatFilters.add(outboundChatFilter);
516 } 427 }
517 } 428 }
518 - 429 +
519 /** 430 /**
520 - * @param outboundChatListener 431 + * @param viewportListener
521 */ 432 */
522 - private void addOutboundChatListener(OutboundChatListener outboundChatListener) 433 + public void addViewportListener(ViewportListener viewportListener)
523 { 434 {
524 - if (!this.outboundChatListeners.contains(outboundChatListener)) 435 + if (!this.viewportListeners.contains(viewportListener))
525 { 436 {
526 - this.outboundChatListeners.add(outboundChatListener); 437 + this.viewportListeners.add(viewportListener);
527 } 438 }
528 } 439 }
529 440
530 /** 441 /**
531 * Late initialisation callback 442 * Late initialisation callback
532 */ 443 */
533 - public void preBeginGame() 444 + @Override
  445 + protected void onStartupComplete()
534 { 446 {
535 - this.loader.preInitMods(); 447 + this.engine.refreshResources(false);
536 448
537 if (!this.lateInitDone) 449 if (!this.lateInitDone)
538 { 450 {
@@ -542,8 +454,9 @@ public class Events @@ -542,8 +454,9 @@ public class Events
542 { 454 {
543 try 455 try
544 { 456 {
545 - LiteLoaderLogger.info("Calling late init for mod " + initMod.getName());  
546 - initMod.onInitCompleted(this.minecraft, this.loader); 457 + LoadingProgress.setMessage("Calling late init for mod %s...", initMod.getName());
  458 + LiteLoaderLogger.info("Calling late init for mod %s", initMod.getName());
  459 + initMod.onInitCompleted(this.engine.getClient(), this.loader);
547 } 460 }
548 catch (Throwable th) 461 catch (Throwable th)
549 { 462 {
@@ -551,19 +464,35 @@ public class Events @@ -551,19 +464,35 @@ public class Events
551 } 464 }
552 } 465 }
553 } 466 }
  467 +
  468 + this.onResize(this.engineClient.getClient());
554 469
555 - this.loader.preBeginGame(); 470 + super.onStartupComplete();
  471 + }
  472 +
  473 + public void onResize(Minecraft minecraft)
  474 + {
  475 + this.currentResolution = this.engineClient.getScaledResolution();
  476 + this.screenWidth = this.currentResolution.getScaledWidth();
  477 + this.screenHeight = this.currentResolution.getScaledHeight();
  478 +
  479 + if (this.wasFullScreen != minecraft.isFullScreen())
  480 + {
  481 + for (ViewportListener viewportListener : this.viewportListeners)
  482 + viewportListener.onFullScreenToggled(minecraft.isFullScreen());
  483 + }
  484 +
  485 + this.wasFullScreen = minecraft.isFullScreen();
  486 +
  487 + for (ViewportListener viewportListener : this.viewportListeners)
  488 + viewportListener.onViewportResized(this.currentResolution, minecraft.displayWidth, minecraft.displayHeight);
556 } 489 }
557 490
558 /** 491 /**
559 * Callback from the tick hook, pre render 492 * Callback from the tick hook, pre render
560 */ 493 */
561 - public void onRender() 494 + void onRender()
562 { 495 {
563 - this.currentResolution = new ScaledResolution(this.minecraft.gameSettings, this.minecraft.displayWidth, this.minecraft.displayHeight);  
564 - this.screenWidth = this.currentResolution.getScaledWidth();  
565 - this.screenHeight = this.currentResolution.getScaledHeight();  
566 -  
567 for (RenderListener renderListener : this.renderListeners) 496 for (RenderListener renderListener : this.renderListeners)
568 renderListener.onRender(); 497 renderListener.onRender();
569 } 498 }
@@ -571,7 +500,7 @@ public class Events @@ -571,7 +500,7 @@ public class Events
571 /** 500 /**
572 * Callback from the tick hook, post render entities 501 * Callback from the tick hook, post render entities
573 */ 502 */
574 - public void postRenderEntities() 503 + void postRenderEntities()
575 { 504 {
576 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F; 505 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F;
577 506
@@ -582,7 +511,7 @@ public class Events @@ -582,7 +511,7 @@ public class Events
582 /** 511 /**
583 * Callback from the tick hook, post render 512 * Callback from the tick hook, post render
584 */ 513 */
585 - public void postRender() 514 + void postRender()
586 { 515 {
587 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F; 516 float partialTicks = (this.minecraftTimer != null) ? this.minecraftTimer.elapsedPartialTicks : 0.0F;
588 517
@@ -593,19 +522,21 @@ public class Events @@ -593,19 +522,21 @@ public class Events
593 /** 522 /**
594 * Called immediately before the current GUI is rendered 523 * Called immediately before the current GUI is rendered
595 */ 524 */
596 - public void preRenderGUI(int ref) 525 + void preRenderGUI(int ref)
597 { 526 {
598 - if (!this.minecraft.skipRenderWorld && ref == (this.minecraft.theWorld == null ? 1 : 2)) 527 + Minecraft minecraft = this.engine.getClient();
  528 +
  529 + if (!minecraft.skipRenderWorld && ref == (minecraft.theWorld == null ? 1 : 2))
599 { 530 {
600 for (RenderListener renderListener : this.renderListeners) 531 for (RenderListener renderListener : this.renderListeners)
601 - renderListener.onRenderGui(this.minecraft.currentScreen); 532 + renderListener.onRenderGui(this.engineClient.getCurrentScreen());
602 } 533 }
603 } 534 }
604 535
605 /** 536 /**
606 * Called immediately after the world/camera transform is initialised 537 * Called immediately after the world/camera transform is initialised
607 */ 538 */
608 - public void onSetupCameraTransform() 539 + void onSetupCameraTransform()
609 { 540 {
610 for (RenderListener renderListener : this.renderListeners) 541 for (RenderListener renderListener : this.renderListeners)
611 renderListener.onSetupCameraTransform(); 542 renderListener.onSetupCameraTransform();
@@ -614,9 +545,9 @@ public class Events @@ -614,9 +545,9 @@ public class Events
614 /** 545 /**
615 * Called immediately before the chat log is rendered 546 * Called immediately before the chat log is rendered
616 */ 547 */
617 - public void onRenderChat() 548 + void onRenderChat()
618 { 549 {
619 - GuiNewChat chat = this.minecraft.ingameGUI.getChatGUI(); 550 + GuiNewChat chat = this.engineClient.getChatGUI();
620 551
621 for (ChatRenderListener chatRenderListener : this.chatRenderListeners) 552 for (ChatRenderListener chatRenderListener : this.chatRenderListeners)
622 chatRenderListener.onPreRenderChat(this.screenWidth, this.screenHeight, chat); 553 chatRenderListener.onPreRenderChat(this.screenWidth, this.screenHeight, chat);
@@ -625,9 +556,9 @@ public class Events @@ -625,9 +556,9 @@ public class Events
625 /** 556 /**
626 * Called immediately after the chat log is rendered 557 * Called immediately after the chat log is rendered
627 */ 558 */
628 - public void postRenderChat() 559 + void postRenderChat()
629 { 560 {
630 - GuiNewChat chat = this.minecraft.ingameGUI.getChatGUI(); 561 + GuiNewChat chat = this.engineClient.getChatGUI();
631 562
632 for (ChatRenderListener chatRenderListener : this.chatRenderListeners) 563 for (ChatRenderListener chatRenderListener : this.chatRenderListeners)
633 chatRenderListener.onPostRenderChat(this.screenWidth, this.screenHeight, chat); 564 chatRenderListener.onPostRenderChat(this.screenWidth, this.screenHeight, chat);
@@ -636,9 +567,9 @@ public class Events @@ -636,9 +567,9 @@ public class Events
636 /** 567 /**
637 * Callback when about to render the HUD 568 * Callback when about to render the HUD
638 */ 569 */
639 - public void onRenderHUD() 570 + void onRenderHUD()
640 { 571 {
641 - if (!this.minecraft.gameSettings.hideGUI || this.minecraft.currentScreen != null) 572 + if (!this.engineClient.hideGUI() || this.engineClient.getCurrentScreen() != null)
642 { 573 {
643 for (HUDRenderListener hudRenderListener : this.hudRenderListeners) 574 for (HUDRenderListener hudRenderListener : this.hudRenderListeners)
644 hudRenderListener.onPreRenderHUD(this.screenWidth, this.screenHeight); 575 hudRenderListener.onPreRenderHUD(this.screenWidth, this.screenHeight);
@@ -648,9 +579,9 @@ public class Events @@ -648,9 +579,9 @@ public class Events
648 /** 579 /**
649 * Callback when the HUD has just been rendered 580 * Callback when the HUD has just been rendered
650 */ 581 */
651 - public void postRenderHUD() 582 + void postRenderHUD()
652 { 583 {
653 - if (!this.minecraft.gameSettings.hideGUI || this.minecraft.currentScreen != null) 584 + if (!this.engineClient.hideGUI() || this.engineClient.getCurrentScreen() != null)
654 { 585 {
655 for (HUDRenderListener hudRenderListener : this.hudRenderListeners) 586 for (HUDRenderListener hudRenderListener : this.hudRenderListeners)
656 hudRenderListener.onPostRenderHUD(this.screenWidth, this.screenHeight); 587 hudRenderListener.onPostRenderHUD(this.screenWidth, this.screenHeight);
@@ -660,10 +591,12 @@ public class Events @@ -660,10 +591,12 @@ public class Events
660 /** 591 /**
661 * Callback from the tick hook, called every frame when the timer is updated 592 * Callback from the tick hook, called every frame when the timer is updated
662 */ 593 */
663 - public void onTimerUpdate() 594 + void onTimerUpdate()
664 { 595 {
  596 + Minecraft minecraft = this.engine.getClient();
  597 +
665 for (GameLoopListener loopListener : this.loopListeners) 598 for (GameLoopListener loopListener : this.loopListeners)
666 - loopListener.onRunGameLoop(this.minecraft); 599 + loopListener.onRunGameLoop(minecraft);
667 } 600 }
668 601
669 /** 602 /**
@@ -671,16 +604,16 @@ public class Events @@ -671,16 +604,16 @@ public class Events
671 * 604 *
672 * @param clock True if this is a new tick (otherwise it's just a new frame) 605 * @param clock True if this is a new tick (otherwise it's just a new frame)
673 */ 606 */
674 - public void onTick(boolean clock) 607 + void onTick(boolean clock)
675 { 608 {
676 - this.minecraft.mcProfiler.startSection("litemods"); 609 + this.profiler.startSection("litemods");
677 float partialTicks = 0.0F; 610 float partialTicks = 0.0F;
678 611
679 // Try to get the minecraft timer object and determine the value of the 612 // Try to get the minecraft timer object and determine the value of the
680 // partialTicks 613 // partialTicks
681 if (clock || this.minecraftTimer == null) 614 if (clock || this.minecraftTimer == null)
682 { 615 {
683 - this.minecraftTimer = ((IMinecraft)this.minecraft).getTimer(); 616 + this.minecraftTimer = ((IMinecraft)this.engine.getClient()).getTimer();
684 } 617 }
685 618
686 // Hooray, we got the timer reference 619 // Hooray, we got the timer reference
@@ -690,42 +623,44 @@ public class Events @@ -690,42 +623,44 @@ public class Events
690 clock = this.minecraftTimer.elapsedTicks > 0; 623 clock = this.minecraftTimer.elapsedTicks > 0;
691 } 624 }
692 625
  626 + Minecraft minecraft = this.engine.getClient();
  627 +
693 // Flag indicates whether we are in game at the moment 628 // Flag indicates whether we are in game at the moment
694 - boolean inGame = this.minecraft.renderViewEntity != null && this.minecraft.renderViewEntity.worldObj != null; 629 + boolean inGame = minecraft.renderViewEntity != null && minecraft.renderViewEntity.worldObj != null;
695 630
696 - this.minecraft.mcProfiler.startSection("loader");  
697 - this.loader.onTick(clock, partialTicks, inGame); 631 + this.profiler.startSection("loader");
  632 + super.onTick(clock, partialTicks, inGame);
698 633
699 - int mouseX = Mouse.getX() * this.screenWidth / this.minecraft.displayWidth;  
700 - int mouseY = this.screenHeight - Mouse.getY() * this.screenHeight / this.minecraft.displayHeight - 1;  
701 - this.minecraft.mcProfiler.endStartSection("postrender");  
702 - this.loader.postRender(mouseX, mouseY, partialTicks);  
703 - this.minecraft.mcProfiler.endSection(); 634 + int mouseX = Mouse.getX() * this.screenWidth / minecraft.displayWidth;
  635 + int mouseY = this.screenHeight - Mouse.getY() * this.screenHeight / minecraft.displayHeight - 1;
  636 + this.profiler.endStartSection("postrender");
  637 + super.onPostRender(mouseX, mouseY, partialTicks);
  638 + this.profiler.endSection();
704 639
705 // Iterate tickable mods 640 // Iterate tickable mods
706 for (Tickable tickable : this.tickListeners) 641 for (Tickable tickable : this.tickListeners)
707 { 642 {
708 - this.minecraft.mcProfiler.startSection(tickable.getClass().getSimpleName().toLowerCase());  
709 - tickable.onTick(this.minecraft, partialTicks, inGame, clock);  
710 - this.minecraft.mcProfiler.endSection(); 643 + this.profiler.startSection(tickable.getClass().getSimpleName().toLowerCase());
  644 + tickable.onTick(minecraft, partialTicks, inGame, clock);
  645 + this.profiler.endSection();
711 } 646 }
712 647
713 // Detected world change 648 // Detected world change
714 - if (this.minecraft.theWorld != null) 649 + if (minecraft.theWorld != null)
715 { 650 {
716 - if (this.minecraft.theWorld.hashCode() != this.worldHashCode) 651 + if (minecraft.theWorld.hashCode() != this.worldHashCode)
717 { 652 {
718 - this.worldHashCode = this.minecraft.theWorld.hashCode();  
719 - this.loader.onWorldChanged(this.minecraft.theWorld); 653 + this.worldHashCode = minecraft.theWorld.hashCode();
  654 + super.onWorldChanged(minecraft.theWorld);
720 } 655 }
721 } 656 }
722 else 657 else
723 { 658 {
724 this.worldHashCode = 0; 659 this.worldHashCode = 0;
725 - this.loader.onWorldChanged(null); 660 + super.onWorldChanged(null);
726 } 661 }
727 662
728 - this.minecraft.mcProfiler.endSection(); 663 + this.profiler.endSection();
729 } 664 }
730 665
731 /** 666 /**
@@ -734,7 +669,7 @@ public class Events @@ -734,7 +669,7 @@ public class Events
734 * @param chatPacket 669 * @param chatPacket
735 * @return 670 * @return
736 */ 671 */
737 - public boolean onChat(S02PacketChat chatPacket) 672 + boolean onChat(S02PacketChat chatPacket)
738 { 673 {
739 if (chatPacket.func_148915_c() == null) 674 if (chatPacket.func_148915_c() == null)
740 return true; 675 return true;
@@ -768,21 +703,37 @@ public class Events @@ -768,21 +703,37 @@ public class Events
768 * @param packet 703 * @param packet
769 * @param message 704 * @param message
770 */ 705 */
771 - public void onSendChatMessage(C01PacketChatMessage packet, String message) 706 + void onSendChatMessage(C01PacketChatMessage packet, String message)
772 { 707 {
773 for (OutboundChatListener outboundChatListener : this.outboundChatListeners) 708 for (OutboundChatListener outboundChatListener : this.outboundChatListeners)
774 { 709 {
775 outboundChatListener.onSendChatMessage(packet, message); 710 outboundChatListener.onSendChatMessage(packet, message);
776 } 711 }
777 } 712 }
  713 +
  714 + /**
  715 + * @param message
  716 + */
  717 + void onSendChatMessage(EventInfo<EntityClientPlayerMP> e, String message)
  718 + {
  719 + for (OutboundChatFilter outboundChatFilter : this.outboundChatFilters)
  720 + {
  721 + if (!outboundChatFilter.onSendChatMessage(message))
  722 + e.cancel();
  723 + }
  724 + }
778 725
779 /** 726 /**
780 * @param netHandler 727 * @param netHandler
781 * @param loginPacket 728 * @param loginPacket
782 */ 729 */
783 - public void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket) 730 + void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)
784 { 731 {
785 - this.clientPluginChannels.onPostLogin(netHandler, loginPacket); 732 + ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();
  733 + if (clientPluginChannels instanceof ClientPluginChannelsClient)
  734 + {
  735 + ((ClientPluginChannelsClient)clientPluginChannels).onPostLogin(netHandler, loginPacket);
  736 + }
786 737
787 for (PostLoginListener loginListener : this.postLoginListeners) 738 for (PostLoginListener loginListener : this.postLoginListeners)
788 loginListener.onPostLogin(netHandler, loginPacket); 739 loginListener.onPostLogin(netHandler, loginPacket);
@@ -795,7 +746,7 @@ public class Events @@ -795,7 +746,7 @@ public class Events
795 * @param hookLogin 746 * @param hookLogin
796 * @return 747 * @return
797 */ 748 */
798 - public boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket) 749 + boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
799 { 750 {
800 boolean cancelled = false; 751 boolean cancelled = false;
801 752
@@ -813,107 +764,18 @@ public class Events @@ -813,107 +764,18 @@ public class Events
813 * @param netHandler 764 * @param netHandler
814 * @param loginPacket 765 * @param loginPacket
815 */ 766 */
816 - public void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket) 767 + @Override
  768 + protected void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
817 { 769 {
818 - this.loader.onJoinGame(netHandler, loginPacket);  
819 - this.clientPluginChannels.onJoinGame(netHandler, loginPacket); 770 + super.onJoinGame(netHandler, loginPacket);
820 771
821 - for (JoinGameListener joinGameListener : this.joinGameListeners)  
822 - joinGameListener.onJoinGame(netHandler, loginPacket);  
823 - }  
824 -  
825 - /**  
826 - * Callback from the chat hook  
827 - * @param netHandler  
828 - *  
829 - * @param chatPacket  
830 - * @return  
831 - */  
832 - public boolean onServerChat(INetHandlerPlayServer netHandler, C01PacketChatMessage chatPacket)  
833 - {  
834 - EntityPlayerMP player = netHandler instanceof NetHandlerPlayServer ? ((NetHandlerPlayServer)netHandler).playerEntity : null;  
835 -  
836 - for (ServerChatFilter chatFilter : this.serverChatFilters) 772 + ClientPluginChannels clientPluginChannels = LiteLoader.getClientPluginChannels();
  773 + if (clientPluginChannels instanceof ClientPluginChannelsClient)
837 { 774 {
838 - if (!chatFilter.onChat(player, chatPacket, chatPacket.func_149439_c()))  
839 - {  
840 - return false;  
841 - } 775 + ((ClientPluginChannelsClient)clientPluginChannels).onJoinGame(netHandler, loginPacket);
842 } 776 }
843 -  
844 - return true;  
845 - }  
846 -  
847 - /**  
848 - * @param instance  
849 - * @param folderName  
850 - * @param worldName  
851 - * @param worldSettings  
852 - */  
853 - public void onStartIntegratedServer(IntegratedServer instance, String folderName, String worldName, WorldSettings worldSettings)  
854 - {  
855 - ICommandManager commandManager = instance.getCommandManager();  
856 777
857 - if (commandManager instanceof ServerCommandManager)  
858 - {  
859 - ServerCommandManager serverCommandManager = (ServerCommandManager)commandManager;  
860 -  
861 - for (ServerCommandProvider commandProvider : this.serverCommandProviders)  
862 - commandProvider.provideCommands(serverCommandManager);  
863 - }  
864 - }  
865 -  
866 - /**  
867 - * @param scm  
868 - * @param player  
869 - * @param profile  
870 - */  
871 - public void onSpawnPlayer(ServerConfigurationManager scm, EntityPlayerMP player, GameProfile profile)  
872 - {  
873 - for (ServerPlayerListener serverPlayerListener : this.serverPlayerListeners)  
874 - serverPlayerListener.onPlayerConnect(player, profile);  
875 - }  
876 -  
877 - /**  
878 - * @param scm  
879 - * @param player  
880 - */  
881 - public void onPlayerLogin(ServerConfigurationManager scm, EntityPlayerMP player)  
882 - {  
883 - this.serverPluginChannels.onPlayerJoined(player);  
884 - }  
885 -  
886 - /**  
887 - * @param scm  
888 - * @param netManager  
889 - * @param player  
890 - */  
891 - public void onInitializePlayerConnection(ServerConfigurationManager scm, NetworkManager netManager, EntityPlayerMP player)  
892 - {  
893 - for (ServerPlayerListener serverPlayerListener : this.serverPlayerListeners)  
894 - serverPlayerListener.onPlayerLoggedIn(player);  
895 - }  
896 -  
897 - /**  
898 - * @param scm  
899 - * @param player  
900 - * @param oldPlayer  
901 - * @param dimension  
902 - * @param copy  
903 - */  
904 - public void onRespawnPlayer(ServerConfigurationManager scm, EntityPlayerMP player, EntityPlayerMP oldPlayer, int dimension, boolean won)  
905 - {  
906 - for (ServerPlayerListener serverPlayerListener : this.serverPlayerListeners)  
907 - serverPlayerListener.onPlayerRespawn(player, oldPlayer, dimension, won);  
908 - }  
909 -  
910 - /**  
911 - * @param scm  
912 - * @param player  
913 - */  
914 - public void onPlayerLogout(ServerConfigurationManager scm, EntityPlayerMP player)  
915 - {  
916 - for (ServerPlayerListener serverPlayerListener : this.serverPlayerListeners)  
917 - serverPlayerListener.onPlayerLogout(player); 778 + for (JoinGameListener joinGameListener : this.joinGameListeners)
  779 + joinGameListener.onJoinGame(netHandler, loginPacket);
918 } 780 }
919 } 781 }
java/client/com/mumfrey/liteloader/client/ClientPluginChannelsClient.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.network.NetHandlerLoginClient;
  5 +import net.minecraft.network.INetHandler;
  6 +import net.minecraft.network.NetworkManager;
  7 +import net.minecraft.network.login.INetHandlerLoginClient;
  8 +import net.minecraft.network.login.server.S02PacketLoginSuccess;
  9 +import net.minecraft.network.play.INetHandlerPlayClient;
  10 +import net.minecraft.network.play.client.C17PacketCustomPayload;
  11 +import net.minecraft.network.play.server.S01PacketJoinGame;
  12 +import net.minecraft.network.play.server.S3FPacketCustomPayload;
  13 +
  14 +import com.mumfrey.liteloader.client.util.PrivateFields;
  15 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  16 +import com.mumfrey.liteloader.core.exceptions.UnregisteredChannelException;
  17 +
  18 +/**
  19 + * Handler for client plugin channels
  20 + *
  21 + * @author Adam Mummery-Smith
  22 + */
  23 +public class ClientPluginChannelsClient extends ClientPluginChannels
  24 +{
  25 + /**
  26 + * @param netHandler
  27 + * @param loginPacket
  28 + */
  29 + void onPostLogin(INetHandlerLoginClient netHandler, S02PacketLoginSuccess loginPacket)
  30 + {
  31 + this.clearPluginChannels(netHandler);
  32 + }
  33 +
  34 + /**
  35 + * @param netHandler
  36 + * @param loginPacket
  37 + */
  38 + void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
  39 + {
  40 + this.sendRegisteredPluginChannels(netHandler);
  41 + }
  42 +
  43 + /**
  44 + * Callback for the plugin channel hook
  45 + *
  46 + * @param customPayload
  47 + */
  48 + @Override
  49 + public void onPluginChannelMessage(S3FPacketCustomPayload customPayload)
  50 + {
  51 + if (customPayload != null && customPayload.func_149169_c() != null) // getChannel
  52 + {
  53 + String channel = customPayload.func_149169_c(); // getChannel
  54 + byte[] data = customPayload.func_149168_d(); // getData
  55 +
  56 + this.onPluginChannelMessage(channel, data);
  57 + }
  58 + }
  59 +
  60 + /**
  61 + * @param netHandler
  62 + * @param registrationData
  63 + */
  64 + @Override
  65 + protected void sendRegistrationData(INetHandler netHandler, byte[] registrationData)
  66 + {
  67 + if (netHandler instanceof INetHandlerLoginClient)
  68 + {
  69 + NetworkManager networkManager = PrivateFields.netManager.get(((NetHandlerLoginClient)netHandler));
  70 + networkManager.scheduleOutboundPacket(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
  71 + }
  72 + else if (netHandler instanceof INetHandlerPlayClient)
  73 + {
  74 + ClientPluginChannelsClient.dispatch(new C17PacketCustomPayload(CHANNEL_REGISTER, registrationData));
  75 + }
  76 + }
  77 +
  78 + /**
  79 + * Send a message to the server on a plugin channel
  80 + *
  81 + * @param channel Channel to send, must not be a reserved channel name
  82 + * @param data
  83 + */
  84 + @Override
  85 + protected boolean send(String channel, byte[] data, ChannelPolicy policy)
  86 + {
  87 + if (channel == null || channel.length() > 16 || CHANNEL_REGISTER.equals(channel) || CHANNEL_UNREGISTER.equals(channel))
  88 + throw new RuntimeException("Invalid channel name specified");
  89 +
  90 + if (!policy.allows(this, channel))
  91 + {
  92 + if (policy.isSilent()) return false;
  93 + throw new UnregisteredChannelException(channel);
  94 + }
  95 +
  96 + C17PacketCustomPayload payload = new C17PacketCustomPayload(channel, data);
  97 + return ClientPluginChannelsClient.dispatch(payload);
  98 + }
  99 +
  100 + /**
  101 + * @param channel
  102 + * @param data
  103 + */
  104 + static boolean dispatch(C17PacketCustomPayload payload)
  105 + {
  106 + try
  107 + {
  108 + Minecraft minecraft = Minecraft.getMinecraft();
  109 +
  110 + if (minecraft.thePlayer != null && minecraft.thePlayer.sendQueue != null)
  111 + {
  112 + minecraft.thePlayer.sendQueue.addToSendQueue(payload);
  113 + return true;
  114 + }
  115 + }
  116 + catch (Exception ex) {}
  117 +
  118 + return false;
  119 + }
  120 +}
java/client/com/mumfrey/liteloader/client/GameEngineClient.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import java.util.Arrays;
  4 +import java.util.HashMap;
  5 +import java.util.LinkedList;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import net.minecraft.client.Minecraft;
  10 +import net.minecraft.client.audio.SoundHandler;
  11 +import net.minecraft.client.gui.GuiNewChat;
  12 +import net.minecraft.client.gui.GuiScreen;
  13 +import net.minecraft.client.gui.ScaledResolution;
  14 +import net.minecraft.client.resources.IResourceManager;
  15 +import net.minecraft.client.resources.IResourcePack;
  16 +import net.minecraft.client.settings.GameSettings;
  17 +import net.minecraft.client.settings.KeyBinding;
  18 +import net.minecraft.profiler.Profiler;
  19 +import net.minecraft.server.integrated.IntegratedServer;
  20 +
  21 +import com.mumfrey.liteloader.client.overlays.IMinecraft;
  22 +import com.mumfrey.liteloader.common.GameEngine;
  23 +import com.mumfrey.liteloader.common.LoadingProgress;
  24 +
  25 +/**
  26 + *
  27 + * @author Adam Mummery-Smith
  28 + */
  29 +public class GameEngineClient implements GameEngine<Minecraft, IntegratedServer>
  30 +{
  31 + private final Minecraft engine = Minecraft.getMinecraft();
  32 +
  33 + /**
  34 + * Registered resource packs
  35 + */
  36 + private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>();
  37 +
  38 + /**
  39 + * True while initialising mods if we need to do a resource manager reload once the process is completed
  40 + */
  41 + private boolean pendingResourceReload;
  42 +
  43 + /* (non-Javadoc)
  44 + * @see com.mumfrey.liteloader.common.GameEngine#getProfiler()
  45 + */
  46 + @Override
  47 + public Profiler getProfiler()
  48 + {
  49 + return this.engine.mcProfiler;
  50 + }
  51 +
  52 + /* (non-Javadoc)
  53 + * @see com.mumfrey.liteloader.common.GameEngine#refreshResources(boolean)
  54 + */
  55 + @Override
  56 + public void refreshResources(boolean force)
  57 + {
  58 + if (this.pendingResourceReload || force)
  59 + {
  60 + LoadingProgress.setMessage("Reloading Resources...");
  61 + this.pendingResourceReload = false;
  62 + this.engine.refreshResources();
  63 + }
  64 + }
  65 +
  66 + /* (non-Javadoc)
  67 + * @see com.mumfrey.liteloader.common.GameEngine#isClient()
  68 + */
  69 + @Override
  70 + public boolean isClient()
  71 + {
  72 + return true;
  73 + }
  74 +
  75 + /* (non-Javadoc)
  76 + * @see com.mumfrey.liteloader.common.GameEngine#isServer()
  77 + */
  78 + @Override
  79 + public boolean isServer()
  80 + {
  81 + return this.isSinglePlayer();
  82 + }
  83 +
  84 + /* (non-Javadoc)
  85 + * @see com.mumfrey.liteloader.common.GameEngine#isInGame()
  86 + */
  87 + @Override
  88 + public boolean isInGame()
  89 + {
  90 + return this.engine.thePlayer != null && this.engine.theWorld != null && this.engine.theWorld.isRemote;
  91 + }
  92 +
  93 + /* (non-Javadoc)
  94 + * @see com.mumfrey.liteloader.common.GameEngine#isRunning()
  95 + */
  96 + @Override
  97 + public boolean isRunning()
  98 + {
  99 + return ((IMinecraft)this.engine).isRunning();
  100 + }
  101 +
  102 + /* (non-Javadoc)
  103 + * @see com.mumfrey.liteloader.common.GameEngine#isSingleplayer()
  104 + */
  105 + @Override
  106 + public boolean isSinglePlayer()
  107 + {
  108 + return this.engine.isSingleplayer();
  109 + }
  110 +
  111 + /* (non-Javadoc)
  112 + * @see com.mumfrey.liteloader.common.GameEngine#getClient()
  113 + */
  114 + @Override
  115 + public Minecraft getClient()
  116 + {
  117 + return this.engine;
  118 + }
  119 +
  120 + /* (non-Javadoc)
  121 + * @see com.mumfrey.liteloader.common.GameEngine#getServer()
  122 + */
  123 + @Override
  124 + public IntegratedServer getServer()
  125 + {
  126 + return this.engine.getIntegratedServer();
  127 + }
  128 +
  129 + public GameSettings getGameSettings()
  130 + {
  131 + return this.engine.gameSettings;
  132 + }
  133 +
  134 + public ScaledResolution getScaledResolution()
  135 + {
  136 + return new ScaledResolution(this.engine, this.engine.displayWidth, this.engine.displayHeight);
  137 + }
  138 +
  139 + public GuiNewChat getChatGUI()
  140 + {
  141 + return this.engine.ingameGUI.getChatGUI();
  142 + }
  143 +
  144 + public GuiScreen getCurrentScreen()
  145 + {
  146 + return this.engine.currentScreen;
  147 + }
  148 +
  149 + public boolean hideGUI()
  150 + {
  151 + return this.engine.gameSettings.hideGUI;
  152 + }
  153 +
  154 + /* (non-Javadoc)
  155 + * @see com.mumfrey.liteloader.common.GameEngine#getResourceManager()
  156 + */
  157 + @Override
  158 + public IResourceManager getResourceManager()
  159 + {
  160 + return this.engine.getResourceManager();
  161 + }
  162 +
  163 + /**
  164 + * @return
  165 + */
  166 + public SoundHandler getSoundHandler()
  167 + {
  168 + return this.engine.getSoundHandler();
  169 + }
  170 +
  171 + /* (non-Javadoc)
  172 + * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack(net.minecraft.client.resources.IResourcePack)
  173 + */
  174 + @Override
  175 + public boolean registerResourcePack(IResourcePack resourcePack)
  176 + {
  177 + if (!this.registeredResourcePacks.containsKey(resourcePack.getPackName()))
  178 + {
  179 + this.pendingResourceReload = true;
  180 +
  181 + List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();
  182 + if (!defaultResourcePacks.contains(resourcePack))
  183 + {
  184 + defaultResourcePacks.add(resourcePack);
  185 + this.registeredResourcePacks.put(resourcePack.getPackName(), resourcePack);
  186 + return true;
  187 + }
  188 + }
  189 +
  190 + return false;
  191 + }
  192 +
  193 + /* (non-Javadoc)
  194 + * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack(net.minecraft.client.resources.IResourcePack)
  195 + */
  196 + @Override
  197 + public boolean unRegisterResourcePack(IResourcePack resourcePack)
  198 + {
  199 + if (this.registeredResourcePacks.containsValue(resourcePack))
  200 + {
  201 + this.pendingResourceReload = true;
  202 +
  203 + List<IResourcePack> defaultResourcePacks = ((IMinecraft)this.engine).getDefaultResourcePacks();
  204 + this.registeredResourcePacks.remove(resourcePack.getPackName());
  205 + defaultResourcePacks.remove(resourcePack);
  206 + return true;
  207 + }
  208 +
  209 + return false;
  210 + }
  211 +
  212 + /* (non-Javadoc)
  213 + * @see com.mumfrey.liteloader.common.GameEngine#getKeyBindings()
  214 + */
  215 + @Override
  216 + public List<KeyBinding> getKeyBindings()
  217 + {
  218 + LinkedList<KeyBinding> keyBindings = new LinkedList<KeyBinding>();
  219 + keyBindings.addAll(Arrays.asList(this.engine.gameSettings.keyBindings));
  220 + return keyBindings;
  221 + }
  222 +
  223 + /* (non-Javadoc)
  224 + * @see com.mumfrey.liteloader.common.GameEngine#setKeyBindings(java.util.List)
  225 + */
  226 + @Override
  227 + public void setKeyBindings(List<KeyBinding> keyBindings)
  228 + {
  229 + this.engine.gameSettings.keyBindings = keyBindings.toArray(new KeyBinding[0]);
  230 + }
  231 +}
java/client/com/mumfrey/liteloader/client/LiteLoaderCoreProviderClient.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.resources.SimpleReloadableResourceManager;
  4 +import net.minecraft.network.INetHandler;
  5 +import net.minecraft.network.play.server.S01PacketJoinGame;
  6 +import net.minecraft.world.World;
  7 +
  8 +import com.mumfrey.liteloader.api.CoreProvider;
  9 +import com.mumfrey.liteloader.common.GameEngine;
  10 +import com.mumfrey.liteloader.core.LiteLoader;
  11 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  12 +import com.mumfrey.liteloader.launch.LoaderProperties;
  13 +import com.mumfrey.liteloader.resources.InternalResourcePack;
  14 +
  15 +/**
  16 + * CoreProvider which fixes SoundManager derping up at startup
  17 + *
  18 + * @author Adam Mummery-Smith
  19 + */
  20 +public class LiteLoaderCoreProviderClient implements CoreProvider
  21 +{
  22 + /**
  23 + * Loader Properties adapter
  24 + */
  25 + private final LoaderProperties properties;
  26 +
  27 + /**
  28 + * Read from the properties file, if true we will inhibit the sound manager reload during startup to avoid getting in trouble with OpenAL
  29 + */
  30 + private boolean inhibitSoundManagerReload = true;
  31 +
  32 + /**
  33 + * 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
  34 + */
  35 + private SoundHandlerReloadInhibitor soundHandlerReloadInhibitor;
  36 +
  37 + public LiteLoaderCoreProviderClient(LoaderProperties properties)
  38 + {
  39 + this.properties = properties;
  40 + }
  41 +
  42 + @Override
  43 + public void onInit()
  44 + {
  45 + this.inhibitSoundManagerReload = this.properties.getAndStoreBooleanProperty(LoaderProperties.OPTION_SOUND_MANAGER_FIX, true);
  46 + }
  47 +
  48 + @Override
  49 + public void onPostInit(GameEngine<?, ?> engine)
  50 + {
  51 + this.soundHandlerReloadInhibitor = new SoundHandlerReloadInhibitor((SimpleReloadableResourceManager)engine.getResourceManager(), ((GameEngineClient)engine).getSoundHandler());
  52 +
  53 + if (this.inhibitSoundManagerReload)
  54 + {
  55 + this.soundHandlerReloadInhibitor.inhibit();
  56 + }
  57 +
  58 + // Add self as a resource pack for texture/lang resources
  59 + LiteLoader.getInstance().registerModResourcePack(new InternalResourcePack("LiteLoader", LiteLoader.class, "liteloader"));
  60 + }
  61 +
  62 + @Override
  63 + public void onPostInitComplete(LiteLoaderMods mods)
  64 + {
  65 + }
  66 +
  67 + @Override
  68 + public void onStartupComplete()
  69 + {
  70 + if (this.soundHandlerReloadInhibitor != null && this.soundHandlerReloadInhibitor.isInhibited())
  71 + {
  72 + this.soundHandlerReloadInhibitor.unInhibit(true);
  73 + }
  74 + }
  75 +
  76 + @Override
  77 + public void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket)
  78 + {
  79 + }
  80 +
  81 + @Override
  82 + public void onPostRender(int mouseX, int mouseY, float partialTicks)
  83 + {
  84 + }
  85 +
  86 + @Override
  87 + public void onTick(boolean clock, float partialTicks, boolean inGame)
  88 + {
  89 + }
  90 +
  91 + @Override
  92 + public void onWorldChanged(World world)
  93 + {
  94 + }
  95 +
  96 + @Override
  97 + public void onShutDown()
  98 + {
  99 + }
  100 +}
java/client/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.gui.GuiIngameMenu;
  5 +import net.minecraft.client.gui.GuiMainMenu;
  6 +import net.minecraft.client.gui.GuiOptions;
  7 +import net.minecraft.client.gui.GuiScreen;
  8 +
  9 +import org.lwjgl.input.Keyboard;
  10 +
  11 +import com.mumfrey.liteloader.client.gui.GuiLiteLoaderPanel;
  12 +import com.mumfrey.liteloader.common.GameEngine;
  13 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  14 +import com.mumfrey.liteloader.interfaces.PanelManager;
  15 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  16 +import com.mumfrey.liteloader.launch.LoaderProperties;
  17 +import com.mumfrey.liteloader.modconfig.ConfigManager;
  18 +
  19 +/**
  20 + * Observer which handles the display of the mod panel
  21 + *
  22 + * @author Adam Mummery-Smith
  23 + */
  24 +public class LiteLoaderPanelManager implements PanelManager<GuiScreen>
  25 +{
  26 + private static final String OPTION_MOD_INFO_SCREEN = "modInfoScreen";
  27 + private static final String OPTION_NO_HIDE_TAB = "tabAlwaysExpanded";
  28 +
  29 + private final LoaderEnvironment environment;
  30 +
  31 + /**
  32 + * Loader Properties adapter
  33 + */
  34 + private final LoaderProperties properties;
  35 +
  36 + private LiteLoaderMods mods;
  37 +
  38 + private ConfigManager configManager;
  39 +
  40 + private Minecraft minecraft;
  41 +
  42 + /**
  43 + * Setting which determines whether we show the "mod info" screen tab in the main menu
  44 + */
  45 + private boolean displayModInfoScreenTab = true;
  46 +
  47 + /**
  48 + * Don't hide t
  49 + */
  50 + private boolean tabAlwaysExpanded = false;
  51 +
  52 + /**
  53 + * Override for the "mod info" tab setting, so that mods which want to handle the mod info themselves
  54 + * can temporarily disable the function without having to change the underlying property
  55 + */
  56 + private boolean hideModInfoScreenTab = false;
  57 +
  58 + /**
  59 + * Active "mod info" screen, drawn as an overlay when in the main menu and made the active screen if
  60 + * the user clicks the tab
  61 + */
  62 + private GuiLiteLoaderPanel panelHost;
  63 +
  64 + /**
  65 + * @param environment
  66 + * @param properties
  67 + */
  68 + @SuppressWarnings("unchecked")
  69 + public LiteLoaderPanelManager(GameEngine<?, ?> engine, LoaderEnvironment environment, LoaderProperties properties)
  70 + {
  71 + this.environment = environment;
  72 + this.properties = properties;
  73 + this.minecraft = ((GameEngine<Minecraft, ?>)engine).getClient();
  74 +
  75 + this.displayModInfoScreenTab = this.properties.getAndStoreBooleanProperty(LiteLoaderPanelManager.OPTION_MOD_INFO_SCREEN, true);
  76 + this.tabAlwaysExpanded = this.properties.getAndStoreBooleanProperty(LiteLoaderPanelManager.OPTION_NO_HIDE_TAB, false);
  77 + }
  78 +
  79 + @Override
  80 + public void init(LiteLoaderMods mods, ConfigManager configManager)
  81 + {
  82 + this.mods = mods;
  83 + this.configManager = configManager;
  84 + }
  85 +
  86 + /* (non-Javadoc)
  87 + * @see com.mumfrey.liteloader.api.TickObserver#onTick(boolean, float, boolean)
  88 + */
  89 + @Override
  90 + public void onTick(boolean clock, float partialTicks, boolean inGame)
  91 + {
  92 + if (clock && this.panelHost != null && this.minecraft.currentScreen != this.panelHost)
  93 + {
  94 + this.panelHost.updateScreen();
  95 + }
  96 + }
  97 +
  98 + /* (non-Javadoc)
  99 + * @see com.mumfrey.liteloader.api.PostRenderObserver#onPostRender(int, int, float)
  100 + */
  101 + @Override
  102 + public void onPostRender(int mouseX, int mouseY, float partialTicks)
  103 + {
  104 + if (this.mods == null) return;
  105 +
  106 + boolean tabHidden = this.hideModInfoScreenTab && this.minecraft.currentScreen instanceof GuiMainMenu;
  107 +
  108 + if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && ((this.displayModInfoScreenTab && !tabHidden) || (this.panelHost != null && this.panelHost.isOpen())))
  109 + {
  110 + // If we're at the main menu, prepare the overlay
  111 + if (this.panelHost == null || this.panelHost.getScreen() != this.minecraft.currentScreen)
  112 + {
  113 + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, this.minecraft.currentScreen, this.mods, this.environment, this.configManager, !tabHidden);
  114 + }
  115 +
  116 + this.minecraft.entityRenderer.setupOverlayRendering();
  117 + this.panelHost.drawScreen(mouseX, mouseY, partialTicks, this.tabAlwaysExpanded);
  118 + }
  119 + else if (this.minecraft.currentScreen != this.panelHost && this.panelHost != null)
  120 + {
  121 + // If we're in any other screen, kill the overlay
  122 + this.panelHost.release();
  123 + this.panelHost = null;
  124 + }
  125 + else if (this.isPanelSupportedOnScreen(this.minecraft.currentScreen) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_TAB))
  126 + {
  127 + this.displayLiteLoaderPanel(this.minecraft.currentScreen);
  128 + }
  129 + }
  130 +
  131 + /**
  132 + * Set the "mod info" screen tab to hidden, regardless of the property setting
  133 + */
  134 + @Override
  135 + public void hideTab()
  136 + {
  137 + this.hideModInfoScreenTab = true;
  138 + }
  139 +
  140 + /**
  141 + * Set whether the "mod info" screen tab should be shown in the main menu
  142 + */
  143 + @Override
  144 + public void setTabVisible(boolean show)
  145 + {
  146 + this.displayModInfoScreenTab = show;
  147 + this.properties.setBooleanProperty(LiteLoaderPanelManager.OPTION_MOD_INFO_SCREEN, show);
  148 + this.properties.writeProperties();
  149 + }
  150 +
  151 + /**
  152 + * Get whether the "mod info" screen tab is shown in the main menu
  153 + */
  154 + @Override
  155 + public boolean isTabVisible()
  156 + {
  157 + return this.displayModInfoScreenTab;
  158 + }
  159 +
  160 + @Override
  161 + public void setTabAlwaysExpanded(boolean expand)
  162 + {
  163 + this.tabAlwaysExpanded = expand;
  164 + this.properties.setBooleanProperty(LiteLoaderPanelManager.OPTION_NO_HIDE_TAB, expand);
  165 + this.properties.writeProperties();
  166 + }
  167 +
  168 + @Override
  169 + public boolean isTabAlwaysExpanded()
  170 + {
  171 + return this.tabAlwaysExpanded;
  172 + }
  173 +
  174 + /**
  175 + * Display the liteloader panel over the specified GUI
  176 + *
  177 + * @param parentScreen
  178 + */
  179 + @Override
  180 + public void displayLiteLoaderPanel(GuiScreen parentScreen)
  181 + {
  182 + if (this.isPanelSupportedOnScreen(parentScreen))
  183 + {
  184 + this.panelHost = new GuiLiteLoaderPanel(this.minecraft, parentScreen, this.mods, this.environment, this.configManager, !this.hideModInfoScreenTab);
  185 + this.minecraft.displayGuiScreen(this.panelHost);
  186 + }
  187 + }
  188 +
  189 + private boolean isPanelSupportedOnScreen(GuiScreen guiScreen)
  190 + {
  191 + return (
  192 + guiScreen instanceof GuiMainMenu ||
  193 + guiScreen instanceof GuiIngameMenu ||
  194 + guiScreen instanceof GuiOptions
  195 + );
  196 + }
  197 +}
java/com/mumfrey/liteloader/core/SoundHandlerReloadInhibitor.java renamed to java/client/com/mumfrey/liteloader/client/SoundHandlerReloadInhibitor.java
1 -package com.mumfrey.liteloader.core; 1 +package com.mumfrey.liteloader.client;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
@@ -6,7 +6,7 @@ import net.minecraft.client.audio.SoundHandler; @@ -6,7 +6,7 @@ import net.minecraft.client.audio.SoundHandler;
6 import net.minecraft.client.resources.IResourceManagerReloadListener; 6 import net.minecraft.client.resources.IResourceManagerReloadListener;
7 import net.minecraft.client.resources.SimpleReloadableResourceManager; 7 import net.minecraft.client.resources.SimpleReloadableResourceManager;
8 8
9 -import com.mumfrey.liteloader.util.PrivateFields; 9 +import com.mumfrey.liteloader.client.util.PrivateFields;
10 import com.mumfrey.liteloader.util.log.LiteLoaderLogger; 10 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
11 11
12 /** 12 /**
java/client/com/mumfrey/liteloader/client/api/LiteLoaderBrandingProvider.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client.api;
  2 +
  3 +import java.net.URI;
  4 +
  5 +import net.minecraft.client.resources.I18n;
  6 +import net.minecraft.util.IIcon;
  7 +import net.minecraft.util.ResourceLocation;
  8 +
  9 +import com.mumfrey.liteloader.api.BrandingProvider;
  10 +import com.mumfrey.liteloader.client.util.render.IconAbsolute;
  11 +import com.mumfrey.liteloader.core.LiteLoader;
  12 +
  13 +/**
  14 + * LiteLoader's branding provider
  15 + *
  16 + * @author Adam Mummery-Smith
  17 + */
  18 +public class LiteLoaderBrandingProvider implements BrandingProvider
  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 IIcon 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 IIcon 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 IIcon getTwitterAvatarCoords()
  133 + {
  134 + return LiteLoaderBrandingProvider.TWITTER_AVATAR_COORDS;
  135 + }
  136 +}
java/client/com/mumfrey/liteloader/client/api/LiteLoaderCoreAPIClient.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client.api;
  2 +
  3 +import java.util.List;
  4 +
  5 +import net.minecraft.client.Minecraft;
  6 +import net.minecraft.server.integrated.IntegratedServer;
  7 +
  8 +import com.google.common.collect.ImmutableList;
  9 +import com.mumfrey.liteloader.api.CoreProvider;
  10 +import com.mumfrey.liteloader.api.CustomisationProvider;
  11 +import com.mumfrey.liteloader.api.InterfaceProvider;
  12 +import com.mumfrey.liteloader.api.Observer;
  13 +import com.mumfrey.liteloader.client.LiteLoaderCoreProviderClient;
  14 +import com.mumfrey.liteloader.core.LiteLoader;
  15 +import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
  16 +import com.mumfrey.liteloader.interfaces.ObjectFactory;
  17 +
  18 +/**
  19 + * Client side of the core API
  20 + *
  21 + * @author Adam Mummery-Smith
  22 + */
  23 +public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
  24 +{
  25 + private static final String PKG_LITELOADER_CLIENT = LiteLoaderCoreAPI.PKG_LITELOADER + ".client";
  26 +
  27 + private static final String[] requiredTransformers = {
  28 + LiteLoaderCoreAPI.PKG_LITELOADER + ".launch.LiteLoaderTransformer",
  29 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.CrashReportTransformer"
  30 + };
  31 +
  32 + private static final String[] requiredDownstreamTransformers = {
  33 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderCallbackInjectionTransformer",
  34 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LiteLoaderEventInjectionTransformer",
  35 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftOverlayTransformer"
  36 + };
  37 +
  38 + private static final String[] defaultPacketTransformers = {
  39 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.LoginSuccessPacketTransformer",
  40 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.ChatPacketTransformer",
  41 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.JoinGamePacketTransformer",
  42 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.CustomPayloadPacketTransformer",
  43 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.ServerChatPacketTransformer",
  44 + LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.ServerCustomPayloadPacketTransformer"
  45 + };
  46 +
  47 + private ObjectFactory<Minecraft, IntegratedServer> objectFactory;
  48 +
  49 + /* (non-Javadoc)
  50 + * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers()
  51 + */
  52 + @Override
  53 + public String[] getRequiredTransformers()
  54 + {
  55 + return LiteLoaderCoreAPIClient.requiredTransformers;
  56 + }
  57 +
  58 + /* (non-Javadoc)
  59 + * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredDownstreamTransformers()
  60 + */
  61 + @Override
  62 + public String[] getRequiredDownstreamTransformers()
  63 + {
  64 + return LiteLoaderCoreAPIClient.requiredDownstreamTransformers;
  65 + }
  66 +
  67 + /* (non-Javadoc)
  68 + * @see com.mumfrey.liteloader.api.LiteAPI#getPacketTransformers()
  69 + */
  70 + @Override
  71 + public String[] getPacketTransformers()
  72 + {
  73 + return LiteLoaderCoreAPIClient.defaultPacketTransformers;
  74 + }
  75 +
  76 + /* (non-Javadoc)
  77 + * @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders()
  78 + */
  79 + @Override
  80 + public List<CustomisationProvider> getCustomisationProviders()
  81 + {
  82 + return ImmutableList.<CustomisationProvider>of
  83 + (
  84 + new LiteLoaderBrandingProvider()
  85 + );
  86 + }
  87 +
  88 + /* (non-Javadoc)
  89 + * @see com.mumfrey.liteloader.api.LiteAPI#getCoreProviders()
  90 + */
  91 + @Override
  92 + public List<CoreProvider> getCoreProviders()
  93 + {
  94 + return ImmutableList.<CoreProvider>of
  95 + (
  96 + new LiteLoaderCoreProviderClient(this.properties),
  97 + LiteLoader.getInput()
  98 + );
  99 + }
  100 +
  101 +
  102 + /* (non-Javadoc)
  103 + * @see com.mumfrey.liteloader.api.LiteAPI#getInterfaceProviders()
  104 + */
  105 + @Override
  106 + public List<InterfaceProvider> getInterfaceProviders()
  107 + {
  108 + ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
  109 +
  110 + return ImmutableList.<InterfaceProvider>of
  111 + (
  112 + objectFactory.getEventBroker(),
  113 + objectFactory.getClientPluginChannels(),
  114 + objectFactory.getServerPluginChannels()
  115 + );
  116 + }
  117 +
  118 + /* (non-Javadoc)
  119 + * @see com.mumfrey.liteloader.api.LiteAPI#getObservers()
  120 + */
  121 + @Override
  122 + public List<Observer> getObservers()
  123 + {
  124 + return ImmutableList.<Observer>of
  125 + (
  126 + this.getObjectFactory().getModPanelManager()
  127 + );
  128 + }
  129 +
  130 + /* (non-Javadoc)
  131 + * @see com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI#getObjectFactory()
  132 + */
  133 + @Override
  134 + public ObjectFactory<?, ?> getObjectFactory()
  135 + {
  136 + if (this.objectFactory == null)
  137 + {
  138 + this.objectFactory = new ObjectFactoryClient(this.environment, this.properties);
  139 + }
  140 +
  141 + return this.objectFactory;
  142 + }
  143 +}
java/client/com/mumfrey/liteloader/client/api/ObjectFactoryClient.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client.api;
  2 +
  3 +import net.minecraft.client.Minecraft;
  4 +import net.minecraft.client.gui.GuiScreen;
  5 +import net.minecraft.server.integrated.IntegratedServer;
  6 +
  7 +import com.mumfrey.liteloader.client.ClientEvents;
  8 +import com.mumfrey.liteloader.client.ClientPluginChannelsClient;
  9 +import com.mumfrey.liteloader.client.GameEngineClient;
  10 +import com.mumfrey.liteloader.client.LiteLoaderPanelManager;
  11 +import com.mumfrey.liteloader.client.gui.startup.LoadingBar;
  12 +import com.mumfrey.liteloader.common.GameEngine;
  13 +import com.mumfrey.liteloader.core.ClientPluginChannels;
  14 +import com.mumfrey.liteloader.core.Events;
  15 +import com.mumfrey.liteloader.core.LiteLoader;
  16 +import com.mumfrey.liteloader.core.ServerPluginChannels;
  17 +import com.mumfrey.liteloader.interfaces.PanelManager;
  18 +import com.mumfrey.liteloader.interfaces.ObjectFactory;
  19 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  20 +import com.mumfrey.liteloader.launch.LoaderProperties;
  21 +import com.mumfrey.liteloader.permissions.PermissionsManagerClient;
  22 +import com.mumfrey.liteloader.permissions.PermissionsManagerServer;
  23 +
  24 +/**
  25 + * Factory for lifetime loader objects for the client side
  26 + *
  27 + * @author Adam Mummery-Smith
  28 + */
  29 +class ObjectFactoryClient implements ObjectFactory<Minecraft, IntegratedServer>
  30 +{
  31 + private LoaderEnvironment environment;
  32 +
  33 + private LoaderProperties properties;
  34 +
  35 + private ClientEvents clientEvents;
  36 +
  37 + private GameEngineClient engine;
  38 +
  39 + private PanelManager<GuiScreen> modPanelManager;
  40 +
  41 + private ClientPluginChannelsClient clientPluginChannels;
  42 +
  43 + private ServerPluginChannels serverPluginChannels;
  44 +
  45 + ObjectFactoryClient(LoaderEnvironment environment, LoaderProperties properties)
  46 + {
  47 + this.environment = environment;
  48 + this.properties = properties;
  49 + }
  50 +
  51 + @Override
  52 + public Events<Minecraft, IntegratedServer> getEventBroker()
  53 + {
  54 + if (this.clientEvents == null)
  55 + {
  56 + this.clientEvents = new ClientEvents(LiteLoader.getInstance(), (GameEngineClient)this.getGameEngine(), this.properties);
  57 + }
  58 +
  59 + return this.clientEvents;
  60 + }
  61 +
  62 + @Override
  63 + public GameEngine<Minecraft, IntegratedServer> getGameEngine()
  64 + {
  65 + if (this.engine == null)
  66 + {
  67 + this.engine = new GameEngineClient();
  68 + }
  69 +
  70 + return this.engine;
  71 + }
  72 +
  73 + @Override
  74 + public PanelManager<GuiScreen> getModPanelManager()
  75 + {
  76 + if (this.modPanelManager == null)
  77 + {
  78 + this.modPanelManager = new LiteLoaderPanelManager(this.getGameEngine(), this.environment, this.properties);
  79 + }
  80 +
  81 + return this.modPanelManager;
  82 + }
  83 +
  84 + @Override
  85 + public ClientPluginChannels getClientPluginChannels()
  86 + {
  87 + if (this.clientPluginChannels == null)
  88 + {
  89 + this.clientPluginChannels = new ClientPluginChannelsClient();
  90 + }
  91 +
  92 + return this.clientPluginChannels;
  93 + }
  94 +
  95 + @Override
  96 + public ServerPluginChannels getServerPluginChannels()
  97 + {
  98 + if (this.serverPluginChannels == null)
  99 + {
  100 + this.serverPluginChannels = new ServerPluginChannels();
  101 + }
  102 +
  103 + return this.serverPluginChannels;
  104 + }
  105 +
  106 + @Override
  107 + public PermissionsManagerClient getClientPermissionManager()
  108 + {
  109 + return PermissionsManagerClient.getInstance();
  110 + }
  111 +
  112 + @Override
  113 + public PermissionsManagerServer getServerPermissionManager()
  114 + {
  115 + return null;
  116 + }
  117 +
  118 + @SuppressWarnings("unused")
  119 + @Override
  120 + public void preBeginGame()
  121 + {
  122 + new LoadingBar();
  123 + }
  124 +}
java/com/mumfrey/liteloader/core/gen/GenProfiler.java renamed to java/client/com/mumfrey/liteloader/client/gen/GenProfiler.java
1 -package com.mumfrey.liteloader.core.gen; 1 +package com.mumfrey.liteloader.client.gen;
2 2
3 import java.util.HashMap; 3 import java.util.HashMap;
4 import java.util.HashSet; 4 import java.util.HashSet;
java/com/mumfrey/liteloader/core/gen/GenProfilerTransformer.java renamed to java/client/com/mumfrey/liteloader/client/gen/GenProfilerTransformer.java
1 -package com.mumfrey.liteloader.core.gen; 1 +package com.mumfrey.liteloader.client.gen;
2 2
3 import java.util.HashMap; 3 import java.util.HashMap;
4 import java.util.Iterator; 4 import java.util.Iterator;
@@ -77,7 +77,7 @@ public class GenProfilerTransformer implements IClassTransformer @@ -77,7 +77,7 @@ public class GenProfilerTransformer implements IClassTransformer
77 77
78 for (Entry<MethodInsnNode, String> node : injectionNodes.entrySet()) 78 for (Entry<MethodInsnNode, String> node : injectionNodes.entrySet())
79 { 79 {
80 - method.instructions.insert(node.getKey(), new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mumfrey/liteloader/core/gen/GenProfiler", "storeSignature", "(Ljava/lang/String;)V")); 80 + method.instructions.insert(node.getKey(), new MethodInsnNode(Opcodes.INVOKESTATIC, "com/mumfrey/liteloader/core/gen/GenProfiler", "storeSignature", "(Ljava/lang/String;)V", false));
81 method.instructions.insert(node.getKey(), new LdcInsnNode(node.getValue())); 81 method.instructions.insert(node.getKey(), new LdcInsnNode(node.getValue()));
82 } 82 }
83 } 83 }
java/com/mumfrey/liteloader/gui/GuiCheckbox.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiCheckbox.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
2 2
3 import static org.lwjgl.opengl.GL11.*; 3 import static org.lwjgl.opengl.GL11.*;
  4 +
  5 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  6 +
4 import net.minecraft.client.Minecraft; 7 import net.minecraft.client.Minecraft;
5 import net.minecraft.client.gui.GuiButton; 8 import net.minecraft.client.gui.GuiButton;
6 9
@@ -15,26 +18,26 @@ public class GuiCheckbox extends GuiButton @@ -15,26 +18,26 @@ public class GuiCheckbox extends GuiButton
15 18
16 public GuiCheckbox(int controlId, int xPosition, int yPosition, String displayString) 19 public GuiCheckbox(int controlId, int xPosition, int yPosition, String displayString)
17 { 20 {
18 - super(controlId, xPosition, yPosition, Minecraft.getMinecraft().fontRenderer.getStringWidth(displayString) + 16, 12, displayString); 21 + super(controlId, xPosition, yPosition, Minecraft.getMinecraft().fontRendererObj.getStringWidth(displayString) + 16, 12, displayString);
19 } 22 }
20 23
21 @Override 24 @Override
22 public void drawButton(Minecraft minecraft, int mouseX, int mouseY) 25 public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
23 { 26 {
24 - if (this.field_146125_m) // drawButton 27 + if (this.visible)
25 { 28 {
26 - minecraft.getTextureManager().bindTexture(GuiScreenModInfo.aboutTextureResource); 29 + minecraft.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE);
27 glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 30 glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
28 - this.field_146123_n = mouseX >= this.field_146128_h && mouseY >= this.field_146129_i && mouseX < this.field_146128_h + this.field_146120_f && mouseY < this.field_146129_i + this.field_146121_g; 31 + this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
29 32
30 - this.drawTexturedModalRect(this.field_146128_h, this.field_146129_i, this.checked ? 134 : 122, 80, 12, 12); 33 + this.drawTexturedModalRect(this.xPosition, this.yPosition, this.checked ? 134 : 122, 80, 12, 12);
31 this.mouseDragged(minecraft, mouseX, mouseY); 34 this.mouseDragged(minecraft, mouseX, mouseY);
32 35
33 int colour = 0xE0E0E0; 36 int colour = 0xE0E0E0;
34 if (!this.enabled) colour = 0xA0A0A0; 37 if (!this.enabled) colour = 0xA0A0A0;
35 - else if (this.field_146123_n) colour = 0xFFFFA0; 38 + else if (this.hovered) colour = 0xFFFFA0;
36 39
37 - this.drawString(minecraft.fontRenderer, this.displayString, this.field_146128_h + 16, this.field_146129_i + 2, colour); 40 + this.drawString(minecraft.fontRendererObj, this.displayString, this.xPosition + 16, this.yPosition + 2, colour);
38 } 41 }
39 } 42 }
40 } 43 }
java/com/mumfrey/liteloader/gui/GuiHoverLabel.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiHoverLabel.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
  2 +
  3 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
2 4
3 import net.minecraft.client.Minecraft; 5 import net.minecraft.client.Minecraft;
4 import net.minecraft.client.gui.FontRenderer; 6 import net.minecraft.client.gui.FontRenderer;
@@ -12,7 +14,12 @@ public class GuiHoverLabel extends GuiButton @@ -12,7 +14,12 @@ public class GuiHoverLabel extends GuiButton
12 14
13 public GuiHoverLabel(int id, int xPosition, int yPosition, FontRenderer fontRenderer, String displayText) 15 public GuiHoverLabel(int id, int xPosition, int yPosition, FontRenderer fontRenderer, String displayText)
14 { 16 {
15 - this(id, xPosition, yPosition, fontRenderer, displayText, 0xFF4785D1, 0xFFFFFFAA); 17 + this(id, xPosition, yPosition, fontRenderer, displayText, LiteLoaderBrandingProvider.BRANDING_COLOUR);
  18 + }
  19 +
  20 + public GuiHoverLabel(int id, int xPosition, int yPosition, FontRenderer fontRenderer, String displayText, int colour)
  21 + {
  22 + this(id, xPosition, yPosition, fontRenderer, displayText, colour, 0xFFFFFFAA);
16 } 23 }
17 24
18 public GuiHoverLabel(int id, int xPosition, int yPosition, FontRenderer fontRenderer, String displayText, int colour, int hoverColour) 25 public GuiHoverLabel(int id, int xPosition, int yPosition, FontRenderer fontRenderer, String displayText, int colour, int hoverColour)
@@ -27,14 +34,14 @@ public class GuiHoverLabel extends GuiButton @@ -27,14 +34,14 @@ public class GuiHoverLabel extends GuiButton
27 @Override 34 @Override
28 public void drawButton(Minecraft minecraft, int mouseX, int mouseY) 35 public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
29 { 36 {
30 - if (this.field_146125_m) 37 + if (this.visible)
31 { 38 {
32 - this.field_146123_n = mouseX >= this.field_146128_h && mouseY >= this.field_146129_i && mouseX < this.field_146128_h + this.field_146120_f && mouseY < this.field_146129_i + this.field_146121_g;  
33 - this.fontRenderer.drawString(this.displayString, this.field_146128_h, this.field_146129_i, this.field_146123_n ? this.hoverColour : this.colour); 39 + this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
  40 + this.fontRenderer.drawString(this.displayString, this.xPosition, this.yPosition, this.hovered ? this.hoverColour : this.colour);
34 } 41 }
35 else 42 else
36 { 43 {
37 - this.field_146123_n = false; 44 + this.hovered = false;
38 } 45 }
39 } 46 }
40 47
java/com/mumfrey/liteloader/gui/GuiScreenModInfo.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiLiteLoaderPanel.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
2 2
3 import static org.lwjgl.opengl.GL11.*; 3 import static org.lwjgl.opengl.GL11.*;
4 4
5 import java.nio.DoubleBuffer; 5 import java.nio.DoubleBuffer;
6 -import java.util.ArrayList;  
7 -import java.util.List;  
8 -import java.util.Map;  
9 -import java.util.TreeMap;  
10 6
11 import net.minecraft.client.Minecraft; 7 import net.minecraft.client.Minecraft;
12 import net.minecraft.client.gui.FontRenderer; 8 import net.minecraft.client.gui.FontRenderer;
13 import net.minecraft.client.gui.GuiButton; 9 import net.minecraft.client.gui.GuiButton;
14 -import net.minecraft.client.gui.GuiIngameMenu;  
15 -import net.minecraft.client.gui.GuiMainMenu;  
16 -import net.minecraft.client.gui.GuiOptions;  
17 import net.minecraft.client.gui.GuiScreen; 10 import net.minecraft.client.gui.GuiScreen;
18 import net.minecraft.client.renderer.Tessellator; 11 import net.minecraft.client.renderer.Tessellator;
19 import net.minecraft.client.resources.I18n; 12 import net.minecraft.client.resources.I18n;
  13 +import net.minecraft.util.IIcon;
20 import net.minecraft.util.ResourceLocation; 14 import net.minecraft.util.ResourceLocation;
21 15
22 import org.lwjgl.BufferUtils; 16 import org.lwjgl.BufferUtils;
@@ -24,10 +18,14 @@ import org.lwjgl.input.Keyboard; @@ -24,10 +18,14 @@ import org.lwjgl.input.Keyboard;
24 import org.lwjgl.input.Mouse; 18 import org.lwjgl.input.Mouse;
25 19
26 import com.mumfrey.liteloader.LiteMod; 20 import com.mumfrey.liteloader.LiteMod;
27 -import com.mumfrey.liteloader.core.EnabledModsList; 21 +import com.mumfrey.liteloader.api.LiteAPI;
  22 +import com.mumfrey.liteloader.api.BrandingProvider;
  23 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
28 import com.mumfrey.liteloader.core.LiteLoader; 24 import com.mumfrey.liteloader.core.LiteLoader;
29 import com.mumfrey.liteloader.core.LiteLoaderVersion; 25 import com.mumfrey.liteloader.core.LiteLoaderVersion;
30 -import com.mumfrey.liteloader.core.Loadable; 26 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  27 +import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
  28 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
31 import com.mumfrey.liteloader.modconfig.ConfigManager; 29 import com.mumfrey.liteloader.modconfig.ConfigManager;
32 import com.mumfrey.liteloader.modconfig.ConfigPanel; 30 import com.mumfrey.liteloader.modconfig.ConfigPanel;
33 31
@@ -40,16 +38,15 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel; @@ -40,16 +38,15 @@ import com.mumfrey.liteloader.modconfig.ConfigPanel;
40 * 38 *
41 * @author Adam Mummery-Smith 39 * @author Adam Mummery-Smith
42 */ 40 */
43 -public class GuiScreenModInfo extends GuiScreen 41 +public class GuiLiteLoaderPanel extends GuiScreen
44 { 42 {
45 - private static final int LEFT_EDGE = 80;  
46 - private static final int MARGIN = 12;  
47 - private static final int TAB_WIDTH = 20;  
48 - private static final int TAB_HEIGHT = 40;  
49 - private static final int TAB_TOP = 20;  
50 - private static final int PANEL_TOP = 83;  
51 - private static final int PANEL_BOTTOM = 26;  
52 - private static final int SCROLLBAR_WIDTH = 5; 43 + static final int LEFT_EDGE = 80;
  44 + static final int MARGIN = 12;
  45 + static final int TAB_WIDTH = 20;
  46 + static final int TAB_HEIGHT = 40;
  47 + static final int TAB_TOP = 20;
  48 + static final int PANEL_TOP = 83;
  49 + static final int PANEL_BOTTOM = 26;
53 50
54 private static final double TWEEN_RATE = 0.08; 51 private static final double TWEEN_RATE = 0.08;
55 52
@@ -58,13 +55,10 @@ public class GuiScreenModInfo extends GuiScreen @@ -58,13 +55,10 @@ public class GuiScreenModInfo extends GuiScreen
58 */ 55 */
59 private static DoubleBuffer doubleBuffer = BufferUtils.createByteBuffer(64).asDoubleBuffer(); 56 private static DoubleBuffer doubleBuffer = BufferUtils.createByteBuffer(64).asDoubleBuffer();
60 57
61 - // Texture resources for the "about mods" screen  
62 - public static ResourceLocation aboutTextureResource = new ResourceLocation("liteloader", "textures/gui/about.png");  
63 -  
64 /** 58 /**
65 * Reference to the main menu which this screen is either overlaying or using as its background 59 * Reference to the main menu which this screen is either overlaying or using as its background
66 */ 60 */
67 - private GuiScreen mainMenu; 61 + private GuiScreen parentScreen;
68 62
69 /** 63 /**
70 * Tick number (update counter) used for tweening 64 * Tick number (update counter) used for tweening
@@ -87,26 +81,11 @@ public class GuiScreenModInfo extends GuiScreen @@ -87,26 +81,11 @@ public class GuiScreenModInfo extends GuiScreen
87 private boolean mouseDown, toggled; 81 private boolean mouseDown, toggled;
88 82
89 /** 83 /**
90 - * Timer used to handle double-clicking on a mod  
91 - */  
92 - private int doubleClickTime = 0;  
93 -  
94 - /**  
95 * Hover opacity for the tab 84 * Hover opacity for the tab
96 */ 85 */
97 private float tabOpacity = 0.0F; 86 private float tabOpacity = 0.0F;
98 87
99 - private boolean hideTab = true;  
100 -  
101 - /**  
102 - * List of enumerated mods  
103 - */  
104 - private List<GuiModListEntry> mods = new ArrayList<GuiModListEntry>();  
105 -  
106 - /**  
107 - * Currently selected mod  
108 - */  
109 - private GuiModListEntry selectedMod = null; 88 + private boolean showTab = true;
110 89
111 /** 90 /**
112 * Text to display under the header 91 * Text to display under the header
@@ -114,96 +93,98 @@ public class GuiScreenModInfo extends GuiScreen @@ -114,96 +93,98 @@ public class GuiScreenModInfo extends GuiScreen
114 private String activeModText, versionText; 93 private String activeModText, versionText;
115 94
116 /** 95 /**
117 - * Height of all the items in the list 96 + * Configuration panel
118 */ 97 */
119 - private int listHeight = 100; 98 + private GuiPanel currentPanel;
120 99
121 - /**  
122 - * Scroll bar control for the mods list  
123 - */  
124 - private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar(); 100 + private final GuiPanelMods modsPanel;
  101 + private final GuiPanelSettings settingsPanel;
125 102
126 - /**  
127 - * Enable / disable button  
128 - */  
129 - private GuiButton btnToggle; 103 + private int brandColour = LiteLoaderBrandingProvider.BRANDING_COLOUR;
130 104
131 - /**  
132 - * Config button  
133 - */  
134 - private GuiButton btnConfig; 105 + private ResourceLocation logoResource = LiteLoaderBrandingProvider.ABOUT_TEXTURE;
  106 + private IIcon logoCoords = LiteLoaderBrandingProvider.LOGO_COORDS;
135 107
136 - /**  
137 - * Enable the mod info tab checkbox  
138 - */  
139 - private GuiCheckbox chkEnabled; 108 + private ResourceLocation iconResource = LiteLoaderBrandingProvider.ABOUT_TEXTURE;
  109 + private IIcon iconCoords = LiteLoaderBrandingProvider.ICON_COORDS;
140 110
141 - private ConfigManager configManager;  
142 -  
143 - /**  
144 - * Configuration panel  
145 - */  
146 - private ModInfoScreenPanel currentPanel; 111 + private boolean mouseOverLogo = false;
147 112
148 /** 113 /**
149 * @param minecraft 114 * @param minecraft
150 - * @param mainMenu  
151 - * @param loader  
152 - * @param enabledModsList 115 + * @param parentScreen
  116 + * @param mods
153 */ 117 */
154 - public GuiScreenModInfo(Minecraft minecraft, GuiScreen mainMenu, LiteLoader loader, EnabledModsList enabledModsList, ConfigManager configManager, boolean hideTab) 118 + public GuiLiteLoaderPanel(Minecraft minecraft, GuiScreen parentScreen, LiteLoaderMods mods, LoaderEnvironment environment, ConfigManager configManager, boolean showTab)
155 { 119 {
156 - this.mc = minecraft;  
157 - this.fontRendererObj = minecraft.fontRenderer;  
158 - this.mainMenu = mainMenu;  
159 - this.configManager = configManager;  
160 - this.hideTab = hideTab; 120 + this.mc = minecraft;
  121 + this.fontRendererObj = minecraft.fontRendererObj;
  122 + this.parentScreen = parentScreen;
  123 + this.showTab = showTab;
161 124
162 this.versionText = I18n.format("gui.about.versiontext", LiteLoader.getVersion()); 125 this.versionText = I18n.format("gui.about.versiontext", LiteLoader.getVersion());
  126 + this.activeModText = I18n.format("gui.about.modsloaded", mods.getLoadedMods().size());
  127 +
  128 + this.initBranding();
163 129
164 - this.populateModList(loader, enabledModsList); 130 + this.currentPanel = this.modsPanel = new GuiPanelMods(this, minecraft, mods, environment, configManager, this.brandColour);
  131 + this.settingsPanel = new GuiPanelSettings(this, minecraft);
165 } 132 }
166 - 133 +
167 /** 134 /**
168 - * Populate the mods list  
169 * 135 *
170 - * @param loader  
171 - * @param enabledModsList  
172 */ 136 */
173 - private void populateModList(LiteLoader loader, EnabledModsList enabledModsList) 137 + private void initBranding()
174 { 138 {
175 - this.activeModText = I18n.format("gui.about.modsloaded", loader.getLoadedMods().size()); 139 + LiteAPI logoProvider = null;
176 140
177 - // Add mods to this treeset first, in order to sort them  
178 - Map<String, GuiModListEntry> sortedMods = new TreeMap<String, GuiModListEntry>(); 141 + int brandingColourProviderPriority = Integer.MIN_VALUE;
  142 + int logoProviderPriority = Integer.MIN_VALUE;
  143 + int iconProviderPriority = Integer.MIN_VALUE;
179 144
180 - // Active mods  
181 - for (LiteMod mod : loader.getLoadedMods()) 145 + for (LiteAPI api : LiteLoader.getAPIs())
182 { 146 {
183 - GuiModListEntry modListEntry = new GuiModListEntry(loader, enabledModsList, this.mc.fontRenderer, mod);  
184 - sortedMods.put(modListEntry.getKey(), modListEntry); 147 + BrandingProvider brandingProvider = LiteLoader.getCustomisationProvider(api, BrandingProvider.class);
  148 + if (brandingProvider == null) continue;
  149 +
  150 + if (brandingProvider.getBrandingColour() != 0 && brandingProvider.getPriority() > brandingColourProviderPriority)
  151 + {
  152 + brandingColourProviderPriority = brandingProvider.getPriority();
  153 + this.brandColour = 0xFF000000 | brandingProvider.getBrandingColour();
  154 + }
  155 +
  156 + ResourceLocation logoResource = brandingProvider.getLogoResource();
  157 + IIcon logoCoords = brandingProvider.getLogoCoords();
  158 + if (logoResource != null && logoCoords != null && brandingProvider.getPriority() > logoProviderPriority)
  159 + {
  160 + logoProvider = api;
  161 + logoProviderPriority = brandingProvider.getPriority();
  162 + this.logoResource = logoResource;
  163 + this.logoCoords = logoCoords;
  164 + }
  165 +
  166 + ResourceLocation iconResource = brandingProvider.getIconResource();
  167 + IIcon iconCoords = brandingProvider.getIconCoords();
  168 + if (iconResource != null && iconCoords != null && brandingProvider.getPriority() > iconProviderPriority)
  169 + {
  170 + iconProviderPriority = brandingProvider.getPriority();
  171 + this.iconResource = iconResource;
  172 + this.iconCoords = iconCoords;
  173 + }
185 } 174 }
186 175
187 - // Disabled mods  
188 - for (Loadable<?> disabledMod : loader.getDisabledMods())  
189 - {  
190 - GuiModListEntry modListEntry = new GuiModListEntry(loader, enabledModsList, this.mc.fontRenderer, disabledMod);  
191 - sortedMods.put(modListEntry.getKey(), modListEntry);  
192 - }  
193 -  
194 - // Injected tweaks  
195 - for (Loadable<?> injectedTweak : loader.getInjectedTweaks()) 176 + if (logoProvider != null && !LiteLoaderCoreAPI.class.isAssignableFrom(logoProvider.getClass()))
196 { 177 {
197 - GuiModListEntry modListEntry = new GuiModListEntry(loader, enabledModsList, this.mc.fontRenderer, injectedTweak);  
198 - sortedMods.put(modListEntry.getKey(), modListEntry); 178 + this.versionText = I18n.format("gui.about.poweredbyversion", logoProvider.getVersion(), LiteLoader.getVersion());
199 } 179 }
200 -  
201 - // Add the sorted mods to the mods list  
202 - this.mods.addAll(sortedMods.values());  
203 -  
204 - // Select the first mod in the list  
205 - if (this.mods.size() > 0)  
206 - this.selectedMod = this.mods.get(0); 180 + }
  181 +
  182 + /**
  183 + * @return
  184 + */
  185 + public int getBrandColour()
  186 + {
  187 + return this.brandColour;
207 } 188 }
208 189
209 /** 190 /**
@@ -211,7 +192,7 @@ public class GuiScreenModInfo extends GuiScreen @@ -211,7 +192,7 @@ public class GuiScreenModInfo extends GuiScreen
211 */ 192 */
212 public void release() 193 public void release()
213 { 194 {
214 - this.mainMenu = null; 195 + this.parentScreen = null;
215 } 196 }
216 197
217 /** 198 /**
@@ -219,13 +200,13 @@ public class GuiScreenModInfo extends GuiScreen @@ -219,13 +200,13 @@ public class GuiScreenModInfo extends GuiScreen
219 */ 200 */
220 public GuiScreen getScreen() 201 public GuiScreen getScreen()
221 { 202 {
222 - return this.mainMenu; 203 + return this.parentScreen;
223 } 204 }
224 205
225 /** 206 /**
226 * @return 207 * @return
227 */ 208 */
228 - public boolean isTweeningOrOpen() 209 + public boolean isOpen()
229 { 210 {
230 return this.tweenAmount > 0.0; 211 return this.tweenAmount > 0.0;
231 } 212 }
@@ -237,24 +218,10 @@ public class GuiScreenModInfo extends GuiScreen @@ -237,24 +218,10 @@ public class GuiScreenModInfo extends GuiScreen
237 @Override 218 @Override
238 public void initGui() 219 public void initGui()
239 { 220 {
240 - if (this.currentPanel != null)  
241 - {  
242 - this.currentPanel.setSize(this.width - LEFT_EDGE, this.height);  
243 - }  
244 -  
245 - int rightPanelLeftEdge = LEFT_EDGE + MARGIN + 4 + (this.width - LEFT_EDGE - MARGIN - MARGIN - 4) / 2;  
246 -  
247 - this.buttonList.clear();  
248 - this.buttonList.add(this.btnToggle = new GuiButton(0, rightPanelLeftEdge, this.height - PANEL_BOTTOM - 24, 90, 20, I18n.format("gui.enablemod")));  
249 - this.buttonList.add(this.btnConfig = new GuiButton(1, rightPanelLeftEdge + 92, this.height - PANEL_BOTTOM - 24, 69, 20, I18n.format("gui.modsettings")));  
250 - if (!this.hideTab)  
251 - {  
252 - this.buttonList.add(this.chkEnabled = new GuiCheckbox(2, LEFT_EDGE + MARGIN, this.height - PANEL_BOTTOM + 9, I18n.format("gui.about.showtabmessage")));  
253 - }  
254 -  
255 - this.buttonList.add(new GuiHoverLabel(3, LEFT_EDGE + MARGIN + 38 + this.fontRendererObj.getStringWidth(this.versionText) + 6, 50, this.fontRendererObj, I18n.format("gui.about.checkupdates")));  
256 -  
257 - this.selectMod(this.selectedMod); 221 + this.currentPanel.setSize(this.width - LEFT_EDGE, this.height);
  222 +
  223 + this.buttonList.add(new GuiHoverLabel(2, LEFT_EDGE + MARGIN, this.height - PANEL_BOTTOM + 9, this.fontRendererObj, I18n.format("gui.about.taboptions"), this.brandColour));
  224 + this.buttonList.add(new GuiHoverLabel(3, LEFT_EDGE + MARGIN + 38 + this.fontRendererObj.getStringWidth(this.versionText) + 6, 50, this.fontRendererObj, I18n.format("gui.about.checkupdates"), this.brandColour));
258 225
259 Keyboard.enableRepeatEvents(true); 226 Keyboard.enableRepeatEvents(true);
260 } 227 }
@@ -274,7 +241,7 @@ public class GuiScreenModInfo extends GuiScreen @@ -274,7 +241,7 @@ public class GuiScreenModInfo extends GuiScreen
274 if (this.mc.currentScreen == this) 241 if (this.mc.currentScreen == this)
275 { 242 {
276 // Set res in parent screen if we are the active GUI 243 // Set res in parent screen if we are the active GUI
277 - this.mainMenu.setWorldAndResolution(minecraft, width, height); 244 + this.parentScreen.setWorldAndResolution(minecraft, width, height);
278 } 245 }
279 246
280 super.setWorldAndResolution(minecraft, width, height); 247 super.setWorldAndResolution(minecraft, width, height);
@@ -286,28 +253,21 @@ public class GuiScreenModInfo extends GuiScreen @@ -286,28 +253,21 @@ public class GuiScreenModInfo extends GuiScreen
286 @Override 253 @Override
287 public void updateScreen() 254 public void updateScreen()
288 { 255 {
289 - if (this.currentPanel != null)  
290 - {  
291 - this.currentPanel.onTick();  
292 - } 256 + this.currentPanel.onTick();
293 257
294 this.tickNumber++; 258 this.tickNumber++;
295 259
296 if (this.mc.currentScreen == this) 260 if (this.mc.currentScreen == this)
297 { 261 {
298 - this.mc.currentScreen = this.mainMenu;  
299 - this.mainMenu.updateScreen(); 262 + this.mc.currentScreen = this.parentScreen;
  263 + this.parentScreen.updateScreen();
300 this.mc.currentScreen = this; 264 this.mc.currentScreen = this;
301 - if (this.chkEnabled != null) this.chkEnabled.checked = LiteLoader.getInstance().getDisplayModInfoScreenTab();  
302 } 265 }
303 266
304 if (this.toggled) 267 if (this.toggled)
305 { 268 {
306 this.onToggled(); 269 this.onToggled();
307 } 270 }
308 -  
309 - if (this.doubleClickTime > 0)  
310 - this.doubleClickTime--;  
311 } 271 }
312 272
313 /* (non-Javadoc) 273 /* (non-Javadoc)
@@ -316,20 +276,31 @@ public class GuiScreenModInfo extends GuiScreen @@ -316,20 +276,31 @@ public class GuiScreenModInfo extends GuiScreen
316 @Override 276 @Override
317 public void drawScreen(int mouseX, int mouseY, float partialTicks) 277 public void drawScreen(int mouseX, int mouseY, float partialTicks)
318 { 278 {
  279 + this.drawScreen(mouseX, mouseY, partialTicks, false);
  280 + }
  281 +
  282 + /**
  283 + * @param mouseX
  284 + * @param mouseY
  285 + * @param partialTicks
  286 + * @param alwaysExpandTab
  287 + */
  288 + public void drawScreen(int mouseX, int mouseY, float partialTicks, boolean alwaysExpandTab)
  289 + {
319 boolean active = this.mc.currentScreen == this; 290 boolean active = this.mc.currentScreen == this;
320 291
321 if (active) 292 if (active)
322 { 293 {
323 // Draw the parent screen as our background if we are the active screen 294 // Draw the parent screen as our background if we are the active screen
324 glClear(GL_DEPTH_BUFFER_BIT); 295 glClear(GL_DEPTH_BUFFER_BIT);
325 - this.mainMenu.drawScreen(-10, -10, partialTicks); 296 + this.parentScreen.drawScreen(-10, -10, partialTicks);
326 glClear(GL_DEPTH_BUFFER_BIT); 297 glClear(GL_DEPTH_BUFFER_BIT);
327 } 298 }
328 else 299 else
329 { 300 {
330 // If this is not the active screen, copy the width and height from the parent GUI 301 // If this is not the active screen, copy the width and height from the parent GUI
331 - this.width = this.mainMenu.width;  
332 - this.height = this.mainMenu.height; 302 + this.width = this.parentScreen.width;
  303 + this.height = this.parentScreen.height;
333 } 304 }
334 305
335 // Calculate the current tween position 306 // Calculate the current tween position
@@ -337,19 +308,19 @@ public class GuiScreenModInfo extends GuiScreen @@ -337,19 +308,19 @@ public class GuiScreenModInfo extends GuiScreen
337 int offsetMouseX = mouseX - (int)xOffset; 308 int offsetMouseX = mouseX - (int)xOffset;
338 309
339 // Handle mouse stuff here since we won't get mouse events when not the active GUI 310 // Handle mouse stuff here since we won't get mouse events when not the active GUI
340 - boolean mouseOverTab = !this.hideTab && (offsetMouseX > LEFT_EDGE - TAB_WIDTH && offsetMouseX < LEFT_EDGE && mouseY > TAB_TOP && mouseY < TAB_TOP + TAB_HEIGHT); 311 + boolean mouseOverTab = this.showTab && (offsetMouseX > LEFT_EDGE - TAB_WIDTH && offsetMouseX < LEFT_EDGE && mouseY > TAB_TOP && mouseY < TAB_TOP + TAB_HEIGHT);
341 this.handleMouseClick(offsetMouseX, mouseY, partialTicks, active, mouseOverTab); 312 this.handleMouseClick(offsetMouseX, mouseY, partialTicks, active, mouseOverTab);
342 313
343 // Calculate the tab opacity, not framerate adjusted because we don't really care 314 // Calculate the tab opacity, not framerate adjusted because we don't really care
344 - this.tabOpacity = mouseOverTab || this.isTweeningOrOpen() ? 0.5F : Math.max(0.0F, this.tabOpacity - partialTicks * 0.1F); 315 + this.tabOpacity = mouseOverTab || alwaysExpandTab || this.isOpen() ? 0.5F : Math.max(0.0F, this.tabOpacity - partialTicks * 0.1F);
345 316
346 // Draw the panel contents 317 // Draw the panel contents
347 this.drawPanel(offsetMouseX, mouseY, partialTicks, active, xOffset); 318 this.drawPanel(offsetMouseX, mouseY, partialTicks, active, xOffset);
348 319
349 if (mouseOverTab && this.tweenAmount < 0.01) 320 if (mouseOverTab && this.tweenAmount < 0.01)
350 { 321 {
351 - GuiScreenModInfo.drawTooltip(this.fontRendererObj, LiteLoader.getVersionDisplayString(), mouseX, mouseY, this.width, this.height, 0xFFFFFF, 0xB0000000);  
352 - GuiScreenModInfo.drawTooltip(this.fontRendererObj, this.activeModText, mouseX, mouseY + 13, this.width, this.height, 0xCCCCCC, 0xB0000000); 322 + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, LiteLoader.getVersionDisplayString(), mouseX, mouseY, this.width, this.height, 0xFFFFFF, 0xB0000000);
  323 + GuiLiteLoaderPanel.drawTooltip(this.fontRendererObj, this.activeModText, mouseX, mouseY + 13, this.width, this.height, 0xCCCCCC, 0xB0000000);
353 } 324 }
354 } 325 }
355 326
@@ -362,54 +333,44 @@ public class GuiScreenModInfo extends GuiScreen @@ -362,54 +333,44 @@ public class GuiScreenModInfo extends GuiScreen
362 */ 333 */
363 private void drawPanel(int mouseX, int mouseY, float partialTicks, boolean active, float xOffset) 334 private void drawPanel(int mouseX, int mouseY, float partialTicks, boolean active, float xOffset)
364 { 335 {
  336 + this.mouseOverLogo = false;
  337 +
365 glPushMatrix(); 338 glPushMatrix();
366 glTranslatef(xOffset, 0.0F, 0.0F); 339 glTranslatef(xOffset, 0.0F, 0.0F);
367 340
368 // Draw the background and left edge 341 // Draw the background and left edge
369 drawRect(LEFT_EDGE, 0, this.width, this.height, 0xB0000000); 342 drawRect(LEFT_EDGE, 0, this.width, this.height, 0xB0000000);
370 343
371 - if (!this.hideTab) 344 + if (this.showTab)
372 { 345 {
373 drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, TAB_TOP, 0xFFFFFFFF); 346 drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, TAB_TOP, 0xFFFFFFFF);
374 drawRect(LEFT_EDGE, TAB_TOP + TAB_HEIGHT, LEFT_EDGE + 1, this.height, 0xFFFFFFFF); 347 drawRect(LEFT_EDGE, TAB_TOP + TAB_HEIGHT, LEFT_EDGE + 1, this.height, 0xFFFFFFFF);
375 348
376 - this.mc.getTextureManager().bindTexture(aboutTextureResource); 349 + this.mc.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE);
377 glDrawTexturedRect(LEFT_EDGE - TAB_WIDTH, TAB_TOP, TAB_WIDTH + 1, TAB_HEIGHT, 80, 80, 122, 160, 0.5F + this.tabOpacity); 350 glDrawTexturedRect(LEFT_EDGE - TAB_WIDTH, TAB_TOP, TAB_WIDTH + 1, TAB_HEIGHT, 80, 80, 122, 160, 0.5F + this.tabOpacity);
378 } 351 }
379 else 352 else
380 { 353 {
381 drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, this.height, 0xFFFFFFFF); 354 drawRect(LEFT_EDGE, 0, LEFT_EDGE + 1, this.height, 0xFFFFFFFF);
382 - this.mc.getTextureManager().bindTexture(aboutTextureResource);  
383 } 355 }
384 356
385 // Only draw the panel contents if we are actually open 357 // Only draw the panel contents if we are actually open
386 - if (this.isTweeningOrOpen()) 358 + if (this.isOpen())
387 { 359 {
388 - if (this.currentPanel != null && this.currentPanel.isCloseRequested()) 360 + if (this.currentPanel.isCloseRequested())
389 { 361 {
390 this.closeCurrentPanel(); 362 this.closeCurrentPanel();
391 } 363 }
392 364
393 - if (this.currentPanel != null)  
394 - {  
395 - this.drawCurrentPanel(mouseX, mouseY, partialTicks);  
396 - }  
397 - else 365 + this.drawCurrentPanel(mouseX, mouseY, partialTicks);
  366 +
  367 + if (!this.currentPanel.stealFocus())
398 { 368 {
399 - this.drawInfoPanel(mouseX, mouseY, partialTicks, LEFT_EDGE, PANEL_BOTTOM);  
400 -  
401 - int innerWidth = this.width - LEFT_EDGE - MARGIN - MARGIN - 4;  
402 - int panelWidth = innerWidth / 2;  
403 - int panelHeight = this.height - PANEL_BOTTOM - PANEL_TOP;  
404 -  
405 - this.drawModsList(mouseX, mouseY, partialTicks, panelWidth, panelHeight);  
406 - this.drawSelectedMod(mouseX, mouseY, partialTicks, panelWidth, panelHeight);  
407 -  
408 // Draw other controls inside the transform so that they slide properly 369 // Draw other controls inside the transform so that they slide properly
409 super.drawScreen(mouseX, mouseY, partialTicks); 370 super.drawScreen(mouseX, mouseY, partialTicks);
410 } 371 }
411 } 372 }
412 - else if (this.currentPanel != null) 373 + else
413 { 374 {
414 this.closeCurrentPanel(); 375 this.closeCurrentPanel();
415 } 376 }
@@ -437,118 +398,27 @@ public class GuiScreenModInfo extends GuiScreen @@ -437,118 +398,27 @@ public class GuiScreenModInfo extends GuiScreen
437 * @param mouseY 398 * @param mouseY
438 * @param partialTicks 399 * @param partialTicks
439 */ 400 */
440 - protected void drawInfoPanel(int mouseX, int mouseY, float partialTicks, int left, int bottom) 401 + protected boolean drawInfoPanel(int mouseX, int mouseY, float partialTicks, int left, int bottom)
441 { 402 {
442 int right = this.width - MARGIN - LEFT_EDGE + left; 403 int right = this.width - MARGIN - LEFT_EDGE + left;
  404 + left += MARGIN;
443 405
444 // Draw the header pieces 406 // Draw the header pieces
445 - glDrawTexturedRect(left + MARGIN, 12, 128, 40, 0, 0, 256, 80, 1.0F); // liteloader logo  
446 - glDrawTexturedRect(right - 32, 12, 32, 45, 0, 80, 64, 170, 1.0F); // chicken 407 + this.mc.getTextureManager().bindTexture(this.logoResource);
  408 + glDrawTexturedRect(left, MARGIN, this.logoCoords, 1.0F);
  409 + this.mc.getTextureManager().bindTexture(this.iconResource);
  410 + glDrawTexturedRect(right - this.iconCoords.getIconWidth(), MARGIN, this.iconCoords, 1.0F);
447 411
448 // Draw header text 412 // Draw header text
449 - this.fontRendererObj.drawString(this.versionText, left + MARGIN + 38, 50, 0xFFFFFFFF);  
450 - this.fontRendererObj.drawString(this.activeModText, left + MARGIN + 38, 60, 0xFFAAAAAA); 413 + this.fontRendererObj.drawString(this.versionText, left + 38, 50, 0xFFFFFFFF);
  414 + this.fontRendererObj.drawString(this.activeModText, left + 38, 60, 0xFFAAAAAA);
451 415
452 // Draw top and bottom horizontal rules 416 // Draw top and bottom horizontal rules
453 - drawRect(left + MARGIN, 80, right, 81, 0xFF999999);  
454 - drawRect(left + MARGIN, this.height - bottom + 2, right, this.height - bottom + 3, 0xFF999999);  
455 - }  
456 -  
457 - /**  
458 - * @param mouseX  
459 - * @param mouseY  
460 - * @param partialTicks  
461 - * @param width  
462 - * @param height  
463 - */  
464 - private void drawModsList(int mouseX, int mouseY, float partialTicks, int width, int height)  
465 - {  
466 - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, LEFT_EDGE + MARGIN + width - SCROLLBAR_WIDTH, PANEL_TOP, SCROLLBAR_WIDTH, height, this.listHeight);  
467 -  
468 - // clip outside of scroll area  
469 - glEnableClipping(LEFT_EDGE + MARGIN, LEFT_EDGE + MARGIN + width - SCROLLBAR_WIDTH - 1, PANEL_TOP, this.height - PANEL_BOTTOM);  
470 -  
471 - // handle scrolling  
472 - glPushMatrix();  
473 - glTranslatef(0.0F, PANEL_TOP - this.scrollBar.getValue(), 0.0F);  
474 -  
475 - mouseY -= (PANEL_TOP - this.scrollBar.getValue());  
476 -  
477 - int yPos = 0;  
478 - for (GuiModListEntry mod : this.mods)  
479 - {  
480 - // drawListEntry returns a value indicating the height of the item drawn  
481 - yPos += mod.drawListEntry(mouseX, mouseY, partialTicks, LEFT_EDGE + MARGIN, yPos, width - 6, mod == this.selectedMod);  
482 - }  
483 -  
484 - yPos = 0;  
485 - for (GuiModListEntry mod : this.mods)  
486 - {  
487 - yPos += mod.postRenderListEntry(mouseX, mouseY, partialTicks, LEFT_EDGE + MARGIN, yPos, width - 6, mod == this.selectedMod);  
488 - }  
489 -  
490 - glPopMatrix();  
491 - glDisableClipping();  
492 -  
493 - this.listHeight = yPos;  
494 - this.scrollBar.setMaxValue(this.listHeight - height);  
495 - }  
496 -  
497 - /**  
498 - * @param mouseX  
499 - * @param mouseY  
500 - * @param partialTicks  
501 - * @param width  
502 - * @param height  
503 - */  
504 - private void drawSelectedMod(int mouseX, int mouseY, float partialTicks, int width, int height)  
505 - {  
506 - if (this.selectedMod != null)  
507 - {  
508 - int left = LEFT_EDGE + MARGIN + width;  
509 - int right = this.width - MARGIN;  
510 -  
511 - int spaceForButtons = this.btnConfig.field_146125_m || this.btnToggle.field_146125_m ? 28 : 0;  
512 - glEnableClipping(left, right, PANEL_TOP, this.height - PANEL_BOTTOM - spaceForButtons);  
513 - this.selectedMod.drawInfo(mouseX, mouseY, partialTicks, left, PANEL_TOP, right - left, height - spaceForButtons);  
514 - glDisableClipping();  
515 - }  
516 - }  
517 -  
518 - /**  
519 - * @param mod  
520 - * @return  
521 - */  
522 - private void selectMod(GuiModListEntry mod)  
523 - {  
524 - if (this.selectedMod != null)  
525 - {  
526 - this.selectedMod.mouseReleased();  
527 - } 417 + drawRect(left, 80, right, 81, 0xFF999999);
  418 + drawRect(left, this.height - bottom + 2, right, this.height - bottom + 3, 0xFF999999);
528 419
529 - this.selectedMod = mod;  
530 - this.btnToggle.field_146125_m = false;  
531 - this.btnConfig.field_146125_m = false;  
532 -  
533 - if (this.selectedMod != null && this.selectedMod.canBeToggled())  
534 - {  
535 - this.btnToggle.field_146125_m = true;  
536 - this.btnToggle.displayString = this.selectedMod.willBeEnabled() ? I18n.format("gui.disablemod") : I18n.format("gui.enablemod");  
537 -  
538 - this.btnConfig.field_146125_m = this.configManager.hasPanel(this.selectedMod.getModClass());  
539 - }  
540 - }  
541 -  
542 - /**  
543 - * Toggle the selected mod's enabled status  
544 - */  
545 - private void toggleSelectedMod()  
546 - {  
547 - if (this.selectedMod != null)  
548 - {  
549 - this.selectedMod.toggleEnabled();  
550 - this.selectMod(this.selectedMod);  
551 - } 420 + this.mouseOverLogo = (mouseY > MARGIN && mouseY < MARGIN + this.logoCoords.getIconHeight() && mouseX > left && mouseX < left + this.logoCoords.getIconWidth());
  421 + return this.mouseOverLogo;
552 } 422 }
553 423
554 /* (non-Javadoc) 424 /* (non-Javadoc)
@@ -557,30 +427,14 @@ public class GuiScreenModInfo extends GuiScreen @@ -557,30 +427,14 @@ public class GuiScreenModInfo extends GuiScreen
557 @Override 427 @Override
558 protected void actionPerformed(GuiButton button) 428 protected void actionPerformed(GuiButton button)
559 { 429 {
560 - if (button.id == 0) 430 + if (button.id == 2)
561 { 431 {
562 - this.toggleSelectedMod();  
563 - }  
564 -  
565 - if (button.id == 1)  
566 - {  
567 - this.openConfigPanel();  
568 - }  
569 -  
570 - if (button.id == 2 && this.chkEnabled != null)  
571 - {  
572 - this.chkEnabled.checked = !this.chkEnabled.checked;  
573 - LiteLoader.getInstance().setDisplayModInfoScreenTab(this.chkEnabled.checked);  
574 -  
575 - if (!this.chkEnabled.checked)  
576 - {  
577 - this.chkEnabled.displayString = I18n.format("gui.about.showtabmessage") + I18n.format("gui.about.keystrokehint");  
578 - } 432 + this.setCurrentPanel(this.settingsPanel);
579 } 433 }
580 434
581 if (button.id == 3) 435 if (button.id == 3)
582 { 436 {
583 - this.setCurrentPanel(new GuiCheckUpdatePanel(this.mc, LiteLoaderVersion.getUpdateSite(), "LiteLoader")); 437 + this.setCurrentPanel(new GuiPanelUpdateCheck(this.mc, LiteLoaderVersion.getUpdateSite(), "LiteLoader"));
584 } 438 }
585 } 439 }
586 440
@@ -590,69 +444,23 @@ public class GuiScreenModInfo extends GuiScreen @@ -590,69 +444,23 @@ public class GuiScreenModInfo extends GuiScreen
590 @Override 444 @Override
591 protected void keyTyped(char keyChar, int keyCode) 445 protected void keyTyped(char keyChar, int keyCode)
592 { 446 {
593 - if (this.currentPanel != null)  
594 - {  
595 - this.currentPanel.keyPressed(keyChar, keyCode);  
596 - return;  
597 - }  
598 -  
599 - if (keyCode == Keyboard.KEY_ESCAPE)  
600 - {  
601 - this.onToggled();  
602 - return;  
603 - }  
604 - else if (keyCode == Keyboard.KEY_UP)  
605 - {  
606 - int selectedIndex = this.mods.indexOf(this.selectedMod) - 1;  
607 - if (selectedIndex > -1) this.selectMod(this.mods.get(selectedIndex));  
608 - this.scrollSelectedModIntoView();  
609 - }  
610 - else if (keyCode == Keyboard.KEY_DOWN)  
611 - {  
612 - int selectedIndex = this.mods.indexOf(this.selectedMod);  
613 - if (selectedIndex > -1 && selectedIndex < this.mods.size() - 1) this.selectMod(this.mods.get(selectedIndex + 1));  
614 - this.scrollSelectedModIntoView();  
615 - }  
616 - else if (keyCode == Keyboard.KEY_SPACE || keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER || keyCode == Keyboard.KEY_RIGHT)  
617 - {  
618 - this.toggleSelectedMod();  
619 - }  
620 - else if (keyCode == Keyboard.KEY_F3)  
621 - {  
622 - this.setCurrentPanel(new GuiLiteLoaderLog(this.mc));  
623 - }  
624 - else if (keyCode == Keyboard.KEY_F1)  
625 - {  
626 - this.setCurrentPanel(new GuiAboutPanel(this.mc, this));  
627 - } 447 + this.currentPanel.keyPressed(keyChar, keyCode);
628 } 448 }
629 -  
630 - private void scrollSelectedModIntoView() 449 +
  450 + /**
  451 + *
  452 + */
  453 + void showLogPanel()
631 { 454 {
632 - if (this.selectedMod == null) return;  
633 -  
634 - int yPos = 0;  
635 - for (GuiModListEntry mod : this.mods)  
636 - {  
637 - if (mod == this.selectedMod) break;  
638 - yPos += mod.getHeight();  
639 - }  
640 -  
641 - // Mod is above the top of the visible window  
642 - if (yPos < this.scrollBar.getValue())  
643 - {  
644 - this.scrollBar.setValue(yPos);  
645 - return;  
646 - }  
647 -  
648 - int panelHeight = this.height - PANEL_BOTTOM - PANEL_TOP;  
649 - int modHeight = this.selectedMod.getHeight();  
650 -  
651 - // Mod is below the bottom of the visible window  
652 - if (yPos - this.scrollBar.getValue() + modHeight > panelHeight)  
653 - {  
654 - this.scrollBar.setValue(yPos - panelHeight + modHeight);  
655 - } 455 + this.setCurrentPanel(new GuiPanelLiteLoaderLog(this.mc, this));
  456 + }
  457 +
  458 + /**
  459 + *
  460 + */
  461 + void showAboutPanel()
  462 + {
  463 + this.setCurrentPanel(new GuiPanelAbout(this.mc, this));
656 } 464 }
657 465
658 /* (non-Javadoc) 466 /* (non-Javadoc)
@@ -661,76 +469,34 @@ public class GuiScreenModInfo extends GuiScreen @@ -661,76 +469,34 @@ public class GuiScreenModInfo extends GuiScreen
661 @Override 469 @Override
662 protected void mouseClicked(int mouseX, int mouseY, int button) 470 protected void mouseClicked(int mouseX, int mouseY, int button)
663 { 471 {
664 - if (this.currentPanel != null) 472 + this.currentPanel.mousePressed(mouseX - LEFT_EDGE, mouseY, button);
  473 +
  474 + if (button == 0 && this.mouseOverLogo && !this.currentPanel.stealFocus())
665 { 475 {
666 - this.currentPanel.mousePressed(mouseX - LEFT_EDGE, mouseY, button);  
667 - return; 476 + this.showAboutPanel();
668 } 477 }
669 478
670 - if (button == 0) 479 + if (!this.currentPanel.stealFocus())
671 { 480 {
672 - if (this.scrollBar.wasMouseOver())  
673 - {  
674 - this.scrollBar.setDragging(true);  
675 - }  
676 -  
677 - if (mouseY > PANEL_TOP && mouseY < this.height - PANEL_BOTTOM)  
678 - {  
679 - GuiModListEntry lastSelectedMod = this.selectedMod;  
680 -  
681 - for (GuiModListEntry mod : this.mods)  
682 - {  
683 - if (mod.mouseWasOverListEntry())  
684 - {  
685 - this.selectMod(mod);  
686 -  
687 - // handle double-click  
688 - if (mod == lastSelectedMod && this.doubleClickTime > 0 && this.btnConfig.field_146125_m)  
689 - {  
690 - this.actionPerformed(this.btnConfig);  
691 - }  
692 -  
693 - this.doubleClickTime = 5;  
694 - }  
695 - }  
696 -  
697 - if (this.selectedMod != null && this.selectedMod == lastSelectedMod)  
698 - {  
699 - this.selectedMod.mousePressed();  
700 - }  
701 - } 481 + super.mouseClicked(mouseX, mouseY, button);
702 } 482 }
703 -  
704 - super.mouseClicked(mouseX, mouseY, button);  
705 } 483 }
706 484
707 /* (non-Javadoc) 485 /* (non-Javadoc)
708 - * @see net.minecraft.client.gui.GuiScreen#mouseMovedOrUp(int, int, int) 486 + * @see net.minecraft.client.gui.GuiScreen#mouseReleased(int, int, int)
709 */ 487 */
710 @Override 488 @Override
711 - protected void mouseMovedOrUp(int mouseX, int mouseY, int button) 489 + protected void mouseReleased(int mouseX, int mouseY, int button)
712 { 490 {
713 - if (this.currentPanel != null) 491 + if (button == -1)
  492 + this.currentPanel.mouseMoved(mouseX - LEFT_EDGE, mouseY);
  493 + else
  494 + this.currentPanel.mouseReleased(mouseX - LEFT_EDGE, mouseY, button);
  495 +
  496 + if (!this.currentPanel.stealFocus())
714 { 497 {
715 - if (button == -1)  
716 - this.currentPanel.mouseMoved(mouseX - LEFT_EDGE, mouseY);  
717 - else  
718 - this.currentPanel.mouseReleased(mouseX - LEFT_EDGE, mouseY, button);  
719 -  
720 - return; 498 + super.mouseReleased(mouseX, mouseY, button);
721 } 499 }
722 -  
723 - if (button == 0)  
724 - {  
725 - this.scrollBar.setDragging(false);  
726 -  
727 - if (this.selectedMod != null)  
728 - {  
729 - this.selectedMod.mouseReleased();  
730 - }  
731 - }  
732 -  
733 - super.mouseMovedOrUp(mouseX, mouseY, button);  
734 } 500 }
735 501
736 /* (non-Javadoc) 502 /* (non-Javadoc)
@@ -742,27 +508,13 @@ public class GuiScreenModInfo extends GuiScreen @@ -742,27 +508,13 @@ public class GuiScreenModInfo extends GuiScreen
742 int mouseWheelDelta = Mouse.getEventDWheel(); 508 int mouseWheelDelta = Mouse.getEventDWheel();
743 if (mouseWheelDelta != 0) 509 if (mouseWheelDelta != 0)
744 { 510 {
745 - if (this.currentPanel != null)  
746 - this.currentPanel.mouseWheelScrolled(mouseWheelDelta);  
747 - else  
748 - mouseWheelScrolled(mouseWheelDelta / 8); 511 + this.currentPanel.mouseWheelScrolled(mouseWheelDelta);
749 } 512 }
750 513
751 super.handleMouseInput(); 514 super.handleMouseInput();
752 } 515 }
753 516
754 /** 517 /**
755 - * @param mouseWheelDelta  
756 - */  
757 - private void mouseWheelScrolled(int mouseWheelDelta)  
758 - {  
759 - if (this.selectedMod == null || !this.selectedMod.mouseWheelScrolled(mouseWheelDelta))  
760 - {  
761 - this.scrollBar.offsetValue(-mouseWheelDelta);  
762 - }  
763 - }  
764 -  
765 - /**  
766 * @param mouseX 518 * @param mouseX
767 * @param active 519 * @param active
768 * @param mouseOverTab 520 * @param mouseOverTab
@@ -794,7 +546,7 @@ public class GuiScreenModInfo extends GuiScreen @@ -794,7 +546,7 @@ public class GuiScreenModInfo extends GuiScreen
794 { 546 {
795 this.tweenAmount = Math.min(1.0, this.tweenAmount + ((tickValue - this.lastTick) * TWEEN_RATE)); 547 this.tweenAmount = Math.min(1.0, this.tweenAmount + ((tickValue - this.lastTick) * TWEEN_RATE));
796 } 548 }
797 - else if (!active && this.isTweeningOrOpen()) 549 + else if (!active && this.isOpen())
798 { 550 {
799 this.tweenAmount = Math.max(0.0, this.tweenAmount - ((tickValue - this.lastTick) * TWEEN_RATE)); 551 this.tweenAmount = Math.max(0.0, this.tweenAmount - ((tickValue - this.lastTick) * TWEEN_RATE));
800 } 552 }
@@ -806,31 +558,27 @@ public class GuiScreenModInfo extends GuiScreen @@ -806,31 +558,27 @@ public class GuiScreenModInfo extends GuiScreen
806 /** 558 /**
807 * Called when the tab is clicked 559 * Called when the tab is clicked
808 */ 560 */
809 - private void onToggled() 561 + void onToggled()
810 { 562 {
811 this.toggled = false; 563 this.toggled = false;
812 - this.mc.displayGuiScreen(this.mc.currentScreen == this ? this.mainMenu : this); 564 + this.mc.displayGuiScreen(this.mc.currentScreen == this ? this.parentScreen : this);
813 } 565 }
814 566
815 /** 567 /**
816 * Callback for the "config" button, display the config panel for the currently selected mod 568 * Callback for the "config" button, display the config panel for the currently selected mod
817 */ 569 */
818 - private void openConfigPanel() 570 + void openConfigPanel(ConfigPanel panel, LiteMod mod)
819 { 571 {
820 - if (this.selectedMod != null && this.selectedMod.getModClass() != null) 572 + if (panel != null)
821 { 573 {
822 - ConfigPanel panel = this.configManager.getPanel(this.selectedMod.getModClass());  
823 - if (panel != null)  
824 - {  
825 - this.setCurrentPanel(new GuiConfigPanelContainer(this.mc, panel, this.selectedMod.getModInstance()));  
826 - } 574 + this.setCurrentPanel(new GuiPanelConfigContainer(this.mc, panel, mod));
827 } 575 }
828 } 576 }
829 577
830 /** 578 /**
831 * @param newPanel 579 * @param newPanel
832 */ 580 */
833 - private void setCurrentPanel(ModInfoScreenPanel newPanel) 581 + private void setCurrentPanel(GuiPanel newPanel)
834 { 582 {
835 this.closeCurrentPanel(); 583 this.closeCurrentPanel();
836 584
@@ -844,20 +592,9 @@ public class GuiScreenModInfo extends GuiScreen @@ -844,20 +592,9 @@ public class GuiScreenModInfo extends GuiScreen
844 */ 592 */
845 private void closeCurrentPanel() 593 private void closeCurrentPanel()
846 { 594 {
847 - if (this.currentPanel != null)  
848 - {  
849 - this.currentPanel.onHidden();  
850 - this.currentPanel = null;  
851 - }  
852 - }  
853 -  
854 - public final static boolean isSupportedOnScreen(GuiScreen guiScreen)  
855 - {  
856 - return (  
857 - guiScreen instanceof GuiMainMenu ||  
858 - guiScreen instanceof GuiIngameMenu ||  
859 - guiScreen instanceof GuiOptions  
860 - ); 595 + this.currentPanel.onHidden();
  596 + this.currentPanel = this.modsPanel;
  597 + this.modsPanel.setSize(this.width - LEFT_EDGE, this.height);
861 } 598 }
862 599
863 /** 600 /**
@@ -895,25 +632,51 @@ public class GuiScreenModInfo extends GuiScreen @@ -895,25 +632,51 @@ public class GuiScreenModInfo extends GuiScreen
895 */ 632 */
896 static void glDrawTexturedRect(int x, int y, int width, int height, int u, int v, int u2, int v2, float alpha) 633 static void glDrawTexturedRect(int x, int y, int width, int height, int u, int v, int u2, int v2, float alpha)
897 { 634 {
  635 + float texMapScale = 0.00390625F; // 256px
  636 + glDrawTexturedRect(x, y, width, height, u * texMapScale, v * texMapScale, u2 * texMapScale, v2 * texMapScale, alpha);
  637 + }
  638 +
  639 + /**
  640 + * @param x
  641 + * @param y
  642 + * @param width
  643 + * @param height
  644 + * @param u
  645 + * @param v
  646 + * @param u2
  647 + * @param v2
  648 + * @param alpha
  649 + */
  650 + static void glDrawTexturedRect(int x, int y, int width, int height, float u, float v, float u2, float v2, float alpha)
  651 + {
898 glDisable(GL_LIGHTING); 652 glDisable(GL_LIGHTING);
899 glEnable(GL_BLEND); 653 glEnable(GL_BLEND);
900 glAlphaFunc(GL_GREATER, 0.0F); 654 glAlphaFunc(GL_GREATER, 0.0F);
901 glEnable(GL_TEXTURE_2D); 655 glEnable(GL_TEXTURE_2D);
902 glColor4f(1.0F, 1.0F, 1.0F, alpha); 656 glColor4f(1.0F, 1.0F, 1.0F, alpha);
903 657
904 - float texMapScale = 0.00390625F; // 256px  
905 -  
906 Tessellator tessellator = Tessellator.instance; 658 Tessellator tessellator = Tessellator.instance;
907 tessellator.startDrawingQuads(); 659 tessellator.startDrawingQuads();
908 - tessellator.addVertexWithUV(x + 0, y + height, 0, u * texMapScale, v2 * texMapScale);  
909 - tessellator.addVertexWithUV(x + width, y + height, 0, u2 * texMapScale, v2 * texMapScale);  
910 - tessellator.addVertexWithUV(x + width, y + 0, 0, u2 * texMapScale, v * texMapScale);  
911 - tessellator.addVertexWithUV(x + 0, y + 0, 0, u * texMapScale, v * texMapScale); 660 + tessellator.addVertexWithUV(x + 0, y + height, 0, u , v2);
  661 + tessellator.addVertexWithUV(x + width, y + height, 0, u2, v2);
  662 + tessellator.addVertexWithUV(x + width, y + 0, 0, u2, v );
  663 + tessellator.addVertexWithUV(x + 0, y + 0, 0, u , v );
912 tessellator.draw(); 664 tessellator.draw();
913 665
914 glDisable(GL_BLEND); 666 glDisable(GL_BLEND);
915 glAlphaFunc(GL_GREATER, 0.01F); 667 glAlphaFunc(GL_GREATER, 0.01F);
916 } 668 }
  669 +
  670 + /**
  671 + * @param resource
  672 + * @param x
  673 + * @param y
  674 + * @param icon
  675 + */
  676 + static void glDrawTexturedRect(int x, int y, IIcon icon, float alpha)
  677 + {
  678 + glDrawTexturedRect(x, y, icon.getIconWidth(), icon.getIconHeight(), icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), alpha);
  679 + }
917 680
918 /** 681 /**
919 * Enable OpenGL clipping planes (uses planes 2, 3, 4 and 5) 682 * Enable OpenGL clipping planes (uses planes 2, 3, 4 and 5)
java/com/mumfrey/liteloader/gui/GuiModListEntry.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiModListEntry.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
2 2
3 import static org.lwjgl.opengl.GL11.*; 3 import static org.lwjgl.opengl.GL11.*;
4 4
  5 +import java.util.ArrayList;
  6 +import java.util.List;
5 import java.util.Set; 7 import java.util.Set;
6 8
7 import net.minecraft.client.Minecraft; 9 import net.minecraft.client.Minecraft;
@@ -9,13 +11,16 @@ import net.minecraft.client.gui.FontRenderer; @@ -9,13 +11,16 @@ import net.minecraft.client.gui.FontRenderer;
9 import net.minecraft.client.gui.Gui; 11 import net.minecraft.client.gui.Gui;
10 import net.minecraft.client.resources.I18n; 12 import net.minecraft.client.resources.I18n;
11 13
  14 +import com.google.common.collect.ImmutableSet;
12 import com.mumfrey.liteloader.LiteMod; 15 import com.mumfrey.liteloader.LiteMod;
13 -import com.mumfrey.liteloader.core.EnabledModsList;  
14 -import com.mumfrey.liteloader.core.LiteLoader; 16 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  17 +import com.mumfrey.liteloader.client.util.render.IconAbsolute;
15 import com.mumfrey.liteloader.core.LiteLoaderEnumerator; 18 import com.mumfrey.liteloader.core.LiteLoaderEnumerator;
16 -import com.mumfrey.liteloader.core.Loadable;  
17 -import com.mumfrey.liteloader.core.LoadableMod;  
18 -import com.mumfrey.liteloader.core.TweakContainer; 19 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  20 +import com.mumfrey.liteloader.interfaces.Loadable;
  21 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  22 +import com.mumfrey.liteloader.interfaces.TweakContainer;
  23 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
19 24
20 /** 25 /**
21 * Represents a mod in the mod info screen, keeps track of mod information and provides methods 26 * Represents a mod in the mod info screen, keeps track of mod information and provides methods
@@ -25,14 +30,41 @@ import com.mumfrey.liteloader.core.TweakContainer; @@ -25,14 +30,41 @@ import com.mumfrey.liteloader.core.TweakContainer;
25 */ 30 */
26 public class GuiModListEntry extends Gui 31 public class GuiModListEntry extends Gui
27 { 32 {
28 - private static final int PANEL_HEIGHT = 32;  
29 - private static final int PANEL_SPACING = 4; 33 + private static final int BLACK = 0xFF000000;
  34 + private static final int DARK_GREY = 0xB0333333;
  35 + private static final int GREY = 0xFF999999;
  36 + private static final int WHITE = 0xFFFFFFFF;
  37 +
  38 + private static final int BLEND_2THRDS = 0xB0FFFFFF;
  39 + private static final int BLEND_HALF = 0x80FFFFFF;
  40 +
  41 + private static final int API_COLOUR = 0xFFAA00AA;
  42 + private static final int EXTERNAL_ENTRY_COLOUR = 0xFF47D1AA;
  43 + private static final int MISSING_DEPENDENCY_COLOUR = 0xFFFFAA00;
  44 +
  45 + private static final int TITLE_COLOUR = GuiModListEntry.WHITE;
  46 + private static final int VERSION_TEXT_COLOUR = GuiModListEntry.GREY;
  47 + private static final int GRADIENT_COLOUR2 = GuiModListEntry.BLEND_2THRDS & GuiModListEntry.DARK_GREY;
  48 + private static final int HANGER_COLOUR = GuiModListEntry.GREY;
  49 + private static final int HANGER_COLOUR_MOUSEOVER = GuiModListEntry.WHITE;
  50 + private static final int AUTHORS_COLOUR = GuiModListEntry.WHITE;
  51 + private static final int DIVIDER_COLOUR = GuiModListEntry.GREY;
  52 + private static final int DESCRIPTION_COLOUR = GuiModListEntry.WHITE;
  53 +
  54 + private static final int PANEL_HEIGHT = 32;
  55 + private static final int PANEL_SPACING = 4;
  56 +
  57 + private static final Set<String> BUILT_IN_APIS = ImmutableSet.of("liteloader");
30 58
31 /** 59 /**
32 * For text display 60 * For text display
33 */ 61 */
34 private FontRenderer fontRenderer; 62 private FontRenderer fontRenderer;
35 63
  64 + private final int brandColour;
  65 +
  66 + private final LiteLoaderMods mods;
  67 +
36 private LiteMod modInstance; 68 private LiteMod modInstance;
37 69
38 private Class<? extends LiteMod> modClass; 70 private Class<? extends LiteMod> modClass;
@@ -74,12 +106,19 @@ public class GuiModListEntry extends Gui @@ -74,12 +106,19 @@ public class GuiModListEntry extends Gui
74 106
75 private boolean isMissingDependencies; 107 private boolean isMissingDependencies;
76 108
  109 + private boolean isMissingAPIs;
  110 +
77 /** 111 /**
78 * True if the mod is missing a dependency which has caused it not to load 112 * True if the mod is missing a dependency which has caused it not to load
79 */ 113 */
80 private Set<String> missingDependencies; 114 private Set<String> missingDependencies;
81 115
82 /** 116 /**
  117 + * True if the mod is missing an API which has caused it not to load
  118 + */
  119 + private Set<String> missingAPIs;
  120 +
  121 + /**
83 * Whether the mod can be toggled, not all mods support this, eg. internal mods 122 * Whether the mod can be toggled, not all mods support this, eg. internal mods
84 */ 123 */
85 private boolean canBeToggled; 124 private boolean canBeToggled;
@@ -100,66 +139,78 @@ public class GuiModListEntry extends Gui @@ -100,66 +139,78 @@ public class GuiModListEntry extends Gui
100 */ 139 */
101 private boolean external; 140 private boolean external;
102 141
103 - private boolean providesTweak, providesTransformer; 142 + private List<IconAbsolute> modIcons = new ArrayList<IconAbsolute>();
104 143
105 /** 144 /**
106 * Scroll bar control for the mod info 145 * Scroll bar control for the mod info
107 */ 146 */
108 private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar(); 147 private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar();
109 - 148 +
110 /** 149 /**
111 * Mod list entry for an ACTIVE mod 150 * Mod list entry for an ACTIVE mod
112 - *  
113 - * @param loader  
114 - * @param enabledMods  
115 * @param fontRenderer 151 * @param fontRenderer
116 * @param modInstance 152 * @param modInstance
  153 + * @param enabledMods
117 */ 154 */
118 - GuiModListEntry(LiteLoader loader, EnabledModsList enabledMods, FontRenderer fontRenderer, LiteMod modInstance) 155 + GuiModListEntry(LiteLoaderMods mods, LoaderEnvironment environment, FontRenderer fontRenderer, int brandColour, LiteMod modInstance)
119 { 156 {
  157 + this.mods = mods;
120 this.fontRenderer = fontRenderer; 158 this.fontRenderer = fontRenderer;
  159 + this.brandColour = brandColour;
  160 +
121 this.modInstance = modInstance; 161 this.modInstance = modInstance;
122 this.modClass = modInstance.getClass(); 162 this.modClass = modInstance.getClass();
123 - this.identifier = loader.getModIdentifier(this.modClass); 163 + this.identifier = mods.getModIdentifier(this.modClass);
124 this.name = modInstance.getName(); 164 this.name = modInstance.getName();
125 this.version = modInstance.getVersion(); 165 this.version = modInstance.getVersion();
126 this.enabled = true; 166 this.enabled = true;
127 - this.canBeToggled = this.identifier != null && enabledMods.saveAllowed();  
128 - this.willBeEnabled = true; 167 + this.canBeToggled = this.identifier != null && mods.getEnabledModsList().saveAllowed();
  168 + this.willBeEnabled = this.identifier == null || mods.isModEnabled(this.identifier);;
129 169
130 - LoadableMod<?> modContainer = loader.getModContainer(this.modClass); 170 + LoadableMod<?> modContainer = mods.getModContainer(this.modClass);
131 171
132 this.author = modContainer.getAuthor(); 172 this.author = modContainer.getAuthor();
133 this.url = modContainer.getMetaValue("url", null); 173 this.url = modContainer.getMetaValue("url", null);
134 this.description = modContainer.getDescription(LiteLoaderEnumerator.getModClassName(modInstance)); 174 this.description = modContainer.getDescription(LiteLoaderEnumerator.getModClassName(modInstance));
135 175
  176 + boolean providesTweak = false;
  177 + boolean providesTransformer = false;
  178 + boolean usingAPI = this.checkUsingAPI(modContainer);
  179 +
136 if (modContainer instanceof TweakContainer) 180 if (modContainer instanceof TweakContainer)
137 { 181 {
138 - this.providesTweak = ((TweakContainer<?>)modContainer).hasTweakClass();  
139 - this.providesTransformer = ((TweakContainer<?>)modContainer).hasClassTransformers(); 182 + providesTweak = ((TweakContainer<?>)modContainer).hasTweakClass();
  183 + providesTransformer = ((TweakContainer<?>)modContainer).hasClassTransformers();
140 } 184 }
  185 +
  186 + this.initIcons(providesTweak, providesTransformer, usingAPI);
141 } 187 }
142 188
143 /** 189 /**
144 * Mod list entry for a currently disabled mod 190 * Mod list entry for a currently disabled mod
145 - *  
146 - * @param loader  
147 - * @param enabledMods 191 + * @param mods
148 * @param fontRenderer 192 * @param fontRenderer
149 * @param modContainer 193 * @param modContainer
150 */ 194 */
151 - GuiModListEntry(LiteLoader loader, EnabledModsList enabledMods, FontRenderer fontRenderer, Loadable<?> modContainer) 195 + GuiModListEntry(LiteLoaderMods mods, LoaderEnvironment environment, FontRenderer fontRenderer, int brandColour, Loadable<?> modContainer)
152 { 196 {
  197 + this.mods = mods;
153 this.fontRenderer = fontRenderer; 198 this.fontRenderer = fontRenderer;
  199 + this.brandColour = brandColour;
  200 +
154 this.identifier = modContainer.getIdentifier().toLowerCase(); 201 this.identifier = modContainer.getIdentifier().toLowerCase();
155 this.name = modContainer.getDisplayName(); 202 this.name = modContainer.getDisplayName();
156 this.version = modContainer.getVersion(); 203 this.version = modContainer.getVersion();
157 this.author = modContainer.getAuthor(); 204 this.author = modContainer.getAuthor();
158 - this.enabled = modContainer.isEnabled(enabledMods, LiteLoader.getProfile());  
159 - this.canBeToggled = modContainer.isToggleable() && enabledMods.saveAllowed();  
160 - this.willBeEnabled = enabledMods.isEnabled(LiteLoader.getProfile(), this.identifier); 205 + this.enabled = modContainer.isEnabled(environment);
  206 + this.canBeToggled = modContainer.isToggleable() && mods.getEnabledModsList().saveAllowed();
  207 + this.willBeEnabled = mods.isModEnabled(this.identifier);
161 this.external = modContainer.isExternalJar(); 208 this.external = modContainer.isExternalJar();
162 this.description = modContainer.getDescription(null); 209 this.description = modContainer.getDescription(null);
  210 +
  211 + boolean providesTweak = false;
  212 + boolean providesTransformer = false;
  213 + boolean usingAPI = false;
163 214
164 if (modContainer instanceof LoadableMod<?>) 215 if (modContainer instanceof LoadableMod<?>)
165 { 216 {
@@ -167,24 +218,58 @@ public class GuiModListEntry extends Gui @@ -167,24 +218,58 @@ public class GuiModListEntry extends Gui
167 218
168 this.url = loadableMod.getMetaValue("url", null); 219 this.url = loadableMod.getMetaValue("url", null);
169 this.missingDependencies = loadableMod.getMissingDependencies(); 220 this.missingDependencies = loadableMod.getMissingDependencies();
  221 + this.missingAPIs = loadableMod.getMissingAPIs();
170 this.isMissingDependencies = this.missingDependencies.size() > 0; 222 this.isMissingDependencies = this.missingDependencies.size() > 0;
  223 + this.isMissingAPIs = this.missingAPIs.size() > 0;
171 224
172 - if (this.isMissingDependencies)  
173 - {  
174 - this.enabled = false;  
175 - this.description = I18n.format("gui.description.missingdeps") + "\n" + this.missingDependencies.toString();  
176 - } 225 + usingAPI = this.checkUsingAPI(loadableMod);
177 } 226 }
178 227
179 if (modContainer instanceof TweakContainer) 228 if (modContainer instanceof TweakContainer)
180 { 229 {
181 TweakContainer<?> tweakContainer = (TweakContainer<?>)modContainer; 230 TweakContainer<?> tweakContainer = (TweakContainer<?>)modContainer;
182 231
183 - this.providesTweak = tweakContainer.hasTweakClass();  
184 - this.providesTransformer = tweakContainer.hasClassTransformers(); 232 + providesTweak = tweakContainer.hasTweakClass();
  233 + providesTransformer = tweakContainer.hasClassTransformers();
185 } 234 }
  235 +
  236 + this.initIcons(providesTweak, providesTransformer, usingAPI);
186 } 237 }
187 - 238 +
  239 + /**
  240 + * @param providesTweak
  241 + * @param providesTransformer
  242 + * @param usingAPI
  243 + */
  244 + protected void initIcons(boolean providesTweak, boolean providesTransformer, boolean usingAPI)
  245 + {
  246 + if (providesTweak)
  247 + {
  248 + this.modIcons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestweak"), 12, 12, 158, 80, 158 + 12, 80 + 12));
  249 + }
  250 +
  251 + if (providesTransformer)
  252 + {
  253 + this.modIcons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.providestransformer"), 12, 12, 170, 80, 170 + 12, 80 + 12));
  254 + }
  255 +
  256 + if (usingAPI)
  257 + {
  258 + this.modIcons.add(new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, I18n.format("gui.mod.usingapi"), 12, 12, 122, 92, 122 + 12, 92 + 12));
  259 + }
  260 + }
  261 +
  262 + private boolean checkUsingAPI(LoadableMod<?> loadableMod)
  263 + {
  264 + for (String requiredAPI : loadableMod.getRequiredAPIs())
  265 + {
  266 + if (!GuiModListEntry.BUILT_IN_APIS.contains(requiredAPI))
  267 + return true;
  268 + }
  269 +
  270 + return false;
  271 + }
  272 +
188 /** 273 /**
189 * Draw this list entry as a list item 274 * Draw this list entry as a list item
190 * 275 *
@@ -199,72 +284,52 @@ public class GuiModListEntry extends Gui @@ -199,72 +284,52 @@ public class GuiModListEntry extends Gui
199 */ 284 */
200 public int drawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected) 285 public int drawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected)
201 { 286 {
202 - int colour1 = selected ? (this.external ? 0xB047d1aa : 0xB04785D1) : 0xB0000000;  
203 - drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + PANEL_HEIGHT, colour1, 0xB0333333);  
204 -  
205 - this.fontRenderer.drawString(this.name, xPosition + 5, yPosition + 2, this.isMissingDependencies ? 0xFFFFAA00 : (this.enabled ? (this.external ? 0xFF47d1aa : 0xFFFFFFFF) : 0xFF999999));  
206 - this.fontRenderer.drawString(I18n.format("gui.about.versiontext", this.version), xPosition + 5, yPosition + 12, 0xFF999999); 287 + int gradientColour = this.getGradientColour(selected);
  288 + int titleColour = this.getTitleColour(selected);
  289 + int statusColour = this.getStatusColour(selected);
207 290
208 - String status = this.external ? I18n.format("gui.status.loaded") : I18n.format("gui.status.active"); 291 + this.drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + GuiModListEntry.PANEL_HEIGHT, gradientColour, GuiModListEntry.GRADIENT_COLOUR2);
209 292
210 - if (this.isMissingDependencies)  
211 - {  
212 - status = "\247e" + I18n.format("gui.status.missingdeps");  
213 - if (this.canBeToggled && !this.willBeEnabled) status = "\247c" + I18n.format("gui.status.pending.disabled");  
214 - }  
215 - else if (this.canBeToggled)  
216 - {  
217 - if (!this.enabled && !this.willBeEnabled) status = "\2477" + I18n.format("gui.status.disabled");  
218 - if (!this.enabled && this.willBeEnabled) status = "\247a" + I18n.format("gui.status.pending.enabled");  
219 - if ( this.enabled && !this.willBeEnabled) status = "\247c" + I18n.format("gui.status.pending.disabled");  
220 - }  
221 -  
222 - this.fontRenderer.drawString(status, xPosition + 5, yPosition + 22, this.external ? 0xB047d1aa : 0xFF4785D1); 293 + this.fontRenderer.drawString(this.getTitleText(), xPosition + 5, yPosition + 2, titleColour);
  294 + this.fontRenderer.drawString(this.getVersionText(), xPosition + 5, yPosition + 12, GuiModListEntry.VERSION_TEXT_COLOUR);
  295 + this.fontRenderer.drawString(this.getStatusText(), xPosition + 5, yPosition + 22, statusColour);
223 296
224 this.mouseOverListEntry = this.isMouseOver(mouseX, mouseY, xPosition, yPosition, width, PANEL_HEIGHT); 297 this.mouseOverListEntry = this.isMouseOver(mouseX, mouseY, xPosition, yPosition, width, PANEL_HEIGHT);
225 - drawRect(xPosition, yPosition, xPosition + 1, yPosition + PANEL_HEIGHT, this.mouseOverListEntry ? 0xFFFFFFFF : 0xFF999999); 298 + drawRect(xPosition, yPosition, xPosition + 1, yPosition + PANEL_HEIGHT, this.mouseOverListEntry ? GuiModListEntry.HANGER_COLOUR_MOUSEOVER : GuiModListEntry.HANGER_COLOUR);
226 299
227 - return PANEL_HEIGHT + PANEL_SPACING; 300 + return GuiModListEntry.PANEL_HEIGHT + GuiModListEntry.PANEL_SPACING;
228 } 301 }
229 302
230 public int postRenderListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected) 303 public int postRenderListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected)
231 { 304 {
232 - int iconX = xPosition + width - 14;  
233 - if (this.providesTweak) iconX = this.drawPropertyIcon(iconX, yPosition + PANEL_HEIGHT - 14, mouseX, mouseY, 158, 80, I18n.format("gui.mod.providestweak"));  
234 - if (this.providesTransformer) iconX = this.drawPropertyIcon(iconX, yPosition + PANEL_HEIGHT - 14, mouseX, mouseY, 170, 80, I18n.format("gui.mod.providestransformer")); 305 + xPosition += (width - 14);
  306 + yPosition += (GuiModListEntry.PANEL_HEIGHT - 14);
235 307
236 - return PANEL_HEIGHT + PANEL_SPACING; 308 + for (IconAbsolute icon : this.modIcons)
  309 + {
  310 + xPosition = this.drawPropertyIcon(xPosition, yPosition, icon, mouseX, mouseY);
  311 + }
  312 +
  313 + return GuiModListEntry.PANEL_HEIGHT + GuiModListEntry.PANEL_SPACING;
237 } 314 }
238 315
239 - /**  
240 - * @param iconX  
241 - * @param yPosition  
242 - * @param mouseX  
243 - * @param mouseY  
244 - * @param u  
245 - * @param v  
246 - * @param tooltip  
247 - * @return  
248 - */  
249 - protected int drawPropertyIcon(int iconX, int yPosition, int mouseX, int mouseY, int u, int v, String tooltipText) 316 + protected int drawPropertyIcon(int xPosition, int yPosition, IconAbsolute icon, int mouseX, int mouseY)
250 { 317 {
251 glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 318 glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
252 - Minecraft.getMinecraft().getTextureManager().bindTexture(GuiScreenModInfo.aboutTextureResource);  
253 - this.drawTexturedModalRect(iconX, yPosition, u, v, 12, 12); 319 + Minecraft.getMinecraft().getTextureManager().bindTexture(icon.getTextureResource());
  320 +
  321 + glEnable(GL_BLEND);
  322 + this.drawTexturedModalRect(xPosition, yPosition, icon.getUPos(), icon.getVPos(), icon.getIconWidth(), icon.getIconHeight());
  323 + glDisable(GL_BLEND);
254 324
255 - if (mouseX >= iconX && mouseX <= iconX + 12 && mouseY >= yPosition && mouseY <= yPosition + 12) 325 + if (mouseX >= xPosition && mouseX <= xPosition + 12 && mouseY >= yPosition && mouseY <= yPosition + 12)
256 { 326 {
257 - GuiScreenModInfo.drawTooltip(this.fontRenderer, tooltipText, mouseX, mouseY, 4096, 4096, 0xFFFFFFFF, 0x80000000); 327 + GuiLiteLoaderPanel.drawTooltip(this.fontRenderer, icon.getIconName(), mouseX, mouseY, 4096, 4096, GuiModListEntry.WHITE, GuiModListEntry.BLEND_HALF & GuiModListEntry.BLACK);
258 } 328 }
259 329
260 - return iconX - 14;  
261 - }  
262 -  
263 - public int getHeight()  
264 - {  
265 - return PANEL_HEIGHT + PANEL_SPACING; 330 + return xPosition - 14;
266 } 331 }
267 - 332 +
268 /** 333 /**
269 * Draw this entry as the info page 334 * Draw this entry as the info page
270 * 335 *
@@ -275,37 +340,120 @@ public class GuiModListEntry extends Gui @@ -275,37 +340,120 @@ public class GuiModListEntry extends Gui
275 * @param yPosition 340 * @param yPosition
276 * @param width 341 * @param width
277 */ 342 */
278 - public void drawInfo(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height) 343 + public void drawInfo(final int mouseX, final int mouseY, final float partialTicks, final int xPosition, final int yPosition, final int width, final int height)
279 { 344 {
280 int bottom = height + yPosition; 345 int bottom = height + yPosition;
281 - yPosition += 2; 346 + int yPos = yPosition + 2;
282 347
283 - this.mouseOverInfo = this.isMouseOver(mouseX, mouseY, xPosition, yPosition, width, height); 348 + this.mouseOverInfo = this.isMouseOver(mouseX, mouseY, xPosition, yPos, width, height);
284 349
285 - this.fontRenderer.drawString(this.name, xPosition + 5, yPosition, 0xFFFFFFFF); yPosition += 10;  
286 - this.fontRenderer.drawString(I18n.format("gui.about.versiontext", this.version), xPosition + 5, yPosition, 0xFF999999); yPosition += 10; 350 + this.fontRenderer.drawString(this.getTitleText(), xPosition + 5, yPos, GuiModListEntry.TITLE_COLOUR); yPos += 10;
  351 + this.fontRenderer.drawString(this.getVersionText(), xPosition + 5, yPos, GuiModListEntry.VERSION_TEXT_COLOUR); yPos += 10;
287 352
288 - drawRect(xPosition + 5, yPosition, xPosition + width, yPosition + 1, 0xFF999999); yPosition += 4; 353 + drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModListEntry.DIVIDER_COLOUR); yPos += 4; // divider
289 354
290 - this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.author, xPosition + 5, yPosition, 0xFFFFFFFF); yPosition += 10; 355 + this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.author, xPosition + 5, yPos, GuiModListEntry.AUTHORS_COLOUR); yPos += 10;
291 if (this.url != null) 356 if (this.url != null)
292 { 357 {
293 - this.fontRenderer.drawString(this.url, xPosition + 5, yPosition, 0xB04785D1); yPosition += 10; 358 + this.fontRenderer.drawString(this.url, xPosition + 5, yPos, GuiModListEntry.BLEND_2THRDS & this.brandColour); yPos += 10;
294 } 359 }
295 360
296 - drawRect(xPosition + 5, yPosition, xPosition + width, yPosition + 1, 0xFF999999); yPosition += 4;  
297 - drawRect(xPosition + 5, bottom - 1, xPosition + width, bottom, 0xFF999999); 361 + drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModListEntry.DIVIDER_COLOUR); yPos += 4; // divider
  362 + drawRect(xPosition + 5, bottom - 1, xPosition + width, bottom, GuiModListEntry.DIVIDER_COLOUR); // divider
298 363
299 - int scrollHeight = bottom - yPosition - 3; 364 + int scrollHeight = bottom - yPos - 3;
300 int totalHeight = this.fontRenderer.splitStringWidth(this.description, width - 11); 365 int totalHeight = this.fontRenderer.splitStringWidth(this.description, width - 11);
301 366
302 this.scrollBar.setMaxValue(totalHeight - scrollHeight); 367 this.scrollBar.setMaxValue(totalHeight - scrollHeight);
303 - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, xPosition + width - 5, yPosition, 5, scrollHeight, totalHeight); 368 + this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, xPosition + width - 5, yPos, 5, scrollHeight, totalHeight);
304 369
305 - this.mouseOverScrollBar = this.isMouseOver(mouseX, mouseY, xPosition + width - 5, yPosition, 5, scrollHeight); 370 + this.mouseOverScrollBar = this.isMouseOver(mouseX, mouseY, xPosition + width - 5, yPos, 5, scrollHeight);
  371 +
  372 + GuiLiteLoaderPanel.glEnableClipping(-1, -1, yPos, bottom - 3);
  373 + this.fontRenderer.drawSplitString(this.description, xPosition + 5, yPos - this.scrollBar.getValue(), width - 11, GuiModListEntry.DESCRIPTION_COLOUR);
  374 + }
306 375
307 - GuiScreenModInfo.glEnableClipping(-1, -1, yPosition, bottom - 3);  
308 - this.fontRenderer.drawSplitString(this.description, xPosition + 5, yPosition - this.scrollBar.getValue(), width - 11, 0xFFFFFFFF); 376 + /**
  377 + * @return
  378 + */
  379 + protected String getTitleText()
  380 + {
  381 + return this.name;
  382 + }
  383 +
  384 + /**
  385 + * @return
  386 + */
  387 + protected String getVersionText()
  388 + {
  389 + return I18n.format("gui.about.versiontext", this.version);
  390 + }
  391 +
  392 + /**
  393 + * @return
  394 + */
  395 + protected String getStatusText()
  396 + {
  397 + String statusText = this.external ? I18n.format("gui.status.loaded") : I18n.format("gui.status.active");
  398 +
  399 + if (this.isMissingAPIs)
  400 + {
  401 + statusText = "\2475" + I18n.format("gui.status.missingapis");
  402 + if (this.canBeToggled && !this.willBeEnabled) statusText = "\247c" + I18n.format("gui.status.pending.disabled");
  403 + }
  404 + else if (this.isMissingDependencies)
  405 + {
  406 + statusText = "\247e" + I18n.format("gui.status.missingdeps");
  407 + if (this.canBeToggled && !this.willBeEnabled) statusText = "\247c" + I18n.format("gui.status.pending.disabled");
  408 + }
  409 + else if (this.canBeToggled)
  410 + {
  411 + if (!this.enabled && !this.willBeEnabled) statusText = "\2477" + I18n.format("gui.status.disabled");
  412 + if (!this.enabled && this.willBeEnabled) statusText = "\247a" + I18n.format("gui.status.pending.enabled");
  413 + if ( this.enabled && !this.willBeEnabled) statusText = "\247c" + I18n.format("gui.status.pending.disabled");
  414 + }
  415 +
  416 + return statusText;
  417 + }
  418 +
  419 + /**
  420 + * @param external
  421 + * @param selected
  422 + * @return
  423 + */
  424 + protected int getGradientColour(boolean selected)
  425 + {
  426 + return GuiModListEntry.BLEND_2THRDS & (selected ? (this.external ? GuiModListEntry.EXTERNAL_ENTRY_COLOUR : this.brandColour) : GuiModListEntry.BLACK);
  427 + }
  428 +
  429 + /**
  430 + * @param missingDependencies
  431 + * @param enabled
  432 + * @param external
  433 + * @param selected
  434 + * @return
  435 + */
  436 + protected int getTitleColour(boolean selected)
  437 + {
  438 + if (this.isMissingDependencies) return GuiModListEntry.MISSING_DEPENDENCY_COLOUR;
  439 + if (this.isMissingAPIs) return GuiModListEntry.API_COLOUR;
  440 + if (!this.enabled) return GuiModListEntry.GREY;
  441 + return this.external ? GuiModListEntry.EXTERNAL_ENTRY_COLOUR : GuiModListEntry.WHITE;
  442 + }
  443 +
  444 + /**
  445 + * @param external
  446 + * @param selected
  447 + * @return
  448 + */
  449 + protected int getStatusColour(boolean selected)
  450 + {
  451 + return this.external ? GuiModListEntry.EXTERNAL_ENTRY_COLOUR : this.brandColour;
  452 + }
  453 +
  454 + public int getHeight()
  455 + {
  456 + return GuiModListEntry.PANEL_HEIGHT + GuiModListEntry.PANEL_SPACING;
309 } 457 }
310 458
311 /** 459 /**
@@ -343,7 +491,7 @@ public class GuiModListEntry extends Gui @@ -343,7 +491,7 @@ public class GuiModListEntry extends Gui
343 if (this.canBeToggled) 491 if (this.canBeToggled)
344 { 492 {
345 this.willBeEnabled = !this.willBeEnabled; 493 this.willBeEnabled = !this.willBeEnabled;
346 - LiteLoader.getInstance().setModEnabled(this.identifier, this.willBeEnabled); 494 + this.mods.setModEnabled(this.identifier, this.willBeEnabled);
347 } 495 }
348 } 496 }
349 497
@@ -364,7 +512,7 @@ public class GuiModListEntry extends Gui @@ -364,7 +512,7 @@ public class GuiModListEntry extends Gui
364 512
365 public String getName() 513 public String getName()
366 { 514 {
367 - return this.name; 515 + return getTitleText();
368 } 516 }
369 517
370 public String getVersion() 518 public String getVersion()
@@ -397,7 +545,7 @@ public class GuiModListEntry extends Gui @@ -397,7 +545,7 @@ public class GuiModListEntry extends Gui
397 return this.willBeEnabled; 545 return this.willBeEnabled;
398 } 546 }
399 547
400 - public boolean mouseWasOverListEntry() 548 + public boolean isMouseOver()
401 { 549 {
402 return this.mouseOverListEntry; 550 return this.mouseOverListEntry;
403 } 551 }
@@ -406,7 +554,7 @@ public class GuiModListEntry extends Gui @@ -406,7 +554,7 @@ public class GuiModListEntry extends Gui
406 { 554 {
407 if (this.mouseOverInfo) 555 if (this.mouseOverInfo)
408 { 556 {
409 - this.scrollBar.offsetValue(-mouseWheelDelta); 557 + this.scrollBar.offsetValue(-mouseWheelDelta / 8);
410 return true; 558 return true;
411 } 559 }
412 560
java/com/mumfrey/liteloader/gui/ModInfoScreenPanel.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiPanel.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
2 2
3 import static org.lwjgl.opengl.GL11.*; 3 import static org.lwjgl.opengl.GL11.*;
4 4
5 import java.util.LinkedList; 5 import java.util.LinkedList;
6 import java.util.List; 6 import java.util.List;
7 7
  8 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  9 +
8 import net.minecraft.client.Minecraft; 10 import net.minecraft.client.Minecraft;
9 import net.minecraft.client.gui.Gui; 11 import net.minecraft.client.gui.Gui;
10 import net.minecraft.client.gui.GuiButton; 12 import net.minecraft.client.gui.GuiButton;
11 13
12 /** 14 /**
13 - * Base class for panels which can be displayed on the mod info screen 15 + * Base class for panels
14 * 16 *
15 * @author Adam Mummery-Smith 17 * @author Adam Mummery-Smith
16 */ 18 */
17 -public abstract class ModInfoScreenPanel extends Gui 19 +public abstract class GuiPanel extends Gui
18 { 20 {
19 protected static final int TOP = 26; 21 protected static final int TOP = 26;
20 protected static final int BOTTOM = 40; 22 protected static final int BOTTOM = 40;
@@ -63,11 +65,16 @@ public abstract class ModInfoScreenPanel extends Gui @@ -63,11 +65,16 @@ public abstract class ModInfoScreenPanel extends Gui
63 /** 65 /**
64 * @param minecraft 66 * @param minecraft
65 */ 67 */
66 - public ModInfoScreenPanel(Minecraft minecraft) 68 + public GuiPanel(Minecraft minecraft)
67 { 69 {
68 this.mc = minecraft; 70 this.mc = minecraft;
69 } 71 }
70 72
  73 + boolean stealFocus()
  74 + {
  75 + return true;
  76 + }
  77 +
71 /** 78 /**
72 * Called by the containing screen to set the panel size 79 * Called by the containing screen to set the panel size
73 * 80 *
@@ -125,7 +132,7 @@ public abstract class ModInfoScreenPanel extends Gui @@ -125,7 +132,7 @@ public abstract class ModInfoScreenPanel extends Gui
125 { 132 {
126 if (control.mousePressed(this.mc, mouseX, mouseY)) 133 if (control.mousePressed(this.mc, mouseX, mouseY))
127 { 134 {
128 - control.func_146113_a(this.mc.getSoundHandler()); 135 + control.playPressSound(this.mc.getSoundHandler());
129 this.actionPerformed(control); 136 this.actionPerformed(control);
130 } 137 }
131 } 138 }
@@ -195,9 +202,20 @@ public abstract class ModInfoScreenPanel extends Gui @@ -195,9 +202,20 @@ public abstract class ModInfoScreenPanel extends Gui
195 { 202 {
196 glEnable(GL_BLEND); 203 glEnable(GL_BLEND);
197 glAlphaFunc(GL_GREATER, 0.0F); 204 glAlphaFunc(GL_GREATER, 0.0F);
198 - this.mc.getTextureManager().bindTexture(GuiScreenModInfo.aboutTextureResource); 205 + this.mc.getTextureManager().bindTexture(LiteLoaderBrandingProvider.ABOUT_TEXTURE);
199 drawTexturedModalRect(x, y, (frame % 4) * 16, 171 + (((frame / 4) % 3) * 16), 16, 16); 206 drawTexturedModalRect(x, y, (frame % 4) * 16, 171 + (((frame / 4) % 3) * 16), 16, 16);
200 glAlphaFunc(GL_GREATER, 0.1F); 207 glAlphaFunc(GL_GREATER, 0.1F);
201 glDisable(GL_BLEND); 208 glDisable(GL_BLEND);
202 } 209 }
  210 +
  211 +
  212 + protected static final void glEnableClipping(int xLeft, int xRight, int yTop, int yBottom)
  213 + {
  214 + GuiLiteLoaderPanel.glEnableClipping(xLeft, xRight, yTop, yBottom);
  215 + }
  216 +
  217 + protected static final void glDisableClipping()
  218 + {
  219 + GuiLiteLoaderPanel.glDisableClipping();
  220 + }
203 } 221 }
204 \ No newline at end of file 222 \ No newline at end of file
java/client/com/mumfrey/liteloader/client/gui/GuiPanelAbout.java 0 โ†’ 100644
  1 +package com.mumfrey.liteloader.client.gui;
  2 +
  3 +import java.net.URI;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +import java.util.Set;
  7 +import java.util.TreeSet;
  8 +
  9 +import net.minecraft.client.Minecraft;
  10 +import net.minecraft.client.gui.FontRenderer;
  11 +import net.minecraft.client.gui.GuiButton;
  12 +import net.minecraft.client.resources.I18n;
  13 +import net.minecraft.util.IIcon;
  14 +import net.minecraft.util.ResourceLocation;
  15 +
  16 +import org.lwjgl.input.Keyboard;
  17 +
  18 +import com.mumfrey.liteloader.api.BrandingProvider;
  19 +import com.mumfrey.liteloader.api.LiteAPI;
  20 +import com.mumfrey.liteloader.client.api.LiteLoaderBrandingProvider;
  21 +import com.mumfrey.liteloader.client.util.render.IconAbsolute;
  22 +import com.mumfrey.liteloader.core.LiteLoader;
  23 +import com.mumfrey.liteloader.util.SortableValue;
  24 +
  25 +/**
  26 + * "About LiteLoader" panel which docks in the mod info screen and lists information about the installed APIs
  27 + *
  28 + * @author Adam Mummery-Smith
  29 + */
  30 +class GuiPanelAbout extends GuiPanel implements ScrollPanelContent
  31 +{
  32 + public static final IconAbsolute apiIconCoords = new IconAbsolute(LiteLoaderBrandingProvider.ABOUT_TEXTURE, "api_icon", 32, 32, 192, 144, 256, 208);
  33 +
  34 + private static final int ROW_HEIGHT = 40;
  35 +
  36 + private static final URI MCP_URI = URI.create("http://mcp.ocean-labs.de/");
  37 +
  38 + private GuiLiteLoaderPanel parent;
  39 +
  40 + private GuiScrollPanel scrollPane;
  41 +
  42 + private List<BrandingProvider> brandings = new ArrayList<BrandingProvider>();
  43 +
  44 + private boolean mouseOverLogo;
  45 +
  46 + public GuiPanelAbout(Minecraft minecraft, GuiLiteLoaderPanel parent)
  47 + {
  48 + super(minecraft);
  49 + this.parent = parent;
  50 + this.scrollPane = new GuiScrollPanel(minecraft, this, MARGIN, 90, 100, 100);
  51 +
  52 + this.sortBrandingProviders();
  53 +
  54 + this.scrollPane.addControl(new GuiHoverLabel(-2, 38, 22 + this.brandings.size() * GuiPanelAbout.ROW_HEIGHT, this.mc.fontRendererObj, "\247n" + MCP_URI.toString(), this.parent.getBrandColour()));
  55 + }
  56 +
  57 + /**
  58 + *
  59 + */
  60 + private void sortBrandingProviders()
  61 + {
  62 + Set<SortableValue<BrandingProvider>> sortedBrandingProviders = new TreeSet<SortableValue<BrandingProvider>>();
  63 +
  64 + for (LiteAPI api : LiteLoader.getAPIs())
  65 + {
  66 + BrandingProvider brandingProvider = LiteLoader.getCustomisationProvider(api, BrandingProvider.class);
  67 + if (brandingProvider != null)
  68 + {
  69 + sortedBrandingProviders.add(new SortableValue<BrandingProvider>(Integer.MAX_VALUE - brandingProvider.getPriority(), 0, brandingProvider));
  70 + }
  71 + }
  72 +
  73 + int brandingIndex = 0;
  74 +
  75 + for (SortableValue<BrandingProvider> sortedBrandingProvider : sortedBrandingProviders)
  76 + {
  77 + BrandingProvider brandingProvider = sortedBrandingProvider.getValue();
  78 +
  79 + this.brandings.add(brandingProvider);
  80 + URI homepage = brandingProvider.getHomepage();
  81 + if (homepage != null)
  82 + {
  83 + this.scrollPane.addControl(new GuiHoverLabel(brandingIndex, 38, 22 + brandingIndex * GuiPanelAbout.ROW_HEIGHT, this.mc.fontRendererObj, "\247n" + homepage, this.parent.getBrandColour()));
  84 + }
  85 +
  86 + brandingIndex++;
  87 + }
  88 + }
  89 +
  90 + @Override
  91 + void setSize(int width, int height)
  92 + {
  93 + super.setSize(width, height);
  94 +
  95 + this.scrollPane.setSizeAndPosition(MARGIN, 86, this.width - MARGIN * 2, this.height - 126);
  96 + this.controls.add(new GuiButton(-1, this.width - 99 - MARGIN, this.height - BOTTOM + 9, 100, 20, I18n.format("gui.done")));
  97 + this.controls.add(new GuiButton(-3, MARGIN, this.height - BOTTOM + 9, 100, 20, I18n.format("gui.log.button")));
  98 + }
  99 +
  100 + @Override
  101 + void draw(int mouseX, int mouseY, float partialTicks)
  102 + {
  103 + this.mouseOverLogo = this.parent.drawInfoPanel(mouseX, mouseY, partialTicks, 0, 38);
  104 +
  105 + this.scrollPane.draw(mouseX, mouseY, partialTicks);
  106 +
  107 + super.draw(mouseX, mouseY, partialTicks);
  108 + }
  109 +
  110 + @Override
  111 + public int getScrollPanelContentHeight(GuiScrollPanel source)
  112 + {
  113 + return 64 + this.brandings.size() * GuiPanelAbout.ROW_HEIGHT;
  114 + }
  115 +
  116 + @Override
  117 + public void drawScrollPanelContent(GuiScrollPanel source, int mouseX, int mouseY, float partialTicks, int scrollAmount, int visibleHeight)
  118 + {
  119 + FontRenderer fontRenderer = this.mc.fontRendererObj;
  120 + int textColour = 0xFFAAAAAA;
  121 +
  122 + int yPos = 0;
  123 +
  124 + for (BrandingProvider branding : this.brandings)
  125 + {
  126 + ResourceLocation twitterAvatarResource = branding.getTwitterAvatarResource();
  127 + IIcon twitterAvatarCoords = branding.getTwitterAvatarCoords();
  128 +
  129 + this.mc.getTextureManager().bindTexture(twitterAvatarResource != null ? twitterAvatarResource : LiteLoaderBrandingProvider.ABOUT_TEXTURE);
  130 + GuiLiteLoaderPanel.glDrawTexturedRect(0, yPos, twitterAvatarCoords != null ? twitterAvatarCoords : GuiPanelAbout.apiIconCoords, 1.0F);
  131 +
  132 + fontRenderer.drawString(branding.getDisplayName(), 38, yPos, 0xFFFFFFFF);
  133 + fontRenderer.drawString(branding.getCopyrightText(), 38, yPos + 11, textColour);
  134 +
  135 + yPos += GuiPanelAbout.ROW_HEIGHT;
  136 + }
  137 +
  138 + fontRenderer.drawString("Created using Mod Coder Pack", 38, yPos, 0xFFFFFFFF);
  139 + fontRenderer.drawString("MCP is (c) Copyright by the MCP Team", 38, yPos + 11, textColour);
  140 +
  141 + yPos += GuiPanelAbout.ROW_HEIGHT;
  142 +
  143 + fontRenderer.drawString("Minecraft is Copyright (c) Mojang AB", 38, yPos, textColour);
  144 + fontRenderer.drawString("All rights reserved.", 38, yPos + 11, textColour);
  145 + }
  146 +
  147 + @Override
  148 + public void scrollPanelMousePressed(GuiScrollPanel source, int mouseX, int mouseY, int mouseButton)
  149 + {
  150 + int index = mouseY / GuiPanelAbout.ROW_HEIGHT;
  151 + int yOffset = mouseY - (GuiPanelAbout.ROW_HEIGHT * index);
  152 +
  153 + if (mouseButton == 0 && mouseX < 33 && index >= 0 && index < this.brandings.size() && yOffset < 33)
  154 + {
  155 + String twitterUserName = this.brandings.get(index).getTwitterUserName();
  156 + if (twitterUserName != null)
  157 + {
  158 + URI twitterURI = URI.create("https://www.twitter.com/" + twitterUserName);
  159 + System.out.println(twitterURI);
  160 + this.openURI(twitterURI);
  161 + }
  162 + }
  163 + }
  164 +
  165 + /**
  166 + * @param control
  167 + */
  168 + @Override
  169 + void actionPerformed(GuiButton control)
  170 + {
  171 + if (control.id == -1) this.close();
  172 + if (control.id == -2) this.openURI(MCP_URI);
  173 + if (control.id == -3) this.parent.showLogPanel();
  174 + }
  175 +
  176 + @Override
  177 + public void scrollPanelActionPerformed(GuiScrollPanel source, GuiButton control)
  178 + {
  179 + if (control.id >= 0 && control.id < this.brandings.size())
  180 + {
  181 + URI homepage = this.brandings.get(control.id).getHomepage();
  182 + if (homepage != null) this.openURI(homepage);
  183 + }
  184 + }
  185 +
  186 + private void openURI(URI uri)
  187 + {
  188 + try
  189 + {
  190 + Class<?> desktop = Class.forName("java.awt.Desktop");
  191 + Object instance = desktop.getMethod("getDesktop").invoke(null);
  192 + desktop.getMethod("browse", URI.class).invoke(instance, uri);
  193 + }
  194 + catch (Throwable th) {}
  195 + }
  196 +
  197 + @Override
  198 + void onTick()
  199 + {
  200 + }
  201 +
  202 + @Override
  203 + void onHidden()
  204 + {
  205 + }
  206 +
  207 + @Override
  208 + void onShown()
  209 + {
  210 + }
  211 +
  212 + @Override
  213 + void keyPressed(char keyChar, int keyCode)
  214 + {
  215 + if (keyCode == Keyboard.KEY_ESCAPE) this.close();
  216 + }
  217 +
  218 + @Override
  219 + void mousePressed(int mouseX, int mouseY, int mouseButton)
  220 + {
  221 + this.scrollPane.mousePressed(mouseX, mouseY, mouseButton);
  222 +
  223 + if (mouseButton == 0 && this.mouseOverLogo)
  224 + {
  225 + this.close();
  226 + }
  227 +
  228 + super.mousePressed(mouseX, mouseY, mouseButton);
  229 + }
  230 +
  231 + @Override
  232 + void mouseMoved(int mouseX, int mouseY)
  233 + {
  234 + }
  235 +
  236 + @Override
  237 + void mouseReleased(int mouseX, int mouseY, int mouseButton)
  238 + {
  239 + this.scrollPane.mouseReleased(mouseX, mouseY, mouseButton);
  240 + }
  241 +
  242 + @Override
  243 + void mouseWheelScrolled(int mouseWheelDelta)
  244 + {
  245 + this.scrollPane.mouseWheelScrolled(mouseWheelDelta);
  246 + }
  247 +}
java/com/mumfrey/liteloader/gui/GuiConfigPanelContainer.java renamed to java/client/com/mumfrey/liteloader/client/gui/GuiPanelConfigContainer.java
1 -package com.mumfrey.liteloader.gui; 1 +package com.mumfrey.liteloader.client.gui;
2 2
3 -import static com.mumfrey.liteloader.gui.GuiScreenModInfo.*;  
4 import static org.lwjgl.opengl.GL11.*; 3 import static org.lwjgl.opengl.GL11.*;
5 -  
6 -  
7 import net.minecraft.client.Minecraft; 4 import net.minecraft.client.Minecraft;
8 import net.minecraft.client.gui.GuiButton; 5 import net.minecraft.client.gui.GuiButton;
9 import net.minecraft.client.resources.I18n; 6 import net.minecraft.client.resources.I18n;
@@ -18,7 +15,7 @@ import com.mumfrey.liteloader.modconfig.ConfigPanelHost; @@ -18,7 +15,7 @@ import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
18 * 15 *
19 * @author Adam Mummery-Smith 16 * @author Adam Mummery-Smith
20 */ 17 */
21 -public class GuiConfigPanelContainer extends ModInfoScreenPanel implements ConfigPanelHost 18 +class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost
22 { 19 {
23 /** 20 /**
24 * Panel we are hosting 21 * Panel we are hosting
@@ -46,7 +43,7 @@ public class GuiConfigPanelContainer extends ModInfoScreenPanel implements Confi @@ -46,7 +43,7 @@ public class GuiConfigPanelContainer extends ModInfoScreenPanel implements Confi
46 * @param panel 43 * @param panel
47 * @param mod 44 * @param mod
48 */ 45 */
49 - GuiConfigPanelContainer(Minecraft minecraft, ConfigPanel panel, LiteMod mod) 46 + GuiPanelConfigContainer(Minecraft minecraft, ConfigPanel panel, LiteMod mod)
50 { 47 {
51 super(minecraft); 48 super(minecraft);
52 49
@@ -147,7 +144,7 @@ public class GuiConfigPanelContainer extends ModInfoScreenPanel implements Confi @@ -147,7 +144,7 @@ public class GuiConfigPanelContainer extends ModInfoScreenPanel implements Confi
147 this.innerTop = TOP - this.scrollBar.getValue(); 144 this.innerTop = TOP - this.scrollBar.getValue();
148 145
149 // Draw panel title 146 // Draw panel title
150 - this.mc.fontRenderer.drawString(this.getPanelTitle(), MARGIN, TOP - 14, 0xFFFFFFFF); 147 + this.mc.fontRendererObj.drawString(this.getPanelTitle(), MARGIN, TOP - 14, 0xFFFFFFFF);
151 148
152 // Draw top and bottom horizontal bars 149 // Draw top and bottom horizontal bars
153 drawRect(MARGIN, TOP - 4, this.width - MARGIN, TOP - 3, 0xFF999999); 150 drawRect(MARGIN, TOP - 4, this.width - MARGIN, TOP - 3, 0xFF999999);