mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0bba74a47 | ||
|
|
cf9b5b445b | ||
|
|
aa200923f0 | ||
|
|
ddadf93ca1 | ||
|
|
781c681216 | ||
|
|
cfda7fc738 | ||
|
|
58ba24add2 | ||
|
|
dcf069ca52 | ||
|
|
c3fda11d10 | ||
|
|
11ac46daeb | ||
|
|
2dcabe0123 | ||
|
|
42f1d87955 | ||
|
|
334a76de75 | ||
|
|
677a6e578e | ||
|
|
a3b5eaacfd | ||
|
|
b3d4ea05ec | ||
|
|
8f35adca7a | ||
|
|
394f424185 | ||
|
|
ada52078c7 | ||
|
|
0daf1a6df4 | ||
|
|
edffd04ed2 | ||
|
|
7aea09f4ca | ||
|
|
5673c1dd29 | ||
|
|
1774e2bf30 | ||
|
|
4836b3272a | ||
|
|
a31607ae7d | ||
|
|
57ad221cc6 | ||
|
|
00c7883088 | ||
|
|
1de89525cc | ||
|
|
704a70902f | ||
|
|
570faeb790 | ||
|
|
8b8837c9ff | ||
|
|
eff464cf0e | ||
|
|
26ccb9106e | ||
|
|
0d84487412 | ||
|
|
2bc6a0666f | ||
|
|
82bc9f1b35 | ||
|
|
d73ac867df | ||
|
|
ede93d438f | ||
|
|
5e1949eb0e | ||
|
|
2d368c4c2e | ||
|
|
d9db27275e | ||
|
|
591a25722b | ||
|
|
d1ff1967b5 | ||
|
|
012a755bb9 | ||
|
|
748eece456 | ||
|
|
f709ce7579 | ||
|
|
33efc35b60 | ||
|
|
687d3c059d | ||
|
|
aaf02ea2ac | ||
|
|
625da6492d | ||
|
|
a573faf92d | ||
|
|
9565529baf | ||
|
|
3c346247e1 | ||
|
|
ce949e6099 | ||
|
|
5e3af8ac0e | ||
|
|
5cc90f060c | ||
|
|
577b19c1cf | ||
|
|
8905237306 | ||
|
|
c5d5f4e516 | ||
|
|
24022ab6ba | ||
|
|
6370c242f0 | ||
|
|
4762d4d8ef | ||
|
|
8f2dbf7046 | ||
|
|
23ea835fa7 | ||
|
|
d88db6c0cf | ||
|
|
c6dab815f4 | ||
|
|
7b722bfcd6 | ||
|
|
a90504315e | ||
|
|
3765ceb02d | ||
|
|
dab22f5b74 | ||
|
|
b301e8e4c1 | ||
|
|
f647929993 | ||
|
|
984291cee9 | ||
|
|
ac16845fc4 | ||
|
|
29edd242cd | ||
|
|
ca2d8bd834 | ||
|
|
2a779ec328 | ||
|
|
591e65fa1a | ||
|
|
485db6be2e | ||
|
|
25f3fcad46 | ||
|
|
6bf7c9878c | ||
|
|
95d0ff18cd | ||
|
|
1642bad402 | ||
|
|
450dd8313c | ||
|
|
ebdb166ec8 | ||
|
|
1eba1dfdc0 | ||
|
|
368a2245ef | ||
|
|
58ee06ea8e | ||
|
|
62f5adf8e2 | ||
|
|
fe1623a36a | ||
|
|
889efc1c0a | ||
|
|
0419b9d975 | ||
|
|
f1c6bdd57d | ||
|
|
b3e854a15d | ||
|
|
80a40c03e6 | ||
|
|
5bfaf7c170 | ||
|
|
2d98835db8 | ||
|
|
81c6421f84 | ||
|
|
6eeae8c49f | ||
|
|
c42a210140 | ||
|
|
a723aa6860 | ||
|
|
e9ff699c2d | ||
|
|
abe4f73a9a | ||
|
|
74fffc6fdc | ||
|
|
debbdc00be | ||
|
|
aed2cc446a | ||
|
|
e74087ee43 | ||
|
|
f329084f1f | ||
|
|
33cd9ad0fe | ||
|
|
ce819ac143 | ||
|
|
f0495a8abc | ||
|
|
a696db5a21 | ||
|
|
fcdbb4f5b3 | ||
|
|
e105337ff4 | ||
|
|
f52e2112dd | ||
|
|
945d927fa0 | ||
|
|
2ee6946824 | ||
|
|
e08c43366a | ||
|
|
c508004429 | ||
|
|
21af85323a | ||
|
|
3410242f03 | ||
|
|
9b9c46d93b | ||
|
|
de8e76c7fd | ||
|
|
47b5e99b6f | ||
|
|
1a465b33f5 | ||
|
|
8e7956397d | ||
|
|
86a9c7d359 | ||
|
|
6a581803a9 | ||
|
|
b4e0c709c5 | ||
|
|
f3458456a2 | ||
|
|
dcb15a587c | ||
|
|
937e9a0169 | ||
|
|
decd230ac1 | ||
|
|
5347caa1c4 | ||
|
|
52f6a674ea | ||
|
|
a16c61f7ba | ||
|
|
67f12d6dec | ||
|
|
bad55cacfa | ||
|
|
a6e979b311 | ||
|
|
ce68456f97 | ||
|
|
29e59438c5 | ||
|
|
10d4acfad2 | ||
|
|
1c3dc132cb | ||
|
|
cd96718339 | ||
|
|
22dbe411d9 | ||
|
|
a99d110fff | ||
|
|
f21929b7d1 | ||
|
|
5d78b310da | ||
|
|
549b6fd535 | ||
|
|
9fafdc1695 | ||
|
|
f169f7c92f | ||
|
|
b9ccadb2f1 | ||
|
|
f00650481b | ||
|
|
5d4c2fed88 | ||
|
|
66a81e7dbe | ||
|
|
6b5a433f65 | ||
|
|
b5d5c95b33 | ||
|
|
3ac891fa5a | ||
|
|
2dc0189179 | ||
|
|
dd98784262 | ||
|
|
1c9a51098b | ||
|
|
d075daf00e | ||
|
|
1bd6847bc8 | ||
|
|
dd832f2a88 | ||
|
|
aebf6eb168 | ||
|
|
8921cfe061 | ||
|
|
cd67596d57 | ||
|
|
e1c6630569 | ||
|
|
5ce4e31855 | ||
|
|
a99c488d49 | ||
|
|
94282c5575 | ||
|
|
7ad8529390 | ||
|
|
15534edce4 | ||
|
|
aa822e32af | ||
|
|
a14ab913a9 | ||
|
|
0165742a30 | ||
|
|
26a5b316de | ||
|
|
2140cd8cb6 | ||
|
|
4a6245a215 | ||
|
|
48544db690 | ||
|
|
2c89b3def3 | ||
|
|
5689182088 | ||
|
|
4a1f4b90fd | ||
|
|
f2d42d1134 | ||
|
|
51e7606e74 | ||
|
|
723c2d98eb | ||
|
|
7dee072e1a | ||
|
|
3e18c4160f | ||
|
|
513ad19187 | ||
|
|
eabede2203 | ||
|
|
b22dbc12a2 | ||
|
|
708e86adfb | ||
|
|
6f1b762c9d | ||
|
|
d9bfb29d6c | ||
|
|
6fc7bc4941 | ||
|
|
fb701cdc5e | ||
|
|
f7cc50b521 | ||
|
|
1a232cf766 | ||
|
|
853f54bcc2 | ||
|
|
127be2237d | ||
|
|
7e6456d7cd | ||
|
|
664ebda599 | ||
|
|
9b4a225ad2 | ||
|
|
6c59fa2d2c | ||
|
|
5736d850f0 | ||
|
|
127d6ee8ac | ||
|
|
2055543042 | ||
|
|
40e57a26a9 | ||
|
|
d604e44195 | ||
|
|
8b7778ccb6 | ||
|
|
7e30814ecb | ||
|
|
e5b1dfb74c | ||
|
|
27bc77363e | ||
|
|
506b73d0a0 | ||
|
|
20337b6e8a | ||
|
|
33ff87d8d9 | ||
|
|
af06bbd373 | ||
|
|
92a47ace8b | ||
|
|
f285ac369a | ||
|
|
68e76c273a | ||
|
|
e98c311a2c | ||
|
|
293edb316e | ||
|
|
2d4465eaf7 | ||
|
|
9266ff394a | ||
|
|
bbfd85ed1e | ||
|
|
6ecc2303f4 | ||
|
|
d35cfda798 | ||
|
|
cffa2a92a6 | ||
|
|
179c504746 | ||
|
|
31695d5ec1 | ||
|
|
bfb3020505 | ||
|
|
22a88ea2e4 | ||
|
|
0423fa5885 | ||
|
|
d17fbb527f | ||
|
|
d40bb0fe32 | ||
|
|
a513060a81 | ||
|
|
8e594a347c | ||
|
|
9af365edcc | ||
|
|
70554d6a2b | ||
|
|
eb84f52493 | ||
|
|
d074830d95 | ||
|
|
f7fe9ebeb2 | ||
|
|
b2c8f37aec | ||
|
|
a5bcccab59 | ||
|
|
a11f368b62 | ||
|
|
59656b004b | ||
|
|
ff8cb67a99 | ||
|
|
fa5256c8a7 | ||
|
|
4b19987ee6 | ||
|
|
9f43303073 | ||
|
|
a20958fb56 | ||
|
|
8c71098081 | ||
|
|
a3a5b44acb | ||
|
|
0473273709 | ||
|
|
bf492f32f9 | ||
|
|
4744677646 | ||
|
|
f0af2e4ef5 | ||
|
|
c7f763d6f0 | ||
|
|
563b8d1215 | ||
|
|
221493453f | ||
|
|
86c928430a | ||
|
|
cd0a0e51d5 | ||
|
|
66ff95f9d7 | ||
|
|
8ad172295f | ||
|
|
26a2ef5995 | ||
|
|
b4e3490fa1 | ||
|
|
828341f987 | ||
|
|
bc03fbb3be | ||
|
|
7a8dae5e35 | ||
|
|
d3c0e1f589 | ||
|
|
9c77d3f25b | ||
|
|
6371e9b71e | ||
|
|
578ef5cfeb | ||
|
|
516954e6f9 | ||
|
|
1151d5c3e3 | ||
|
|
25f1ddac30 | ||
|
|
39a146f8e6 | ||
|
|
037dcaefea | ||
|
|
01d6da3a90 | ||
|
|
8b2665980d | ||
|
|
42b3e6ad56 | ||
|
|
e709ab8a70 | ||
|
|
501409d1fb | ||
|
|
0fb3a34235 | ||
|
|
e4ba1f863e | ||
|
|
1f5c58b723 | ||
|
|
61e4db2c3b | ||
|
|
5efc1eb34c | ||
|
|
96c6f91201 | ||
|
|
62e69a2804 | ||
|
|
e9352d2675 | ||
|
|
ee6abdf28d | ||
|
|
968ee7ab09 | ||
|
|
3b3600d44f | ||
|
|
edcc5ca554 | ||
|
|
ca79dfe298 | ||
|
|
5945279b8b | ||
|
|
57bf64318b | ||
|
|
d9d0a46809 | ||
|
|
2fac644914 | ||
|
|
570592b24b | ||
|
|
fde94144ec | ||
|
|
f348496c10 | ||
|
|
a5c31b5365 | ||
|
|
2dc3f0ddef | ||
|
|
fa567014a5 | ||
|
|
96935bb122 | ||
|
|
43d3042dff | ||
|
|
fec221f8a6 | ||
|
|
b0f0635eb3 | ||
|
|
23a25131b0 | ||
|
|
a6eaa2bebc | ||
|
|
c6a0741379 | ||
|
|
5a1930e2d6 | ||
|
|
418deba5bf | ||
|
|
4ff2cff3c0 | ||
|
|
bd2123cf9d | ||
|
|
c2a603c910 | ||
|
|
db12af48fa | ||
|
|
a0f574a0ac | ||
|
|
8356fe9a7b | ||
|
|
6edce8b5f4 | ||
|
|
ca2bbe0b5f | ||
|
|
c8941a7faa | ||
|
|
5e20c03736 | ||
|
|
b19e882aab | ||
|
|
9d7d32a1b5 | ||
|
|
d512539554 | ||
|
|
a3a93f3387 | ||
|
|
a7eb5dc773 | ||
|
|
b23081df78 | ||
|
|
66db4ec46e | ||
|
|
8bd98c3a2d | ||
|
|
34cc42d3cb | ||
|
|
09eade4623 | ||
|
|
9bfe7df373 | ||
|
|
8006b774bf | ||
|
|
7cc91cfb0c |
No files matched your search
+5
-2
@@ -1,7 +1,10 @@
|
|||||||
* text eol=lf
|
* text eol=lf
|
||||||
*.bat text eol=crlf
|
*.bat text eol=crlf
|
||||||
*.patch text
|
*.patch text eol=lf
|
||||||
*.png binary
|
*.png binary
|
||||||
*.exe binary
|
*.exe binary
|
||||||
*.dll binary
|
*.dll binary
|
||||||
*.zip binary
|
*.zip binary
|
||||||
|
*.pyd binary
|
||||||
|
*.cfg text eol=lf
|
||||||
|
*.py text eol=lf
|
||||||
@@ -8,3 +8,7 @@
|
|||||||
fmlbranding.properties
|
fmlbranding.properties
|
||||||
/fernflower.zip
|
/fernflower.zip
|
||||||
/commands.py.bck
|
/commands.py.bck
|
||||||
|
/mcp*.zip
|
||||||
|
/mcp
|
||||||
|
/eclipse
|
||||||
|
/deobfuscation_data*.zip
|
||||||
+13
-3
@@ -1,7 +1,7 @@
|
|||||||
This minecraft mod, Forge Mod Loader, including all parts herein, is licensed
|
This minecraft mod, Forge Mod Loader, including all parts herein except as noted below,
|
||||||
under the GNU LGPL v2.1 or later.
|
is licensed under the GNU LGPL v2.1 or later.
|
||||||
|
|
||||||
Homepage: https://github.com/cpw/FML
|
Homepage: https://github.com/MinecraftForge/FML
|
||||||
|
|
||||||
This software includes portions from the Apache Maven project at
|
This software includes portions from the Apache Maven project at
|
||||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
||||||
@@ -9,6 +9,16 @@ included based on guidelines at
|
|||||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
||||||
with notices intact. The only change is a non-functional change of package name.
|
with notices intact. The only change is a non-functional change of package name.
|
||||||
|
|
||||||
|
=== MCP Data ===
|
||||||
|
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
||||||
|
from them. The license to MCP data is not transitive - distribution of this data by
|
||||||
|
third parties requires independent licensing from the MCP team. This data is not
|
||||||
|
redistributable without permission from the MCP team.
|
||||||
|
|
||||||
|
=== Sharing ===
|
||||||
|
License is granted to redistribute the ASM transformer code (common/cpw/mods/fml/common/asm/ and subdirectories)
|
||||||
|
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||||
|
|
||||||
========
|
========
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
|||||||
@@ -9,20 +9,6 @@
|
|||||||
====================================================================== -->
|
====================================================================== -->
|
||||||
<project name="FML" default="jenkinsbuild">
|
<project name="FML" default="jenkinsbuild">
|
||||||
<description>The Forge Mod Loader</description>
|
<description>The Forge Mod Loader</description>
|
||||||
<macrodef name="side">
|
|
||||||
<attribute name="prop" />
|
|
||||||
<attribute name="src" />
|
|
||||||
<attribute name="side" />
|
|
||||||
<sequential>
|
|
||||||
<property name="@{prop}" value="${@{side}.@{src}}" />
|
|
||||||
<condition property="is.client">
|
|
||||||
<equals arg1="@{side}" arg2="client" />
|
|
||||||
</condition>
|
|
||||||
<condition property="is.server">
|
|
||||||
<equals arg1="@{side}" arg2="server" />
|
|
||||||
</condition>
|
|
||||||
</sequential>
|
|
||||||
</macrodef>
|
|
||||||
<target name="writeversion" depends="buildenvsetup">
|
<target name="writeversion" depends="buildenvsetup">
|
||||||
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
||||||
<arg value="${basedir}/getversion.py" />
|
<arg value="${basedir}/getversion.py" />
|
||||||
@@ -30,6 +16,7 @@
|
|||||||
</exec>
|
</exec>
|
||||||
<propertyfile file="fmlversion.properties">
|
<propertyfile file="fmlversion.properties">
|
||||||
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
|
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
|
||||||
|
<entry key="fmlbuild.deobfuscation.hash" type="string" value="${deobf.checksum}"/>
|
||||||
</propertyfile>
|
</propertyfile>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -38,21 +25,23 @@
|
|||||||
<format pattern="yyMMddHHmmss" property="timestamp" />
|
<format pattern="yyMMddHHmmss" property="timestamp" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
<property file="fmlbuild.properties" />
|
|
||||||
<property name="modname" value="fml" />
|
<property name="modname" value="fml" />
|
||||||
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
|
<condition property="mcp.home" value="${env.WORKSPACE}/mcp" else="${basedir}/mcp">
|
||||||
<isset property="env.WORKSPACE" />
|
<isset property="env.WORKSPACE" />
|
||||||
</condition>
|
</condition>
|
||||||
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
|
<property name="fml.python.dir" location="${basedir}/python" />
|
||||||
<isset property="env.WORKSPACE" />
|
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
|
||||||
</condition>
|
|
||||||
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
|
|
||||||
<os family="Windows" />
|
<os family="Windows" />
|
||||||
</condition>
|
</condition>
|
||||||
|
<condition property="mcp.exists">
|
||||||
|
<available file="${mcp.home}/runtime/commands.py"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="signature.exists">
|
||||||
|
<available file="${env.JENKINS_HOME}/fmlsigned.properties"/>
|
||||||
|
</condition>
|
||||||
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
||||||
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
||||||
<property name="mcp.srcdir" location="${mcp.home}/src" />
|
<property name="mcp.srcdir" location="${mcp.home}/src" />
|
||||||
<property name="common.mcp.srcdir" location="${mcp.srcdir}/common" />
|
|
||||||
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
|
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
|
||||||
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
|
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
|
||||||
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
|
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
|
||||||
@@ -65,6 +54,7 @@
|
|||||||
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
||||||
<isset property="env.BUILD_NUMBER" />
|
<isset property="env.BUILD_NUMBER" />
|
||||||
</condition>
|
</condition>
|
||||||
|
<available file="eclipse" property="eclipse.exists"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="makeversion" depends="buildenvsetup">
|
<target name="makeversion" depends="buildenvsetup">
|
||||||
@@ -74,18 +64,23 @@
|
|||||||
<property name="version.major" value="${fmlbuild.major.number}" />
|
<property name="version.major" value="${fmlbuild.major.number}" />
|
||||||
<property name="version.minor" value="${fmlbuild.minor.number}" />
|
<property name="version.minor" value="${fmlbuild.minor.number}" />
|
||||||
<property name="version.rev" value="${fmlbuild.revision.number}" />
|
<property name="version.rev" value="${fmlbuild.revision.number}" />
|
||||||
|
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
|
||||||
|
<property name="version.branch" value="${fmlbuild.branch}" />
|
||||||
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean" depends="buildenvsetup">
|
<target name="makeclean" depends="buildenvsetup" if="mcp.exists">
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
<arg value="${mcp.home}/runtime/cleanup.py" />
|
||||||
<arg value="-f" />
|
<arg value="-f" />
|
||||||
</exec>
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" depends="buildenvsetup,makeclean" if="mcp.exists">
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||||
<arg value="${mcp.home}/runtime/decompile.py" />
|
<arg value="${basedir}/decompile.py" />
|
||||||
<arg value="-d" />
|
<arg value="${mcp.home}" />
|
||||||
<arg value="-n" />
|
<arg value="${basedir}" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -93,16 +88,16 @@
|
|||||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
||||||
<arg value="${mcp.home}/runtime/reobfuscate.py" />
|
<arg value="${mcp.home}/runtime/reobfuscate.py" />
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Reobfuscation failed">
|
<fail message="Reobfuscation failed">
|
||||||
<condition>
|
<condition>
|
||||||
<not>
|
<not>
|
||||||
<and>
|
<and>
|
||||||
<available file="${mcp.home}/temp/client.md5"/>
|
<available file="${mcp.home}/temp/client.md5"/>
|
||||||
<available file="${mcp.home}/temp/client_reobf.md5"/>
|
<available file="${mcp.home}/temp/client_reobf.md5"/>
|
||||||
</and>
|
</and>
|
||||||
</not>
|
</not>
|
||||||
</condition>
|
</condition>
|
||||||
</fail>
|
</fail>
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
<exec executable="${python.exe}" dir="${mcp.home}">
|
||||||
<arg value="${basedir}/generatechangedfilelist.py"/>
|
<arg value="${basedir}/generatechangedfilelist.py"/>
|
||||||
<arg value="${mcp.home}"/>
|
<arg value="${mcp.home}"/>
|
||||||
@@ -114,13 +109,13 @@
|
|||||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
||||||
<arg value="${mcp.home}/runtime/recompile.py" />
|
<arg value="${mcp.home}/runtime/recompile.py" />
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Compilation failed">
|
<fail message="Compilation failed">
|
||||||
<condition>
|
<condition>
|
||||||
<not>
|
<not>
|
||||||
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
|
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
|
||||||
</not>
|
</not>
|
||||||
</condition>
|
</condition>
|
||||||
</fail>
|
</fail>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="merge-client" depends="buildenvsetup">
|
<target name="merge-client" depends="buildenvsetup">
|
||||||
@@ -130,23 +125,33 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="merge-common">
|
<target name="merge-common">
|
||||||
<copy todir="${common.mcp.srcdir}" overwrite="true" verbose="true">
|
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
|
||||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
|
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
|
||||||
|
|
||||||
<target name="build-client" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion"/>
|
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion">
|
||||||
|
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
|
||||||
|
<equals arg1="${version.branch}" arg2="master" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
<target name="extract-built-jar">
|
|
||||||
<side prop="output" src="mcp.obfoutput" side="${side}" />
|
|
||||||
<property name="jarname" value="${modname}-${side}-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
<mkdir dir="${basedir}/target" />
|
||||||
<zip destfile="${basedir}/target/${jarname}.zip">
|
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
||||||
<fileset dir="${output}" includes="**/*.class" />
|
<manifest>
|
||||||
|
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
||||||
|
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
||||||
|
</manifest>
|
||||||
|
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class"/>
|
||||||
|
</jar>
|
||||||
|
<antcall target="signjar"/>
|
||||||
|
<zip update="true" destfile="${basedir}/target/${universal.jarname}.zip" >
|
||||||
|
<fileset dir="${client.mcp.obfoutput}" includes="*.class"/>
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
||||||
|
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
|
||||||
|
<zipfileset dir="${client.src.dir}" includes="mcp.png" />
|
||||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
||||||
<mappedresources>
|
<mappedresources>
|
||||||
@@ -167,47 +172,19 @@
|
|||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-universal" depends="build-client">
|
|
||||||
<property name="universal.jarname" value="${modname}-universal-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
|
||||||
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
|
||||||
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
|
||||||
</manifest>
|
|
||||||
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" />
|
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
|
||||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
|
||||||
<mappedresources>
|
|
||||||
<concat>
|
|
||||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
|
||||||
<filterchain>
|
|
||||||
<replacetokens>
|
|
||||||
<token key="MAJOR" value="${version.major}" />
|
|
||||||
<token key="MINOR" value="${version.minor}" />
|
|
||||||
<token key="REV" value="${version.rev}" />
|
|
||||||
<token key="BUILD" value="${version.build}" />
|
|
||||||
<token key="MCVERSION" value="${version.minecraft}" />
|
|
||||||
</replacetokens>
|
|
||||||
</filterchain>
|
|
||||||
</concat>
|
|
||||||
<mergemapper to="README-fml.txt" />
|
|
||||||
</mappedresources>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-source-pack" depends="makeversion">
|
<target name="build-source-pack" depends="makeversion">
|
||||||
<property name="srcpack.jarname" value="${modname}-src-${version}" />
|
<property name="srcpack.jarname" value="${modname}-src-${version.minecraft}-${version}-${version.branch}" />
|
||||||
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
|
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg" prefix="fml" />
|
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg,mc_versions.cfg" prefix="fml" />
|
||||||
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
|
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
|
||||||
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
|
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
|
||||||
|
<zipfileset dir="${client.src.dir}" includes="mcp.png" prefix="fml/client" />
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
|
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
|
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
|
||||||
|
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" prefix="fml/common" />
|
||||||
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
|
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
|
||||||
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
|
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
|
||||||
|
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
|
||||||
<mappedresources>
|
<mappedresources>
|
||||||
<concat>
|
<concat>
|
||||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
<fileset dir="${basedir}/install" includes="README.txt" />
|
||||||
@@ -227,7 +204,24 @@
|
|||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-client,build-universal,build-source-pack" />
|
<target name="build-deobf-data" depends="makeversion">
|
||||||
|
<mkdir dir="build-tmp-deobf"/>
|
||||||
|
<copy todir="build-tmp-deobf">
|
||||||
|
<mappedresources>
|
||||||
|
<fileset dir="${mcp.home}/conf" includes="packaged.srg"/>
|
||||||
|
<globmapper from="packaged.srg" to="joined.srg"/>
|
||||||
|
</mappedresources>
|
||||||
|
</copy>
|
||||||
|
<touch millis="0" file="build-tmp-deobf/joined.srg"/>
|
||||||
|
<zip file="deobfuscation_data_${version.minecraft}.zip" encoding="UTF-8">
|
||||||
|
<fileset dir="build-tmp-deobf" includes="joined.srg"/>
|
||||||
|
</zip>
|
||||||
|
<checksum algorithm="SHA1" property="deobf.checksum" file="deobfuscation_data_${version.minecraft}.zip"/>
|
||||||
|
<antcall target="writeversion"/>
|
||||||
|
<delete dir="build-tmp-deobf" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-deobf-data,build-universal,build-source-pack" />
|
||||||
|
|
||||||
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
|
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
|
||||||
|
|
||||||
@@ -248,7 +242,7 @@
|
|||||||
</condition>
|
</condition>
|
||||||
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
|
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
|
||||||
<echo>Preparing the MCP environment at ${mcp.home}</echo>
|
<echo>Preparing the MCP environment at ${mcp.home}</echo>
|
||||||
<antcall target="fmldecompile"/>
|
<antcall target="fmldecompile"/>
|
||||||
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
|
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
|
||||||
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
||||||
<fileset dir="${patch.mcp.srcdir}"/>
|
<fileset dir="${patch.mcp.srcdir}"/>
|
||||||
@@ -266,14 +260,11 @@
|
|||||||
<fileset dir="${mcp.srcdir}"/>
|
<fileset dir="${mcp.srcdir}"/>
|
||||||
</copy>
|
</copy>
|
||||||
<antcall target="writeversion"/>
|
<antcall target="writeversion"/>
|
||||||
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects</echo>
|
<antcall target="makeeclipse"/>
|
||||||
|
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML project</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="fmldecompile" depends="buildenvsetup">
|
<target name="fmldecompile" depends="buildenvsetup,makeclean">
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
<exec executable="${python.exe}" dir="${basedir}">
|
||||||
<arg value="${basedir}/decompile.py" />
|
<arg value="${basedir}/decompile.py" />
|
||||||
<arg value="${mcp.home}" />
|
<arg value="${mcp.home}" />
|
||||||
@@ -281,11 +272,7 @@
|
|||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jenkinsfmldecompile" depends="buildenvsetup">
|
<target name="jenkinsfmldecompile" depends="buildenvsetup,makeclean">
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
<exec executable="${python.exe}" dir="${basedir}">
|
||||||
<arg value="${basedir}/decompile.py" />
|
<arg value="${basedir}/decompile.py" />
|
||||||
<arg value="${mcp.home}" />
|
<arg value="${mcp.home}" />
|
||||||
@@ -325,20 +312,21 @@
|
|||||||
|
|
||||||
<target name="cleanargo" depends="buildenvsetup">
|
<target name="cleanargo" depends="buildenvsetup">
|
||||||
<delete dir="${client.mcp.srcdir}/argo"/>
|
<delete dir="${client.mcp.srcdir}/argo"/>
|
||||||
|
<delete dir="${client.mcp.srcdir}/org"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="checkpatches" depends="buildenvsetup">
|
<target name="checkpatches" depends="buildenvsetup">
|
||||||
<uptodate property="checkUptodate.uptodate">
|
<uptodate property="checkUptodate.uptodate">
|
||||||
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
|
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
|
||||||
<present targetdir="${patch.src.dir}">
|
<present targetdir="${patch.src.dir}">
|
||||||
<globmapper from="*.java" to="*.java.patch"/>
|
<globmapper from="*.java" to="*.java.patch"/>
|
||||||
</present>
|
</present>
|
||||||
</srcfiles>
|
</srcfiles>
|
||||||
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch"/>
|
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch"/>
|
||||||
</uptodate>
|
</uptodate>
|
||||||
<fail unless="checkUptodate.uptodate">
|
<fail unless="checkUptodate.uptodate">
|
||||||
A patch is out of date. Update your patches!
|
A patch is out of date. Update your patches!
|
||||||
</fail>
|
</fail>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="updatepatches" depends="buildenvsetup">
|
<target name="updatepatches" depends="buildenvsetup">
|
||||||
@@ -349,6 +337,13 @@
|
|||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="makeeclipse" depends="buildenvsetup" unless="eclipse.exists">
|
||||||
|
<echo>
|
||||||
|
Extracting fresh eclipse workspace to ${basedir}/eclipse
|
||||||
|
</echo>
|
||||||
|
<unzip src="${basedir}/eclipse-workspace-dev.zip" dest="${basedir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
|
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
|
||||||
<copy todir="${tmp.mcp.srcdir}">
|
<copy todir="${tmp.mcp.srcdir}">
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
<fileset dir="${mcp.srcdir}"/>
|
||||||
@@ -364,4 +359,12 @@
|
|||||||
<fileset dir="${tmp.mcp.srcdir}"/>
|
<fileset dir="${tmp.mcp.srcdir}"/>
|
||||||
</move>
|
</move>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="signjar" depends="buildenvsetup,makeversion" if="signature.exists">
|
||||||
|
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
|
||||||
|
<equals arg1="${version.branch}" arg2="master" />
|
||||||
|
</condition>
|
||||||
|
<property file="${env.JENKINS_HOME}/fmlsigned.properties" prefix="sign"/>
|
||||||
|
<echo>${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS}</echo>
|
||||||
|
<signjar alias="FML" jar="${basedir}/target/${universal.jarname}.zip" keypass="${sign.KEYPASS}" keystore="${env.JENKINS_HOME}/${sign.KEYSTORE}" storepass="${sign.STOREPASS}" verbose="true"/>
|
||||||
|
</target>
|
||||||
</project>
|
</project>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.Texture;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureStitched;
|
||||||
|
|
||||||
|
public class CopySubimageTextureHelper extends TextureHelper {
|
||||||
|
@Override
|
||||||
|
public void doTextureCopy(Texture atlas, Texture source, int atlasX, int atlasY)
|
||||||
|
{
|
||||||
|
if (atlas.func_94282_c() == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
atlas.func_94277_a(0);
|
||||||
|
ByteBuffer buffer = source.func_94273_h();
|
||||||
|
buffer.position(0);
|
||||||
|
GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, atlasX, atlasY, source.func_94275_d(), source.func_94276_e(), GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTextureUpload(TextureStitched source)
|
||||||
|
{
|
||||||
|
// NO OP for copysubimage
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
import cpw.mods.fml.common.IFMLHandledException;
|
import cpw.mods.fml.common.IFMLHandledException;
|
||||||
import cpw.mods.fml.common.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.src.FontRenderer;
|
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a mod throws this exception during loading, it will be called back to render
|
* If a mod throws this exception during loading, it will be called back to render
|
||||||
|
|||||||
@@ -17,27 +17,33 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.multiplayer.GuiConnecting;
|
||||||
|
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||||
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.Packet131MapData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.CrashReport;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityLiving;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
import net.minecraft.src.NetClientHandler;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import net.minecraft.src.Render;
|
|
||||||
import net.minecraft.src.RenderManager;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import net.minecraft.src.WorldClient;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.MapDifference;
|
||||||
|
import com.google.common.collect.MapDifference.ValueDifference;
|
||||||
|
|
||||||
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||||
@@ -54,15 +60,18 @@ import cpw.mods.fml.common.MissingModsException;
|
|||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.ModMetadata;
|
import cpw.mods.fml.common.ModMetadata;
|
||||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||||
import cpw.mods.fml.common.registry.IThrowableEntity;
|
import cpw.mods.fml.common.registry.IThrowableEntity;
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,14 +121,16 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
|
|
||||||
private DuplicateModsFoundException dupesFound;
|
private DuplicateModsFoundException dupesFound;
|
||||||
|
|
||||||
|
private boolean serverShouldBeKilledQuietly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to start the whole game off from
|
* Called to start the whole game off
|
||||||
* {@link MinecraftServer#startServer}
|
|
||||||
*
|
*
|
||||||
* @param minecraftServer
|
* @param minecraft The minecraft instance being launched
|
||||||
*/
|
*/
|
||||||
public void beginMinecraftLoading(Minecraft minecraft)
|
public void beginMinecraftLoading(Minecraft minecraft)
|
||||||
{
|
{
|
||||||
|
client = minecraft;
|
||||||
if (minecraft.func_71355_q())
|
if (minecraft.func_71355_q())
|
||||||
{
|
{
|
||||||
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
|
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
|
||||||
@@ -128,9 +139,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
client = minecraft;
|
// TextureFXManager.instance().setClient(client);
|
||||||
ObfuscationReflectionHelper.detectObfuscation(World.class);
|
|
||||||
TextureFXManager.instance().setClient(client);
|
|
||||||
FMLCommonHandler.instance().beginLoading(this);
|
FMLCommonHandler.instance().beginLoading(this);
|
||||||
new ModLoaderClientHelper(client);
|
new ModLoaderClientHelper(client);
|
||||||
try
|
try
|
||||||
@@ -234,7 +243,9 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
|
// Force renderengine to reload and re-initialize all textures
|
||||||
|
client.field_71446_o.func_78352_b();
|
||||||
|
// TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -290,7 +301,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
{
|
{
|
||||||
return Arrays.asList(String.format("Optifine %s",optifineContainer.getVersion()));
|
return Arrays.asList(String.format("Optifine %s",optifineContainer.getVersion()));
|
||||||
} else {
|
} else {
|
||||||
return Collections.emptyList();
|
return ImmutableList.<String>of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,6 +340,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
entity = (Entity)(cls.getConstructor(World.class).newInstance(wc));
|
entity = (Entity)(cls.getConstructor(World.class).newInstance(wc));
|
||||||
|
int offset = packet.entityId - entity.field_70157_k;
|
||||||
entity.field_70157_k = packet.entityId;
|
entity.field_70157_k = packet.entityId;
|
||||||
entity.func_70012_b(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch);
|
entity.func_70012_b(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch);
|
||||||
if (entity instanceof EntityLiving)
|
if (entity instanceof EntityLiving)
|
||||||
@@ -336,6 +348,14 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
((EntityLiving)entity).field_70759_as = packet.scaledHeadYaw;
|
((EntityLiving)entity).field_70759_as = packet.scaledHeadYaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entity parts[] = entity.func_70021_al();
|
||||||
|
if (parts != null)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < parts.length; j++)
|
||||||
|
{
|
||||||
|
parts[j].field_70157_k += offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.field_70118_ct = packet.rawX;
|
entity.field_70118_ct = packet.rawX;
|
||||||
@@ -348,18 +368,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
((IThrowableEntity)entity).setThrower(thrower);
|
((IThrowableEntity)entity).setThrower(thrower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity parts[] = entity.func_70021_al();
|
|
||||||
if (parts != null)
|
|
||||||
{
|
|
||||||
int i = packet.entityId - entity.field_70157_k;
|
|
||||||
for (int j = 0; j < parts.length; j++)
|
|
||||||
{
|
|
||||||
parts[j].field_70157_k += i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (packet.metadata != null)
|
if (packet.metadata != null)
|
||||||
{
|
{
|
||||||
entity.func_70096_w().func_75687_a((List)packet.metadata);
|
entity.func_70096_w().func_75687_a((List)packet.metadata);
|
||||||
@@ -404,6 +412,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
@Override
|
@Override
|
||||||
public void beginServerLoading(MinecraftServer server)
|
public void beginServerLoading(MinecraftServer server)
|
||||||
{
|
{
|
||||||
|
serverShouldBeKilledQuietly = false;
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,4 +468,75 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
{
|
{
|
||||||
return NetClientHandler.getConnectionCompatibilityLevel();
|
return NetClientHandler.getConnectionCompatibilityLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
|
||||||
|
{
|
||||||
|
GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
|
||||||
|
client.func_71373_a(mismatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void callbackIdDifferenceResponse(boolean response)
|
||||||
|
{
|
||||||
|
if (response)
|
||||||
|
{
|
||||||
|
serverShouldBeKilledQuietly = false;
|
||||||
|
GameData.releaseGate(true);
|
||||||
|
client.continueWorldLoading();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serverShouldBeKilledQuietly = true;
|
||||||
|
GameData.releaseGate(false);
|
||||||
|
// Reset and clear the client state
|
||||||
|
client.func_71403_a((WorldClient)null);
|
||||||
|
client.func_71373_a(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldServerShouldBeKilledQuietly()
|
||||||
|
{
|
||||||
|
return serverShouldBeKilledQuietly;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
|
||||||
|
{
|
||||||
|
boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
|
||||||
|
for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
|
||||||
|
{
|
||||||
|
ValueDifference<ItemData> vd = mismatch.getValue();
|
||||||
|
if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
|
||||||
|
{
|
||||||
|
criticalMismatch = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!criticalMismatch)
|
||||||
|
{
|
||||||
|
// We'll carry on with this connection, and just log a message instead
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Nuke the connection
|
||||||
|
((NetClientHandler)toKill).func_72553_e();
|
||||||
|
// Stop GuiConnecting
|
||||||
|
GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
|
||||||
|
// pulse the network manager queue to clear cruft
|
||||||
|
mgr.func_74428_b();
|
||||||
|
// Nuke the world client
|
||||||
|
client.func_71403_a((WorldClient)null);
|
||||||
|
// Show error screen
|
||||||
|
warnIDMismatch(s, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this GUI type open?
|
||||||
|
*
|
||||||
|
* @param gui The type of GUI to test for
|
||||||
|
* @return if a GUI of this type is open
|
||||||
|
*/
|
||||||
|
public boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
||||||
|
{
|
||||||
|
return client.field_71462_r != null && client.field_71462_r.getClass().equals(gui);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import net.minecraft.src.RenderEngine;
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
import net.minecraft.src.ITexturePack;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
public class FMLTextureFX extends TextureFX implements ITextureFX
|
|
||||||
{
|
|
||||||
public int tileSizeBase = 16;
|
|
||||||
public int tileSizeSquare = 256;
|
|
||||||
public int tileSizeMask = 15;
|
|
||||||
public int tileSizeSquareMask = 255;
|
|
||||||
public boolean errored = false;
|
|
||||||
protected Logger log = FMLLog.getLogger();
|
|
||||||
|
|
||||||
public FMLTextureFX(int icon)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void setErrored(boolean err){ errored = err; }
|
|
||||||
@Override public boolean getErrored(){ return errored; }
|
|
||||||
@Override
|
|
||||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
|
|
||||||
{
|
|
||||||
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onTextureDimensionsUpdate(int width, int height)
|
|
||||||
{
|
|
||||||
tileSizeBase = width >> 4;
|
|
||||||
tileSizeSquare = tileSizeBase * tileSizeBase;
|
|
||||||
tileSizeMask = tileSizeBase - 1;
|
|
||||||
tileSizeSquareMask = tileSizeSquare - 1;
|
|
||||||
setErrored(false);
|
|
||||||
setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setup()
|
|
||||||
{
|
|
||||||
field_76852_a = new byte[tileSizeSquare << 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean unregister(RenderEngine engine, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
effects.remove(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
|
|
||||||
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
|
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
|
|
||||||
import cpw.mods.fml.common.DuplicateModsFoundException;
|
import cpw.mods.fml.common.DuplicateModsFoundException;
|
||||||
import cpw.mods.fml.common.MissingModsException;
|
import cpw.mods.fml.common.MissingModsException;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
|
|
||||||
public class GuiDupesFound extends GuiErrorScreen
|
public class GuiDupesFound extends GuiErrorScreen
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiYesNo;
|
||||||
|
import net.minecraft.util.StringTranslate;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.MapDifference;
|
||||||
|
import com.google.common.collect.MapDifference.ValueDifference;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
|
|
||||||
|
public class GuiIdMismatchScreen extends GuiYesNo {
|
||||||
|
private List<String> missingIds = Lists.newArrayList();
|
||||||
|
private List<String> mismatchedIds = Lists.newArrayList();
|
||||||
|
private boolean allowContinue;
|
||||||
|
|
||||||
|
public GuiIdMismatchScreen(MapDifference<Integer, ItemData> idDifferences, boolean allowContinue)
|
||||||
|
{
|
||||||
|
super(null,"ID mismatch", "Should I continue?", 1);
|
||||||
|
field_73942_a = this;
|
||||||
|
for (Entry<Integer, ItemData> entry : idDifferences.entriesOnlyOnLeft().entrySet())
|
||||||
|
{
|
||||||
|
missingIds.add(String.format("ID %d from Mod %s is missing", entry.getValue().getItemId(), entry.getValue().getModId(), entry.getValue().getItemType()));
|
||||||
|
}
|
||||||
|
for (Entry<Integer, ValueDifference<ItemData>> entry : idDifferences.entriesDiffering().entrySet())
|
||||||
|
{
|
||||||
|
ItemData world = entry.getValue().leftValue();
|
||||||
|
ItemData game = entry.getValue().rightValue();
|
||||||
|
mismatchedIds.add(String.format("ID %d is mismatched between world and game", world.getItemId()));
|
||||||
|
}
|
||||||
|
this.allowContinue = allowContinue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_73878_a(boolean choice, int p_73878_2_)
|
||||||
|
{
|
||||||
|
FMLClientHandler.instance().callbackIdDifferenceResponse(choice);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||||
|
{
|
||||||
|
this.func_73873_v_();
|
||||||
|
if (!allowContinue && field_73887_h.size() == 2)
|
||||||
|
{
|
||||||
|
field_73887_h.remove(0);
|
||||||
|
}
|
||||||
|
int offset = Math.max(85 - (missingIds.size() + mismatchedIds.size()) * 10, 30);
|
||||||
|
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found ID mismatches", this.field_73880_f / 2, 10, 0xFFFFFF);
|
||||||
|
this.func_73732_a(this.field_73886_k, "Complete details are in the log file", this.field_73880_f / 2, 20, 0xFFFFFF);
|
||||||
|
int maxLines = 20;
|
||||||
|
for (String s: missingIds) {
|
||||||
|
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
|
offset += 10;
|
||||||
|
maxLines --;
|
||||||
|
if (maxLines < 0) break;
|
||||||
|
if (offset >= this.field_73881_g - 30) break;
|
||||||
|
}
|
||||||
|
if (maxLines > 0 && offset < this.field_73881_g - 30)
|
||||||
|
{
|
||||||
|
for (String s: mismatchedIds) {
|
||||||
|
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
|
offset += 10;
|
||||||
|
maxLines --;
|
||||||
|
if (maxLines < 0) break;
|
||||||
|
if (offset >= this.field_73881_g - 30) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allowContinue)
|
||||||
|
{
|
||||||
|
this.func_73732_a(this.field_73886_k, "Do you wish to continue loading?", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.func_73732_a(this.field_73886_k, "You cannot connect to this server", this.field_73880_f / 2, this.field_73881_g - 30, 0xFFFFFF);
|
||||||
|
}
|
||||||
|
// super.super. Grrr
|
||||||
|
for (int var4 = 0; var4 < this.field_73887_h.size(); ++var4)
|
||||||
|
{
|
||||||
|
GuiButton var5 = (GuiButton)this.field_73887_h.get(var4);
|
||||||
|
var5.field_73743_d = this.field_73881_g - 20;
|
||||||
|
if (!allowContinue)
|
||||||
|
{
|
||||||
|
var5.field_73746_c = this.field_73880_f / 2 - 75;
|
||||||
|
var5.field_73744_e = StringTranslate.func_74808_a().func_74805_b("gui.done");
|
||||||
|
}
|
||||||
|
var5.func_73737_a(this.field_73882_e, p_73863_1_, p_73863_2_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,12 +18,12 @@ import java.awt.Dimension;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.src.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.src.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.src.GuiSmallButton;
|
import net.minecraft.client.gui.GuiSmallButton;
|
||||||
import net.minecraft.src.StringTranslate;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.src.Tessellator;
|
import net.minecraft.util.StringTranslate;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public class GuiModList extends GuiScreen
|
|||||||
this.mods=new ArrayList<ModContainer>();
|
this.mods=new ArrayList<ModContainer>();
|
||||||
FMLClientHandler.instance().addSpecialModEntries(mods);
|
FMLClientHandler.instance().addSpecialModEntries(mods);
|
||||||
for (ModContainer mod : Loader.instance().getModList()) {
|
for (ModContainer mod : Loader.instance().getModList()) {
|
||||||
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
|
if (mod.getMetadata()!=null && mod.getMetadata().parentMod==null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
|
||||||
String parentMod = mod.getMetadata().parent;
|
String parentMod = mod.getMetadata().parent;
|
||||||
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
|
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
|
||||||
if (parentContainer != null)
|
if (parentContainer != null)
|
||||||
@@ -64,6 +64,10 @@ public class GuiModList extends GuiScreen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mod.getMetadata()!=null && mod.getMetadata().parentMod!=null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +102,7 @@ public class GuiModList extends GuiScreen
|
|||||||
|
|
||||||
public int drawLine(String line, int offset, int shifty)
|
public int drawLine(String line, int offset, int shifty)
|
||||||
{
|
{
|
||||||
this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
|
int r = this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
|
||||||
return shifty + 10;
|
return shifty + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,12 +116,21 @@ public class GuiModList extends GuiScreen
|
|||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
if (!selectedMod.getMetadata().autogenerated) {
|
if (!selectedMod.getMetadata().autogenerated) {
|
||||||
int shifty = 35;
|
int shifty = 35;
|
||||||
if (!selectedMod.getMetadata().logoFile.isEmpty())
|
String logoFile = selectedMod.getMetadata().logoFile;
|
||||||
|
if (!logoFile.isEmpty())
|
||||||
{
|
{
|
||||||
int texture = this.field_73882_e.field_71446_o.func_78341_b(selectedMod.getMetadata().logoFile);
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.field_73882_e.field_71446_o.func_78342_b(texture);
|
this.field_73882_e.field_71446_o.func_98187_b(logoFile);
|
||||||
Dimension dim = TextureFXManager.instance().getTextureDimensions(texture);
|
Dimension dim = TextureFXManager.instance().getTextureDimensions(logoFile);
|
||||||
|
double scaleX = dim.width / 200.0;
|
||||||
|
double scaleY = dim.height / 65.0;
|
||||||
|
double scale = 1.0;
|
||||||
|
if (scaleX > 1 || scaleY > 1)
|
||||||
|
{
|
||||||
|
scale = 1.0 / Math.max(scaleX, scaleY);
|
||||||
|
}
|
||||||
|
dim.width *= scale;
|
||||||
|
dim.height *= scale;
|
||||||
int top = 32;
|
int top = 32;
|
||||||
Tessellator tess = Tessellator.field_78398_a;
|
Tessellator tess = Tessellator.field_78398_a;
|
||||||
tess.func_78382_b();
|
tess.func_78382_b();
|
||||||
@@ -133,14 +146,18 @@ public class GuiModList extends GuiScreen
|
|||||||
shifty += 12;
|
shifty += 12;
|
||||||
|
|
||||||
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
|
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
|
||||||
shifty = drawLine(String.format("Mod State: %s", Loader.instance().getModState(selectedMod)), offset, shifty);
|
shifty = drawLine(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)), offset, shifty);
|
||||||
if (!selectedMod.getMetadata().credits.isEmpty()) {
|
if (!selectedMod.getMetadata().credits.isEmpty()) {
|
||||||
shifty = drawLine(String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty);
|
shifty = drawLine(String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty);
|
||||||
}
|
}
|
||||||
shifty = drawLine(String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty);
|
shifty = drawLine(String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty);
|
||||||
shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
|
shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
|
||||||
shifty = drawLine(selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty);
|
shifty = drawLine(selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty);
|
||||||
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, this.field_73880_f - offset - 20, 0xDDDDDD);
|
int rightSide = this.field_73880_f - offset - 20;
|
||||||
|
if (rightSide > 20)
|
||||||
|
{
|
||||||
|
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
offset = ( this.listWidth + this.field_73880_f ) / 2;
|
offset = ( this.listWidth + this.field_73880_f ) / 2;
|
||||||
this.func_73732_a(this.field_73886_k, selectedMod.getName(), offset, 35, 0xFFFFFF);
|
this.func_73732_a(this.field_73886_k, selectedMod.getName(), offset, 35, 0xFFFFFF);
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
import cpw.mods.fml.common.MissingModsException;
|
import cpw.mods.fml.common.MissingModsException;
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
|
|
||||||
public class GuiModsMissing extends GuiErrorScreen
|
public class GuiModsMissing extends GuiErrorScreen
|
||||||
{
|
{
|
||||||
@@ -31,6 +44,15 @@ public class GuiModsMissing extends GuiErrorScreen
|
|||||||
for (ArtifactVersion v : modsMissing.missingMods)
|
for (ArtifactVersion v : modsMissing.missingMods)
|
||||||
{
|
{
|
||||||
offset+=10;
|
offset+=10;
|
||||||
|
if (v instanceof DefaultArtifactVersion)
|
||||||
|
{
|
||||||
|
DefaultArtifactVersion dav = (DefaultArtifactVersion)v;
|
||||||
|
if (dav.getRange() != null && dav.getRange().isUnboundedAbove())
|
||||||
|
{
|
||||||
|
this.func_73732_a(this.field_73886_k, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
}
|
}
|
||||||
offset+=20;
|
offset+=20;
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import net.minecraft.src.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.src.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.src.GuiSmallButton;
|
import net.minecraft.client.gui.GuiSmallButton;
|
||||||
import net.minecraft.src.StringTranslate;
|
import net.minecraft.util.StringTranslate;
|
||||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.src.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
@@ -252,7 +264,7 @@ public abstract class GuiScrollingList
|
|||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
GL11.glDisable(GL11.GL_FOG);
|
GL11.glDisable(GL11.GL_FOG);
|
||||||
Tessellator var18 = Tessellator.field_78398_a;
|
Tessellator var18 = Tessellator.field_78398_a;
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.client.field_71446_o.func_78341_b("/gui/background.png"));
|
this.client.field_71446_o.func_98187_b("/gui/background.png");
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
float var17 = 32.0F;
|
float var17 = 32.0F;
|
||||||
var18.func_78382_b();
|
var18.func_78382_b();
|
||||||
@@ -385,7 +397,7 @@ public abstract class GuiScrollingList
|
|||||||
private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_)
|
private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_)
|
||||||
{
|
{
|
||||||
Tessellator var5 = Tessellator.field_78398_a;
|
Tessellator var5 = Tessellator.field_78398_a;
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.client.field_71446_o.func_78341_b("/gui/background.png"));
|
this.client.field_71446_o.func_98187_b("/gui/background.png");
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
float var6 = 32.0F;
|
float var6 = 32.0F;
|
||||||
var5.func_78382_b();
|
var5.func_78382_b();
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.minecraft.src.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
|
|||||||
@@ -1,10 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
|
|
||||||
public class GuiWrongMinecraft extends GuiErrorScreen
|
public class GuiWrongMinecraft extends GuiErrorScreen
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,23 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
|
||||||
import net.minecraft.src.RenderEngine;
|
import net.minecraft.client.renderer.RenderEngine;
|
||||||
import net.minecraft.src.ITexturePack;
|
import net.minecraft.client.texturepacks.ITexturePack;
|
||||||
|
|
||||||
public interface ITextureFX
|
public interface ITextureFX
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.Texture;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureStitched;
|
||||||
|
|
||||||
|
public class OpenGL43TextureHelper extends TextureHelper {
|
||||||
|
|
||||||
|
public OpenGL43TextureHelper()
|
||||||
|
{
|
||||||
|
// GL43.
|
||||||
|
// glCopyMethod = Class.forName("org.lwjgl.OpenGL")
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void doTextureCopy(Texture atlas, Texture source, int atlasX, int atlasY)
|
||||||
|
{
|
||||||
|
// System.out.printf("Src: %d Targ: %d, Coords %d %d %d %d\n", source.func_94282_c(), atlas.func_94282_c(), atlasX, atlasY, source.func_94275_d(), source.func_94276_e());
|
||||||
|
// GL43.glCopyImageSubData(source.func_94282_c(), GL11.GL_TEXTURE_2D, 0, 0, 0, 0, atlas.func_94282_c(), GL11.GL_TEXTURE_2D, 0, atlasX, atlasY, 0, source.func_94275_d(), source.func_94276_e(), 1);
|
||||||
|
// System.out.printf("Err: %x\n", GL11.glGetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTextureUpload(TextureStitched source)
|
||||||
|
{
|
||||||
|
// source.createAndUploadTextures();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
|
|
||||||
class OverrideInfo
|
|
||||||
{
|
|
||||||
public String texture;
|
|
||||||
public String override;
|
|
||||||
public int index;
|
|
||||||
public int imageIndex;
|
|
||||||
public TextureFX textureFX;
|
|
||||||
public boolean added;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
OverrideInfo inf=(OverrideInfo) obj;
|
|
||||||
return index==inf.index && imageIndex==inf.imageIndex;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return index+imageIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SpriteHelper
|
|
||||||
{
|
|
||||||
private static HashMap<String, BitSet> spriteInfo = new HashMap<String, BitSet>();
|
|
||||||
|
|
||||||
private static void initMCSpriteMaps() {
|
|
||||||
BitSet slots =
|
|
||||||
SpriteHelper.toBitSet(
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000110000" +
|
|
||||||
"0000000000100000" +
|
|
||||||
"0000000001100000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000011111" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000001111100" +
|
|
||||||
"0000000001111000" +
|
|
||||||
"0000000000000000");
|
|
||||||
spriteInfo.put("/terrain.png", slots);
|
|
||||||
|
|
||||||
slots = SpriteHelper.toBitSet(
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0111100000000000" +
|
|
||||||
"1111100010000000" +
|
|
||||||
"0000101110000000" +
|
|
||||||
"0111000000000000" +
|
|
||||||
"1100001100001111" +
|
|
||||||
"0000000000001111" +
|
|
||||||
"0000000000000000");
|
|
||||||
spriteInfo.put("/gui/items.png", slots);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Register a sprite map for ModTextureStatic, to allow for other mods to override
|
|
||||||
* your sprite page.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void registerSpriteMapForFile(String file, String spriteMap) {
|
|
||||||
if (spriteInfo.size() == 0) {
|
|
||||||
initMCSpriteMaps();
|
|
||||||
}
|
|
||||||
if (spriteInfo.containsKey(file)) {
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Duplicate attempt to register a sprite file %s for overriding -- ignoring",file));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spriteInfo.put(file, toBitSet(spriteMap));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getUniqueSpriteIndex(String path)
|
|
||||||
{
|
|
||||||
if (!spriteInfo.containsKey("/terrain.png"))
|
|
||||||
{
|
|
||||||
initMCSpriteMaps();
|
|
||||||
}
|
|
||||||
|
|
||||||
BitSet slots = spriteInfo.get(path);
|
|
||||||
|
|
||||||
if (slots == null)
|
|
||||||
{
|
|
||||||
Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path));
|
|
||||||
FMLLog.log(Level.SEVERE, ex, "A critical error has been detected with sprite overrides");
|
|
||||||
FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = getFreeSlot(slots);
|
|
||||||
|
|
||||||
if (ret == -1)
|
|
||||||
{
|
|
||||||
Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path));
|
|
||||||
FMLLog.log(Level.SEVERE, ex, "There are no sprite indicies left for %s", path);
|
|
||||||
FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BitSet toBitSet(String data)
|
|
||||||
{
|
|
||||||
BitSet ret = new BitSet(data.length());
|
|
||||||
for (int x = 0; x < data.length(); x++)
|
|
||||||
{
|
|
||||||
ret.set(x, data.charAt(x) == '1');
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getFreeSlot(BitSet slots)
|
|
||||||
{
|
|
||||||
int next=slots.nextSetBit(0);
|
|
||||||
slots.clear(next);
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int freeSlotCount(String textureToOverride)
|
|
||||||
{
|
|
||||||
return spriteInfo.get(textureToOverride).cardinality();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,306 +1,50 @@
|
|||||||
package cpw.mods.fml.client;
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
package cpw.mods.fml.client;
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_BINDING_2D;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import org.lwjgl.opengl.ContextCapabilities;
|
||||||
import net.minecraft.src.ModTextureStatic;
|
import org.lwjgl.opengl.GLContext;
|
||||||
import net.minecraft.src.RenderEngine;
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
import net.minecraft.src.ITexturePack;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.RenderEngine;
|
||||||
|
|
||||||
public class TextureFXManager
|
public class TextureFXManager
|
||||||
{
|
{
|
||||||
private static final TextureFXManager INSTANCE = new TextureFXManager();
|
private static final TextureFXManager INSTANCE = new TextureFXManager();
|
||||||
|
|
||||||
private class TextureProperties
|
|
||||||
{
|
|
||||||
private int textureId;
|
|
||||||
private Dimension dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Integer,TextureProperties> textureProperties = Maps.newHashMap();
|
|
||||||
private Multimap<String, OverrideInfo> overrideInfo = ArrayListMultimap.create();
|
|
||||||
private HashSet<OverrideInfo> animationSet = new HashSet<OverrideInfo>();
|
|
||||||
|
|
||||||
private List<TextureFX> addedTextureFX = new ArrayList<TextureFX>();
|
|
||||||
|
|
||||||
private Minecraft client;
|
private Minecraft client;
|
||||||
|
|
||||||
|
private Map<Integer,TextureHolder> texturesById = Maps.newHashMap();
|
||||||
|
private Map<String, TextureHolder> texturesByName = Maps.newHashMap();
|
||||||
|
|
||||||
|
private TextureHelper helper;
|
||||||
|
|
||||||
void setClient(Minecraft client)
|
void setClient(Minecraft client)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUpdateTextureEffect(TextureFX effect)
|
|
||||||
{
|
|
||||||
ITextureFX ifx = (effect instanceof ITextureFX ? ((ITextureFX)effect) : null);
|
|
||||||
|
|
||||||
if (ifx != null && ifx.getErrored())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String name = effect.getClass().getSimpleName();
|
|
||||||
client.field_71424_I.func_76320_a(name);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!FMLClientHandler.instance().hasOptifine())
|
|
||||||
{
|
|
||||||
effect.func_76846_a();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.warning("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name);
|
|
||||||
if (ifx != null)
|
|
||||||
{
|
|
||||||
ifx.setErrored(true);
|
|
||||||
}
|
|
||||||
client.field_71424_I.func_76319_b();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
client.field_71424_I.func_76319_b();
|
|
||||||
|
|
||||||
if (ifx != null)
|
|
||||||
{
|
|
||||||
Dimension dim = getTextureDimensions(effect);
|
|
||||||
int target = ((dim.width >> 4) * (dim.height >> 4)) << 2;
|
|
||||||
if (effect.field_76852_a.length != target)
|
|
||||||
{
|
|
||||||
FMLLog.warning("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target);
|
|
||||||
ifx.setErrored(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Quick and dirty image scaling, no smoothing or fanciness, meant for speed as it will be called every tick.
|
|
||||||
public void scaleTextureFXData(byte[] data, ByteBuffer buf, int target, int length)
|
|
||||||
{
|
|
||||||
int sWidth = (int)Math.sqrt(data.length / 4);
|
|
||||||
int factor = target / sWidth;
|
|
||||||
byte[] tmp = new byte[4];
|
|
||||||
|
|
||||||
buf.clear();
|
|
||||||
|
|
||||||
if (factor > 1)
|
|
||||||
{
|
|
||||||
for (int y = 0; y < sWidth; y++)
|
|
||||||
{
|
|
||||||
int sRowOff = sWidth * y;
|
|
||||||
int tRowOff = target * y * factor;
|
|
||||||
for (int x = 0; x < sWidth; x++)
|
|
||||||
{
|
|
||||||
int sPos = (x + sRowOff) * 4;
|
|
||||||
tmp[0] = data[sPos + 0];
|
|
||||||
tmp[1] = data[sPos + 1];
|
|
||||||
tmp[2] = data[sPos + 2];
|
|
||||||
tmp[3] = data[sPos + 3];
|
|
||||||
|
|
||||||
int tPosTop = (x * factor) + tRowOff;
|
|
||||||
for (int y2 = 0; y2 < factor; y2++)
|
|
||||||
{
|
|
||||||
buf.position((tPosTop + (y2 * target)) * 4);
|
|
||||||
for (int x2 = 0; x2 < factor; x2++)
|
|
||||||
{
|
|
||||||
buf.put(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.position(0).limit(length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPreRegisterEffect(TextureFX effect)
|
|
||||||
{
|
|
||||||
Dimension dim = getTextureDimensions(effect);
|
|
||||||
if (effect instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getEffectTexture(TextureFX effect)
|
|
||||||
{
|
|
||||||
Integer id = effectTextures.get(effect);
|
|
||||||
if (id != null)
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
effect.func_76845_a(client.field_71446_o);
|
|
||||||
|
|
||||||
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
GL11.glBindTexture(GL_TEXTURE_2D, old);
|
|
||||||
|
|
||||||
effectTextures.put(effect, id);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
pruneOldTextureFX(texturepack, effects);
|
|
||||||
|
|
||||||
for (TextureFX tex : effects)
|
|
||||||
{
|
|
||||||
if (tex instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)tex).onTexturePackChanged(engine, texturepack, getTextureDimensions(tex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadTextures(texturepack);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
|
|
||||||
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
|
|
||||||
private ITexturePack earlyTexturePack;
|
|
||||||
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
Dimension dim = new Dimension(width, height);
|
|
||||||
textureDims.put(id, dim);
|
|
||||||
|
|
||||||
for (TextureFX tex : effects)
|
|
||||||
{
|
|
||||||
if (getEffectTexture(tex) == id && tex instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)tex).onTextureDimensionsUpdate(width, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension getTextureDimensions(TextureFX effect)
|
|
||||||
{
|
|
||||||
return getTextureDimensions(getEffectTexture(effect));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension getTextureDimensions(int id)
|
|
||||||
{
|
|
||||||
return textureDims.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAnimation(TextureFX anim)
|
|
||||||
{
|
|
||||||
OverrideInfo info=new OverrideInfo();
|
|
||||||
info.index=anim.field_76850_b;
|
|
||||||
info.imageIndex=anim.field_76847_f;
|
|
||||||
info.textureFX=anim;
|
|
||||||
if (animationSet.contains(info)) {
|
|
||||||
animationSet.remove(info);
|
|
||||||
}
|
|
||||||
animationSet.add(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void loadTextures(ITexturePack texturePack)
|
|
||||||
{
|
|
||||||
registerTextureOverrides(client.field_71446_o);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void registerTextureOverrides(RenderEngine renderer) {
|
|
||||||
for (OverrideInfo animationOverride : animationSet) {
|
|
||||||
renderer.func_78355_a(animationOverride.textureFX);
|
|
||||||
addedTextureFX.add(animationOverride.textureFX);
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String fileToOverride : overrideInfo.keySet()) {
|
|
||||||
for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BufferedImage image=loadImageFromTexturePack(renderer, override.override);
|
|
||||||
ModTextureStatic mts=new ModTextureStatic(override.index, 1, override.texture, image);
|
|
||||||
renderer.func_78355_a(mts);
|
|
||||||
addedTextureFX.add(mts);
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLClientHandler", "registerTextureOverrides", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void registerAnimatedTexturesFor(ModContainer mod)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onEarlyTexturePackLoad(ITexturePack fallback)
|
|
||||||
{
|
|
||||||
if (client==null) {
|
|
||||||
// We're far too early- let's wait
|
|
||||||
this.earlyTexturePack = fallback;
|
|
||||||
} else {
|
|
||||||
loadTextures(fallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
ListIterator<TextureFX> li = addedTextureFX.listIterator();
|
|
||||||
while (li.hasNext())
|
|
||||||
{
|
|
||||||
TextureFX tex = li.next();
|
|
||||||
if (tex instanceof FMLTextureFX)
|
|
||||||
{
|
|
||||||
if (((FMLTextureFX)tex).unregister(client.field_71446_o, effects))
|
|
||||||
{
|
|
||||||
li.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
effects.remove(tex);
|
|
||||||
li.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void addNewTextureOverride(String textureToOverride, String overridingTexturePath, int location) {
|
|
||||||
OverrideInfo info = new OverrideInfo();
|
|
||||||
info.index = location;
|
|
||||||
info.override = overridingTexturePath;
|
|
||||||
info.texture = textureToOverride;
|
|
||||||
overrideInfo.put(textureToOverride, info);
|
|
||||||
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
||||||
{
|
{
|
||||||
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
||||||
@@ -320,4 +64,80 @@ public class TextureFXManager
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fixTransparency(BufferedImage loadedImage, String textureName)
|
||||||
|
{
|
||||||
|
if (textureName.matches("^/mob/.*_eyes.*.png$"))
|
||||||
|
{
|
||||||
|
for (int x = 0; x < loadedImage.getWidth(); x++) {
|
||||||
|
for (int y = 0; y < loadedImage.getHeight(); y++) {
|
||||||
|
int argb = loadedImage.getRGB(x, y);
|
||||||
|
if ((argb & 0xff000000) == 0 && argb != 0) {
|
||||||
|
loadedImage.setRGB(x, y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void bindTextureToName(String name, int index)
|
||||||
|
{
|
||||||
|
TextureHolder holder = new TextureHolder();
|
||||||
|
holder.textureId = index;
|
||||||
|
holder.textureName = name;
|
||||||
|
texturesById.put(index,holder);
|
||||||
|
texturesByName.put(name,holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextureDimensions(int index, int j, int k)
|
||||||
|
{
|
||||||
|
TextureHolder holder = texturesById.get(index);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
holder.x = j;
|
||||||
|
holder.y = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TextureHolder {
|
||||||
|
private int textureId;
|
||||||
|
private String textureName;
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension getTextureDimensions(String texture)
|
||||||
|
{
|
||||||
|
return texturesByName.containsKey(texture) ? new Dimension(texturesByName.get(texture).x, texturesByName.get(texture).y) : new Dimension(1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TextureHelper getHelper()
|
||||||
|
{
|
||||||
|
if (helper == null)
|
||||||
|
{
|
||||||
|
ContextCapabilities capabilities = GLContext.getCapabilities();
|
||||||
|
boolean has43 = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
has43 = capabilities.getClass().getField("GL_ARB_copy_image").getBoolean(capabilities);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
// NOOP - LWJGL needs updating
|
||||||
|
FMLLog.info("Forge Mod Loader has detected an older LWJGL version, new advanced texture animation features are disabled");
|
||||||
|
}
|
||||||
|
// if (has43 && Boolean.parseBoolean(System.getProperty("fml.useGL43","true")))
|
||||||
|
// {
|
||||||
|
// FMLLog.info("Using the new OpenGL 4.3 advanced capability for animations");
|
||||||
|
// helper = new OpenGL43TextureHelper();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
{
|
||||||
|
FMLLog.info("Not using advanced OpenGL 4.3 advanced capability for animations : OpenGL 4.3 is %s", has43 ? "available" : "not available");
|
||||||
|
helper = new CopySubimageTextureHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return helper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.Texture;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureStitched;
|
||||||
|
|
||||||
|
public abstract class TextureHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the texture from the source to the atlas at the specified position
|
||||||
|
*
|
||||||
|
* This will use the devised GL helper to do either GL-side copy or a subimage upload
|
||||||
|
*
|
||||||
|
* @param atlas The atlas texture we're copying into
|
||||||
|
* @param source The source texture we're copying from (complete)
|
||||||
|
* @param atlasX The X position on the atlas
|
||||||
|
* @param atlasY The Y position on the atlas
|
||||||
|
*/
|
||||||
|
public abstract void doTextureCopy(Texture atlas, Texture source, int atlasX, int atlasY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload the texture to the GPU for GL side copying operations
|
||||||
|
* This may be a no-op depending on the active implementation.
|
||||||
|
*
|
||||||
|
* @param source The texture to upload
|
||||||
|
*/
|
||||||
|
public abstract void doTextureUpload(TextureStitched source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate the texture so that it doesn't need a rotational transform applied each tick
|
||||||
|
*
|
||||||
|
* @param texture The texture to rotate
|
||||||
|
* @param buffer The buffer for the texture
|
||||||
|
*/
|
||||||
|
public void rotateTexture(Texture texture, ByteBuffer buffer)
|
||||||
|
{
|
||||||
|
ByteBuffer bytebuffer = buffer;
|
||||||
|
buffer.position(0);
|
||||||
|
ByteBuffer other = ByteBuffer.allocateDirect(buffer.capacity());
|
||||||
|
other.position(0);
|
||||||
|
|
||||||
|
int texHeight = texture.func_94276_e();
|
||||||
|
int texWidth = texture.func_94275_d();
|
||||||
|
|
||||||
|
for (int row = 0; row < texHeight; ++row)
|
||||||
|
{
|
||||||
|
int targCol = texHeight - row - 1;
|
||||||
|
int srcRowOffset = row * texWidth;
|
||||||
|
|
||||||
|
for (int col = 0; col < texWidth; ++col)
|
||||||
|
{
|
||||||
|
int targIndex = col * texHeight + targCol;
|
||||||
|
int srcIndex = srcRowOffset + col;
|
||||||
|
|
||||||
|
srcIndex <<=2;
|
||||||
|
targIndex <<=2;
|
||||||
|
|
||||||
|
other.put(targIndex + 0, bytebuffer.get(srcIndex + 0));
|
||||||
|
other.put(targIndex + 1, bytebuffer.get(srcIndex + 1));
|
||||||
|
other.put(targIndex + 2, bytebuffer.get(srcIndex + 2));
|
||||||
|
other.put(targIndex + 3, bytebuffer.get(srcIndex + 3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buffer.position(0);
|
||||||
|
buffer.put(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,23 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.modloader;
|
package cpw.mods.fml.client.modloader;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.src.BaseMod;
|
import net.minecraft.src.BaseMod;
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.src.IBlockAccess;
|
|
||||||
import net.minecraft.src.RenderBlocks;
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.modloader;
|
package cpw.mods.fml.client.modloader;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -7,19 +19,20 @@ import java.util.Map.Entry;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.src.BaseMod;
|
import net.minecraft.src.BaseMod;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.client.*;
|
||||||
import net.minecraft.src.EntityClientPlayerMP;
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||||
import net.minecraft.src.KeyBinding;
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
import net.minecraft.src.NetClientHandler;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.Render;
|
|
||||||
import net.minecraft.src.RenderManager;
|
|
||||||
|
|
||||||
import com.google.common.base.Equivalences;
|
import com.google.common.base.Equivalence;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
@@ -56,38 +69,38 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
|||||||
|
|
||||||
public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game)
|
public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game)
|
||||||
{
|
{
|
||||||
FMLLog.finer("Handling post startup activities for ModLoader mod %s", mc.getModId());
|
FMLLog.log(mc.getModId(), Level.FINE, "Handling post startup activities for ModLoader mod %s", mc.getModId());
|
||||||
BaseMod mod = (BaseMod) mc.getMod();
|
BaseMod mod = (BaseMod) mc.getMod();
|
||||||
|
|
||||||
Map<Class<? extends Entity>, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o);
|
Map<Class<? extends Entity>, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FMLLog.finest("Requesting renderers from basemod %s", mc.getModId());
|
FMLLog.log(mc.getModId(), Level.FINEST, "Requesting renderers from basemod %s", mc.getModId());
|
||||||
mod.addRenderer(renderers);
|
mod.addRenderer(renderers);
|
||||||
FMLLog.finest("Received %d renderers from basemod %s", renderers.size(), mc.getModId());
|
FMLLog.log(mc.getModId(), Level.FINEST, "Received %d renderers from basemod %s", renderers.size(), mc.getModId());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
|
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
|
||||||
}
|
}
|
||||||
|
|
||||||
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalences.identity());
|
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalence.identity());
|
||||||
|
|
||||||
for ( Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnLeft().entrySet())
|
for ( Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnLeft().entrySet())
|
||||||
{
|
{
|
||||||
FMLLog.warning("The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
|
FMLLog.log(mc.getModId(), Level.WARNING, "The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnRight().entrySet())
|
for (Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnRight().entrySet())
|
||||||
{
|
{
|
||||||
FMLLog.finest("Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
|
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue());
|
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<Class<? extends Entity>, ValueDifference<Render>> e : difference.entriesDiffering().entrySet())
|
for (Entry<Class<? extends Entity>, ValueDifference<Render>> e : difference.entriesDiffering().entrySet())
|
||||||
{
|
{
|
||||||
FMLLog.finest("Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
|
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue());
|
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +110,7 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
|
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.modloader;
|
package cpw.mods.fml.client.modloader;
|
||||||
@@ -23,7 +21,7 @@ import org.lwjgl.input.Mouse;
|
|||||||
import com.google.common.collect.ObjectArrays;
|
import com.google.common.collect.ObjectArrays;
|
||||||
import com.google.common.primitives.Booleans;
|
import com.google.common.primitives.Booleans;
|
||||||
|
|
||||||
import net.minecraft.src.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.registry;
|
package cpw.mods.fml.client.registry;
|
||||||
|
|
||||||
import net.minecraft.src.TileEntity;
|
|
||||||
import net.minecraft.src.TileEntityRenderer;
|
|
||||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public class ClientRegistry
|
public class ClientRegistry
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.registry;
|
package cpw.mods.fml.client.registry;
|
||||||
|
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.src.IBlockAccess;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.src.RenderBlocks;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
public interface ISimpleBlockRenderingHandler
|
public interface ISimpleBlockRenderingHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.registry;
|
package cpw.mods.fml.client.registry;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.src.GameSettings;
|
import net.minecraft.client.settings.GameSettings;
|
||||||
import net.minecraft.src.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
@@ -14,9 +26,9 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
import cpw.mods.fml.common.ITickHandler;
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
import cpw.mods.fml.common.registry.TickRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class KeyBindingRegistry
|
public class KeyBindingRegistry
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.client.registry;
|
package cpw.mods.fml.client.registry;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.src.IBlockAccess;
|
import net.minecraft.client.renderer.entity.*;
|
||||||
import net.minecraft.src.Render;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.src.RenderBiped;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.src.RenderBlocks;
|
|
||||||
import net.minecraft.src.RenderManager;
|
|
||||||
import net.minecraft.src.RenderPlayer;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.ObjectArrays;
|
import com.google.common.collect.ObjectArrays;
|
||||||
|
|
||||||
import cpw.mods.fml.client.SpriteHelper;
|
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
import cpw.mods.fml.client.TextureFXManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +35,7 @@ public class RenderingRegistry
|
|||||||
{
|
{
|
||||||
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
|
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
|
||||||
|
|
||||||
private int nextRenderId = 36;
|
private int nextRenderId = 40;
|
||||||
|
|
||||||
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
|
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
|
||||||
|
|
||||||
@@ -93,11 +101,10 @@ public class RenderingRegistry
|
|||||||
* @param fileToOverride
|
* @param fileToOverride
|
||||||
* @param fileToAdd
|
* @param fileToAdd
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static int addTextureOverride(String fileToOverride, String fileToAdd)
|
public static int addTextureOverride(String fileToOverride, String fileToAdd)
|
||||||
{
|
{
|
||||||
int idx = SpriteHelper.getUniqueSpriteIndex(fileToOverride);
|
return -1;
|
||||||
addTextureOverride(fileToOverride, fileToAdd, idx);
|
|
||||||
return idx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,7 +116,7 @@ public class RenderingRegistry
|
|||||||
*/
|
*/
|
||||||
public static void addTextureOverride(String path, String overlayPath, int index)
|
public static void addTextureOverride(String path, String overlayPath, int index)
|
||||||
{
|
{
|
||||||
TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
|
// TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,9 +124,10 @@ public class RenderingRegistry
|
|||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static int getUniqueTextureIndex(String path)
|
public static int getUniqueTextureIndex(String path)
|
||||||
{
|
{
|
||||||
return SpriteHelper.getUniqueSpriteIndex(path);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated public static RenderingRegistry instance()
|
@Deprecated public static RenderingRegistry instance()
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
@@ -12,17 +12,35 @@
|
|||||||
*/
|
*/
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.Side.CLIENT;
|
import static cpw.mods.fml.relauncher.Side.CLIENT;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.*;
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.NetServerHandler;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
|
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
|
||||||
{
|
{
|
||||||
@@ -169,23 +187,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to perform some action other than just dispensing the item from the dispenser
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVel
|
|
||||||
* @param zVel
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX, double entY, double entZ)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override if you wish to generate Nether (Hell biome) blocks
|
* Override if you wish to generate Nether (Hell biome) blocks
|
||||||
*
|
*
|
||||||
@@ -299,7 +300,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Only implemented on the client side
|
* Only implemented on the client side
|
||||||
* {@link #serverChat(EntityPlayer, Packet3Chat)}
|
* {@link #serverChat(NetServerHandler, String)}
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
@@ -329,6 +330,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Called client side to receive a custom payload for this mod
|
* Called client side to receive a custom payload for this mod
|
||||||
|
*
|
||||||
|
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
*/
|
*/
|
||||||
@@ -355,7 +358,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void serverConnect(NetHandler handler) {
|
public void serverConnect(NetHandler handler) {
|
||||||
|
|
||||||
@@ -367,6 +372,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void serverDisconnect() {
|
public void serverDisconnect() {
|
||||||
|
|
||||||
@@ -410,6 +418,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Called when a new client logs in.
|
* Called when a new client logs in.
|
||||||
|
*
|
||||||
|
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@@ -420,6 +430,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a client logs out of the server.
|
* Called when a client logs out of the server.
|
||||||
|
*
|
||||||
|
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onClientLogout(INetworkManager mgr)
|
public void onClientLogout(INetworkManager mgr)
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
|
||||||
public class EntityRendererProxy extends EntityRenderer
|
public class EntityRendererProxy extends EntityRenderer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
@@ -19,6 +17,13 @@ import java.util.List;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.RenderEngine;
|
||||||
|
import net.minecraft.client.renderer.texture.Texture;
|
||||||
|
import net.minecraft.client.texturepacks.ITexturePack;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
import cpw.mods.fml.client.TextureFXManager;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
@@ -34,12 +39,14 @@ public class FMLRenderAccessLibrary
|
|||||||
{
|
{
|
||||||
public static Logger getLogger()
|
public static Logger getLogger()
|
||||||
{
|
{
|
||||||
return FMLLog.getLogger();
|
Logger l = Logger.getLogger("FMLRenderAccessLibrary");
|
||||||
|
l.setParent(FMLLog.getLogger());
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Level level, String message)
|
public static void log(Level level, String message)
|
||||||
{
|
{
|
||||||
FMLLog.log(level, message);
|
FMLLog.log("FMLRenderAccessLibrary", level, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Level level, String message, Throwable throwable)
|
public static void log(Level level, String message, Throwable throwable)
|
||||||
@@ -47,31 +54,6 @@ public class FMLRenderAccessLibrary
|
|||||||
FMLLog.log(level, throwable, message);
|
FMLLog.log(level, throwable, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().setTextureDimensions(textureId, width, height, textureFXList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void preRegisterEffect(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().onPreRegisterEffect(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean onUpdateTextureEffect(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
return TextureFXManager.instance().onUpdateTextureEffect(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dimension getTextureDimensions(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
return TextureFXManager.instance().getTextureDimensions(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
|
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
|
||||||
{
|
{
|
||||||
@@ -89,4 +71,9 @@ public class FMLRenderAccessLibrary
|
|||||||
{
|
{
|
||||||
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelId);
|
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void doTextureCopy(Texture atlas, Texture source, int targetX, int targetY)
|
||||||
|
{
|
||||||
|
TextureFXManager.instance().getHelper().doTextureCopy(atlas, source, targetX, targetY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.Side.CLIENT;
|
import static cpw.mods.fml.relauncher.Side.CLIENT;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -20,10 +20,41 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.block.BlockDispenser;
|
||||||
|
import net.minecraft.client.*;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.multiplayer.NetClientHandler;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.RenderEngine;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraft.command.ICommand;
|
||||||
|
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.NetServerHandler;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.Packet1Login;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
|
import net.minecraft.server.*;
|
||||||
|
import net.minecraft.stats.Achievement;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldType;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.client.SpriteHelper;
|
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
import cpw.mods.fml.client.TextureFXManager;
|
||||||
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
||||||
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
|
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
|
||||||
@@ -34,7 +65,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
@@ -43,6 +73,7 @@ import cpw.mods.fml.common.network.Player;
|
|||||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import cpw.mods.fml.server.FMLServerHandler;
|
import cpw.mods.fml.server.FMLServerHandler;
|
||||||
|
|
||||||
public class ModLoader
|
public class ModLoader
|
||||||
@@ -69,7 +100,7 @@ public class ModLoader
|
|||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
*
|
*
|
||||||
* {@link GameRegistry#getFuelValue(ItemStack))}
|
* {@link GameRegistry#getFuelValue(ItemStack)}
|
||||||
*
|
*
|
||||||
* @param id The Item ID
|
* @param id The Item ID
|
||||||
* @param metadata The Item Metadata
|
* @param metadata The Item Metadata
|
||||||
@@ -87,17 +118,11 @@ public class ModLoader
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void addAnimation(TextureFX anim)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().addAnimation(anim);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new prefix to the armor texture list
|
* Adds a new prefix to the armor texture list
|
||||||
*
|
*
|
||||||
* {@link RenderingRegistry#addNewArmourRendererPrefix(String))}
|
* {@link RenderingRegistry#addNewArmourRendererPrefix(String)}
|
||||||
*
|
*
|
||||||
* @param armor The new armor prefix
|
* @param armor The new armor prefix
|
||||||
* @return The new armor index
|
* @return The new armor index
|
||||||
*/
|
*/
|
||||||
@@ -126,6 +151,17 @@ public class ModLoader
|
|||||||
{
|
{
|
||||||
ModLoaderHelper.addCommand(command);
|
ModLoaderHelper.addCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a behaviour to the dispenser
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @param behavior
|
||||||
|
*/
|
||||||
|
public static void addDispenserBehavior(Item item, IBehaviorDispenseItem behavior)
|
||||||
|
{
|
||||||
|
BlockDispenser.field_82527_a.func_82595_a(item, behavior);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Add localization for the specified string
|
* Add localization for the specified string
|
||||||
*
|
*
|
||||||
@@ -173,19 +209,20 @@ public class ModLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to register a small image to be applied to a larger texture image,
|
* Attempts to register a small image to be applied to a larger texture image,
|
||||||
* typically how old ModLoader mods add custom Item/Block textures.
|
* typically how old ModLoader mods add custom Item/Block textures.
|
||||||
*
|
*
|
||||||
* Forge mods should use setTextureFile in Item/Block
|
* Forge mods should use setTextureFile in Item/Block
|
||||||
*
|
*
|
||||||
* Will return the icon index it was applied to.
|
* Will return the icon index it was applied to.
|
||||||
*
|
*
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param fileToOverride The texture to apply the new image to
|
* @param fileToOverride The texture to apply the new image to
|
||||||
* @param fileToAdd The new image
|
* @param fileToAdd The new image
|
||||||
* @return The 'icon index' in the main image that the new image will be applied to
|
* @return The 'icon index' in the main image that the new image will be applied to
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SideOnly(CLIENT)
|
@SideOnly(CLIENT)
|
||||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
public static int addOverride(String fileToOverride, String fileToAdd)
|
||||||
{
|
{
|
||||||
@@ -193,11 +230,11 @@ public class ModLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to register a small image to be applied to a larger texture image,
|
* Attempts to register a small image to be applied to a larger texture image,
|
||||||
* typically how old ModLoader mods add custom Item/Block textures.
|
* typically how old ModLoader mods add custom Item/Block textures.
|
||||||
*
|
*
|
||||||
* Forge mods should use setTextureFile in Item/Block
|
* Forge mods should use setTextureFile in Item/Block
|
||||||
*
|
*
|
||||||
* Unimplemented on the server as it does not render textures
|
* Unimplemented on the server as it does not render textures
|
||||||
*
|
*
|
||||||
* @param path The texture to apply the new image to
|
* @param path The texture to apply the new image to
|
||||||
@@ -481,10 +518,11 @@ public class ModLoader
|
|||||||
return EntityRegistry.findGlobalUniqueEntityId();
|
return EntityRegistry.findGlobalUniqueEntityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@SideOnly(CLIENT)
|
@SideOnly(CLIENT)
|
||||||
public static int getUniqueSpriteIndex(String path)
|
public static int getUniqueSpriteIndex(String path)
|
||||||
{
|
{
|
||||||
return SpriteHelper.getUniqueSpriteIndex(path);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -503,7 +541,7 @@ public class ModLoader
|
|||||||
@SideOnly(CLIENT)
|
@SideOnly(CLIENT)
|
||||||
public static boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
public static boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
||||||
{
|
{
|
||||||
return FMLClientHandler.instance().getClient().field_71462_r != null && FMLClientHandler.instance().getClient().field_71462_r.equals(gui);
|
return FMLClientHandler.instance().isGUIOpen(gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -563,7 +601,6 @@ public class ModLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||||
* {@link FMLNetworkHandler#handlePacket250(Packet250CustomPayload, NetworkManager, NetHandler)}
|
|
||||||
*
|
*
|
||||||
* @param packet
|
* @param packet
|
||||||
*/
|
*/
|
||||||
@@ -767,21 +804,18 @@ public class ModLoader
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Send a chat message to the server
|
* Send a chat message to the server
|
||||||
* {@link FMLNetworkHandler#handleChatMessage(NetHandler, Packet3Chat)}
|
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void serverChat(String text)
|
public static void serverChat(String text)
|
||||||
{
|
{
|
||||||
//TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SideOnly(CLIENT)
|
@SideOnly(CLIENT)
|
||||||
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
|
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
|
||||||
{
|
{
|
||||||
//TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serverSendPacket(NetServerHandler handler, Packet packet)
|
public static void serverSendPacket(NetServerHandler handler, Packet packet)
|
||||||
|
|||||||
@@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.FMLTextureFX;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A texture override for animations, it takes a vertical image of
|
|
||||||
* texture frames and constantly rotates them in the texture.
|
|
||||||
*/
|
|
||||||
public class ModTextureAnimation extends FMLTextureFX
|
|
||||||
{
|
|
||||||
private final int tickRate;
|
|
||||||
private byte[][] images;
|
|
||||||
private int index = 0;
|
|
||||||
private int ticks = 0;
|
|
||||||
|
|
||||||
private String targetTex = null;
|
|
||||||
private BufferedImage imgData = null;
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
this(icon, 1, target, image, tickCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
|
||||||
|
|
||||||
targetTex = target;
|
|
||||||
field_76849_e = size;
|
|
||||||
field_76847_f = re.func_78341_b(target);
|
|
||||||
|
|
||||||
tickRate = tickCount;
|
|
||||||
ticks = tickCount;
|
|
||||||
imgData = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup()
|
|
||||||
{
|
|
||||||
super.setup();
|
|
||||||
|
|
||||||
int sWidth = imgData.getWidth();
|
|
||||||
int sHeight = imgData.getHeight();
|
|
||||||
int tWidth = tileSizeBase;
|
|
||||||
int tHeight = tileSizeBase;
|
|
||||||
|
|
||||||
|
|
||||||
int frames = (int)Math.floor((double)(sHeight / sWidth));
|
|
||||||
|
|
||||||
if (frames < 1)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
images = new byte[frames][];
|
|
||||||
BufferedImage image = imgData;
|
|
||||||
|
|
||||||
if (sWidth != tWidth)
|
|
||||||
{
|
|
||||||
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
|
|
||||||
Graphics2D g = b.createGraphics();
|
|
||||||
g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
|
||||||
g.dispose();
|
|
||||||
image = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int frame = 0; frame < frames; frame++)
|
|
||||||
{
|
|
||||||
int[] pixels = new int[tileSizeSquare];
|
|
||||||
image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth);
|
|
||||||
images[frame] = new byte[tileSizeSquare << 2];
|
|
||||||
|
|
||||||
for (int i = 0; i < pixels.length; i++)
|
|
||||||
{
|
|
||||||
int i4 = i * 4;
|
|
||||||
images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255);
|
|
||||||
images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255);
|
|
||||||
images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255);
|
|
||||||
images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void func_76846_a()
|
|
||||||
{
|
|
||||||
if (++ticks >= tickRate)
|
|
||||||
{
|
|
||||||
if (++index >= images.length)
|
|
||||||
{
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
field_76852_a = images[index];
|
|
||||||
ticks = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void func_76845_a(RenderEngine renderEngine)
|
|
||||||
{
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: REMOVE THIS - just for you dan200
|
|
||||||
@Deprecated
|
|
||||||
public void func_783_a()
|
|
||||||
{
|
|
||||||
func_76846_a();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.FMLTextureFX;
|
|
||||||
|
|
||||||
public class ModTextureStatic extends FMLTextureFX
|
|
||||||
{
|
|
||||||
private boolean oldanaglyph = false;
|
|
||||||
private int[] pixels = null;
|
|
||||||
private String targetTex = null;
|
|
||||||
private int storedSize;
|
|
||||||
private BufferedImage overrideData = null;
|
|
||||||
private int needApply = 2;
|
|
||||||
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int target, BufferedImage image)
|
|
||||||
{
|
|
||||||
this(icon, 1, target, image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
|
|
||||||
{
|
|
||||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
|
||||||
|
|
||||||
targetTex = target;
|
|
||||||
storedSize = size;
|
|
||||||
field_76849_e = size;
|
|
||||||
field_76847_f = re.func_78341_b(target);
|
|
||||||
overrideData = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup()
|
|
||||||
{
|
|
||||||
super.setup();
|
|
||||||
int sWidth = overrideData.getWidth();
|
|
||||||
int sHeight = overrideData.getHeight();
|
|
||||||
|
|
||||||
pixels = new int[tileSizeSquare];
|
|
||||||
if (tileSizeBase == sWidth && tileSizeBase == sHeight)
|
|
||||||
{
|
|
||||||
overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6);
|
|
||||||
Graphics2D gfx = tmp.createGraphics();
|
|
||||||
gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
|
||||||
tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase);
|
|
||||||
gfx.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_76846_a()
|
|
||||||
{
|
|
||||||
if (oldanaglyph != field_76851_c)
|
|
||||||
{
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
// This makes it so we only apply the texture to the target texture when we need to,
|
|
||||||
//due to the fact that update is called when the Effect is first registered, we actually
|
|
||||||
//need to wait for the next one.
|
|
||||||
field_76849_e = (needApply == 0 ? 0 : storedSize);
|
|
||||||
if (needApply > 0)
|
|
||||||
{
|
|
||||||
needApply--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_76845_a(RenderEngine p_76845_1_)
|
|
||||||
{
|
|
||||||
GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
needApply = 2;
|
|
||||||
for (int idx = 0; idx < pixels.length; idx++)
|
|
||||||
{
|
|
||||||
int i = idx * 4;
|
|
||||||
int a = pixels[idx] >> 24 & 255;
|
|
||||||
int r = pixels[idx] >> 16 & 255;
|
|
||||||
int g = pixels[idx] >> 8 & 255;
|
|
||||||
int b = pixels[idx] >> 0 & 255;
|
|
||||||
|
|
||||||
if (field_76851_c)
|
|
||||||
{
|
|
||||||
r = g = b = (r + g + b) / 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
field_76852_a[i + 0] = (byte)r;
|
|
||||||
field_76852_a[i + 1] = (byte)g;
|
|
||||||
field_76852_a[i + 2] = (byte)b;
|
|
||||||
field_76852_a[i + 3] = (byte)a;
|
|
||||||
}
|
|
||||||
|
|
||||||
oldanaglyph = field_76851_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Implementation of http://scale2x.sourceforge.net/algorithm.html
|
|
||||||
public static BufferedImage scale2x(BufferedImage image)
|
|
||||||
{
|
|
||||||
int w = image.getWidth();
|
|
||||||
int h = image.getHeight();
|
|
||||||
BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2);
|
|
||||||
|
|
||||||
for (int x = 0; x < h; ++x)
|
|
||||||
{
|
|
||||||
int x2 = x * 2;
|
|
||||||
for (int y = 0; y < w; ++y)
|
|
||||||
{
|
|
||||||
int y2 = y * 2;
|
|
||||||
int E = image.getRGB(y, x);
|
|
||||||
int D = (x == 0 ? E : image.getRGB(y, x - 1));
|
|
||||||
int B = (y == 0 ? E : image.getRGB(y - 1, x ));
|
|
||||||
int H = (y >= w - 1 ? E : image.getRGB(y + 1, x ));
|
|
||||||
int F = (x >= h - 1 ? E : image.getRGB(y, x + 1));
|
|
||||||
|
|
||||||
int e0, e1, e2, e3;
|
|
||||||
|
|
||||||
if (B != H && D != F)
|
|
||||||
{
|
|
||||||
e0 = D == B ? D : E;
|
|
||||||
e1 = B == F ? F : E;
|
|
||||||
e2 = D == H ? D : E;
|
|
||||||
e3 = H == F ? F : E;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e0 = e1 = e2 = e3 = E;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp.setRGB(y2, x2, e0);
|
|
||||||
tmp.setRGB(y2 + 1, x2, e1);
|
|
||||||
tmp.setRGB(y2, x2 + 1, e2);
|
|
||||||
tmp.setRGB(y2 + 1, x2 + 1, e3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package net.minecraft.src;
|
package net.minecraft.src;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+159
-115
@@ -4,69 +4,160 @@
|
|||||||
|
|
||||||
|
|
||||||
def reallyrmtree(path):
|
def reallyrmtree(path):
|
||||||
+ if os.path.isfile(os.path.join(path, 'asm-all-4.0.jar')): #Check if asm exists, indicating the libs folder, if so, don't delete it
|
+ if os.path.isfile(os.path.join(path, 'asm-4.1.tar.gz')): #Check if asm exists, indicating the libs folder, if so, don't delete it
|
||||||
+ return
|
+ return
|
||||||
if not sys.platform.startswith('win'):
|
if not sys.platform.startswith('win'):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
@@ -584,6 +586,9 @@
|
@@ -139,6 +141,8 @@
|
||||||
self.has_astyle_cfg = False
|
fieldnames = csvreader.fieldnames
|
||||||
if os.path.isfile(self.astyleconf):
|
return set(fieldnames)
|
||||||
self.has_astyle_cfg = True
|
|
||||||
+
|
|
||||||
+ #FML Entries
|
|
||||||
+ self.srcshared = os.path.normpath(os.path.join(self.dirsrc, 'common'))
|
|
||||||
|
|
||||||
def creatergcfg(self, reobf=False, keep_lvt=False, keep_generics=False, rg_update=False):
|
+def commands_sanity_check():
|
||||||
"""Create the files necessary for RetroGuard"""
|
+ print 'Commands patch applied successfully'
|
||||||
@@ -781,7 +786,8 @@
|
|
||||||
|
class Commands(object):
|
||||||
|
"""Contains the commands and initialisation for a full mcp run"""
|
||||||
|
@@ -194,6 +198,7 @@
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
self.checkjava()
|
||||||
|
+ self.checkscala()
|
||||||
|
self.readcommands(verify, no_patch=no_patch)
|
||||||
|
|
||||||
|
def checkcommand(self, name, command, java=False, single_line=False, check_return=True, error=True):
|
||||||
|
@@ -230,6 +235,8 @@
|
||||||
|
self.checkcommand('java', '%s -version' % self.cmdjava)
|
||||||
|
self.checkcommand('javac', '%s -version' % self.cmdjavac)
|
||||||
|
self.checkcommand('javac runtime', '%s -J-version' % self.cmdjavac)
|
||||||
|
+ if self.cmdscalac: self.checkcommand('scalac', '%s -version' % self.cmdscalac)
|
||||||
|
+ if self.cmdscalac: self.checkcommand('scalac runtime', '%s -J-version' % self.cmdscalac)
|
||||||
|
self.checkcommand('retroguard', '%s --version' % self.retroguard, java=True)
|
||||||
|
|
||||||
|
self.exceptor = os.path.normpath(self.config.get('COMMANDS', 'Exceptor'))
|
||||||
|
@@ -350,6 +357,8 @@
|
||||||
|
self.cmdfernflower = self.config.get('COMMANDS', 'CmdFernflower', raw=1) % (self.cmdjava, self.fernflower)
|
||||||
|
self.cmdexceptor = self.config.get('COMMANDS', 'CmdExceptor', raw=1) % (self.cmdjava, self.exceptor)
|
||||||
|
self.cmdrecomp = self.config.get('COMMANDS', 'CmdRecomp', raw=1) % self.cmdjavac
|
||||||
|
+ if self.cmdscalac: self.cmdrecompscalac = self.config.get('COMMANDS', 'CmdRecompScalac', raw=1) % self.cmdscalac
|
||||||
|
+ else: self.cmdrecompscalac = None
|
||||||
|
self.cmdstartsrv = self.config.get('COMMANDS', 'CmdStartSrv', raw=1) % self.cmdjava
|
||||||
|
self.cmdstartclt = self.config.get('COMMANDS', 'CmdStartClt', raw=1) % self.cmdjava
|
||||||
|
|
||||||
|
@@ -753,6 +762,36 @@
|
||||||
|
self.cmdjavac = '"%s"' % os.path.join(results[0], 'javac')
|
||||||
|
self.cmdjava = '"%s"' % os.path.join(results[0], 'java')
|
||||||
|
|
||||||
|
+ def checkscala(self):
|
||||||
|
+ results = []
|
||||||
|
+ if not results:
|
||||||
|
+ try:
|
||||||
|
+ # TODO: Verify at least version 2.10
|
||||||
|
+ self.runcmd('scalac -version', quiet=True)
|
||||||
|
+ results.append('')
|
||||||
|
+ except (CalledProcessError, OSError):
|
||||||
|
+ pass
|
||||||
|
+ if not results: # Stupid windows...
|
||||||
|
+ try:
|
||||||
|
+ # TODO: Verify at least version 2.10
|
||||||
|
+ self.runcmd('scalac.bat -version', quiet=True)
|
||||||
|
+ results.append('')
|
||||||
|
+ except (CalledProcessError, OSError):
|
||||||
|
+ pass
|
||||||
|
+ try:
|
||||||
|
+ self.runcmd('scala -target:jvm-1.6 -version', quiet=True)
|
||||||
|
+ results.append('')
|
||||||
|
+ except (CalledProcessError, OSError):
|
||||||
|
+ self.logger.info('"scala" does not support jvm-1.6 target, it is out of date. Ignoring')
|
||||||
|
+ results = []
|
||||||
|
+ self.cmdscalac = None
|
||||||
|
+ else:
|
||||||
|
+ if not results:
|
||||||
|
+ self.logger.warning('"scalac" is not found on the PATH. Scala files will not be recompiled')
|
||||||
|
+ self.cmdscalac = None
|
||||||
|
+ else:
|
||||||
|
+ self.cmdscalac = '"%s"' % os.path.join(results[0], 'scalac')
|
||||||
|
+
|
||||||
|
def checkjars(self, side):
|
||||||
|
jarlk = {CLIENT: self.jarclient, SERVER: self.jarserver}
|
||||||
|
md5jarlk = {CLIENT: self.md5jarclt, SERVER: self.md5jarsrv}
|
||||||
|
@@ -798,6 +837,8 @@
|
||||||
|
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
|
+ if side == SERVER and not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||||
- return False
|
+ return self.checkbins(CLIENT)
|
||||||
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))):
|
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||||
+ return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@@ -1038,6 +1079,9 @@
|
||||||
def checkbins(self, side):
|
pathbinlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||||
@@ -1029,6 +1035,10 @@
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||||
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
|
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
|
||||||
|
|
||||||
+ if side == SERVER: #Disable server because FML recombines it into client
|
|
||||||
+ self.logger.info('Server side recompiling skipped, this is normal')
|
|
||||||
+ return
|
|
||||||
+
|
+
|
||||||
|
+ if side == SERVER: #Warn about server because FML recombines it into client
|
||||||
|
+ self.logger.info('Server side recompiling might be skipped, this is normal, do not complain to FML/Forge team about server side.')
|
||||||
|
|
||||||
if not os.path.exists(pathbinlk[side]):
|
if not os.path.exists(pathbinlk[side]):
|
||||||
os.makedirs(pathbinlk[side])
|
os.makedirs(pathbinlk[side])
|
||||||
|
@@ -1051,6 +1095,29 @@
|
||||||
@@ -1041,6 +1051,7 @@
|
|
||||||
all_files = True
|
all_files = True
|
||||||
append_pattern = False
|
append_pattern = False
|
||||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
|
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
|
||||||
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=append_pattern, all_files=all_files) #FML, Add Common folder
|
+ if self.cmdrecompscalac: # Compile scala before java as scala scans java files, but not vice-versa
|
||||||
|
+ pkglistscala = pkglist[:]
|
||||||
|
+ pkglistscala.extend(filterdirs(pathsrclk[side], '*.scala', append_pattern=append_pattern, all_files=all_files))
|
||||||
|
+ dirs = ' '.join(pkglistscala)
|
||||||
|
+ classpath = os.pathsep.join(cplk[side])
|
||||||
|
+ forkcmd = self.cmdrecompscalac.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side], pkgs=dirs)
|
||||||
|
+ try:
|
||||||
|
+ self.runcmd(forkcmd, log_file=pathlog[side])
|
||||||
|
+ except CalledProcessError as ex:
|
||||||
|
+ self.logger.error('')
|
||||||
|
+ self.logger.error('== ERRORS FOUND in SCALA CODE ==')
|
||||||
|
+ self.logger.error('')
|
||||||
|
+ for line in ex.output.splitlines():
|
||||||
|
+ if line.strip():
|
||||||
|
+ if line.find("jvm-1.6") != -1:
|
||||||
|
+ self.logger.error(' === Your scala version is out of date, update to at least 2.10.0 ===')
|
||||||
|
+ if line[0] != '[' and line[0:4] != 'Note':
|
||||||
|
+ self.logger.error(line)
|
||||||
|
+ if '^' in line:
|
||||||
|
+ self.logger.error('')
|
||||||
|
+ self.logger.error('================================')
|
||||||
|
+ self.logger.error('')
|
||||||
|
+ raise
|
||||||
dirs = ' '.join(pkglist)
|
dirs = ' '.join(pkglist)
|
||||||
classpath = os.pathsep.join(cplk[side])
|
classpath = os.pathsep.join(cplk[side])
|
||||||
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
||||||
@@ -1062,7 +1073,7 @@
|
@@ -1059,7 +1126,7 @@
|
||||||
|
self.runcmd(forkcmd, log_file=pathlog[side])
|
||||||
|
except CalledProcessError as ex:
|
||||||
|
self.logger.error('')
|
||||||
|
- self.logger.error('== ERRORS FOUND ==')
|
||||||
|
+ self.logger.error('== ERRORS FOUND in JAVA CODE ==')
|
||||||
|
self.logger.error('')
|
||||||
|
for line in ex.output.splitlines():
|
||||||
|
if line.strip():
|
||||||
|
@@ -1072,7 +1139,7 @@
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def startserver(self):
|
def startserver(self):
|
||||||
- classpath = [self.binserver] + self.cpathserver
|
- classpath = [self.binserver] + self.cpathserver
|
||||||
+ classpath = [self.binserver, self.srcshared] + self.cpathserver
|
+ classpath = [self.binclient, self.srcclient] + self.cpathserver
|
||||||
classpath = [os.path.join('..', p) for p in classpath]
|
classpath = [os.path.join('..', p) for p in classpath]
|
||||||
classpath = os.pathsep.join(classpath)
|
classpath = os.pathsep.join(classpath)
|
||||||
os.chdir(self.dirjars)
|
os.chdir(self.dirjars)
|
||||||
@@ -1070,7 +1081,7 @@
|
@@ -1080,7 +1147,7 @@
|
||||||
self.runmc(forkcmd)
|
self.runmc(forkcmd)
|
||||||
|
|
||||||
def startclient(self):
|
def startclient(self):
|
||||||
- classpath = [self.binclient] + self.cpathclient
|
- classpath = [self.binclient] + self.cpathclient
|
||||||
+ classpath = [self.binclient, self.srcshared] + self.cpathclient
|
+ classpath = [self.binclient, self.srcclient] + self.cpathclient
|
||||||
classpath = [os.path.join('..', p) for p in classpath]
|
classpath = [os.path.join('..', p) for p in classpath]
|
||||||
classpath = os.pathsep.join(classpath)
|
classpath = os.pathsep.join(classpath)
|
||||||
natives = os.path.join('..', self.dirnatives)
|
natives = os.path.join('..', self.dirnatives)
|
||||||
@@ -1197,20 +1208,20 @@
|
@@ -1207,20 +1274,20 @@
|
||||||
with open(self.csvmethods, 'rb') as fh:
|
with open(self.csvmethods, 'rb') as fh:
|
||||||
methodsreader = csv.DictReader(fh)
|
methodsreader = csv.DictReader(fh)
|
||||||
for row in methodsreader:
|
for row in methodsreader:
|
||||||
@@ -90,56 +181,7 @@
|
|||||||
names['params'][row['param']] = row['name']
|
names['params'][row['param']] = row['name']
|
||||||
|
|
||||||
regexps = {
|
regexps = {
|
||||||
@@ -1240,6 +1251,11 @@
|
@@ -1354,13 +1421,13 @@
|
||||||
|
|
||||||
# HINT: We pathwalk the sources
|
|
||||||
for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
|
|
||||||
+ for cur_file in fnmatch.filter(filelist, '*.java'):
|
|
||||||
+ updatefile(os.path.normpath(os.path.join(path, cur_file)))
|
|
||||||
+
|
|
||||||
+ # FML, copy of the above, for the common folder
|
|
||||||
+ for path, _, filelist in os.walk(self.srcshared, followlinks=True):
|
|
||||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
|
||||||
updatefile(os.path.normpath(os.path.join(path, cur_file)))
|
|
||||||
return True
|
|
||||||
@@ -1322,12 +1338,14 @@
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
|
|
||||||
strip_comments(pathsrclk[side])
|
|
||||||
+ strip_comments(self.srcshared)
|
|
||||||
|
|
||||||
def process_cleanup(self, side):
|
|
||||||
"""Do lots of random cleanups including stripping comments, trailing whitespace and extra blank lines"""
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
|
|
||||||
src_cleanup(pathsrclk[side], fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
|
|
||||||
+ src_cleanup(self.srcshared, fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
|
|
||||||
|
|
||||||
def process_javadoc(self, side):
|
|
||||||
"""Add CSV descriptions to methods and fields as javadoc"""
|
|
||||||
@@ -1336,6 +1354,21 @@
|
|
||||||
if not self.has_doc_csv:
|
|
||||||
self.logger.warning('!! javadoc disabled due to no csvs !!')
|
|
||||||
return False
|
|
||||||
+
|
|
||||||
+ #FML Recall this function on the common folder
|
|
||||||
+ #Potential bug: If this is called without a subsiquent rename call, will cause double comments
|
|
||||||
+ if pathsrclk[side] != self.srcshared:
|
|
||||||
+ if side == CLIENT:
|
|
||||||
+ tmp = self.srcclient
|
|
||||||
+ self.srcclient = self.srcshared
|
|
||||||
+ self.process_javadoc(side)
|
|
||||||
+ self.srcclient = tmp
|
|
||||||
+ else:
|
|
||||||
+ tmp = self.srcserver
|
|
||||||
+ self.srcserver = self.srcshared
|
|
||||||
+ self.process_javadoc(side)
|
|
||||||
+ self.srcserver = tmp
|
|
||||||
+
|
|
||||||
|
|
||||||
#HINT: We read the relevant CSVs
|
|
||||||
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
|
|
||||||
@@ -1344,13 +1377,13 @@
|
|
||||||
methods = {}
|
methods = {}
|
||||||
for row in methodsreader:
|
for row in methodsreader:
|
||||||
#HINT: Only include methods that have a non-empty description
|
#HINT: Only include methods that have a non-empty description
|
||||||
@@ -155,13 +197,7 @@
|
|||||||
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
||||||
|
|
||||||
regexps = {
|
regexps = {
|
||||||
@@ -1422,12 +1455,13 @@
|
@@ -1437,7 +1504,7 @@
|
||||||
|
|
||||||
# HINT: We create the list of source directories based on the list of packages
|
|
||||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=True)
|
|
||||||
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=True) #FML, Add Common folder
|
|
||||||
dirs = ' '.join(pkglist)
|
|
||||||
forkcmd = self.cmdastyle.format(classes=dirs, conffile=self.astyleconf)
|
|
||||||
self.runcmd(forkcmd)
|
self.runcmd(forkcmd)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -170,7 +206,7 @@
|
|||||||
if not reobf:
|
if not reobf:
|
||||||
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
|
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
|
||||||
else:
|
else:
|
||||||
@@ -1442,6 +1476,9 @@
|
@@ -1452,6 +1519,9 @@
|
||||||
class_path = ''
|
class_path = ''
|
||||||
else:
|
else:
|
||||||
class_path += '/'
|
class_path += '/'
|
||||||
@@ -180,7 +216,40 @@
|
|||||||
for class_file in fnmatch.filter(filelist, '*.class'):
|
for class_file in fnmatch.filter(filelist, '*.class'):
|
||||||
class_name = class_path + os.path.splitext(class_file)[0]
|
class_name = class_path + os.path.splitext(class_file)[0]
|
||||||
bin_file = os.path.normpath(os.path.join(path, class_file))
|
bin_file = os.path.normpath(os.path.join(path, class_file))
|
||||||
@@ -1594,6 +1631,9 @@
|
@@ -1548,6 +1618,8 @@
|
||||||
|
if not os.path.exists(outpathlk[side]):
|
||||||
|
os.makedirs(outpathlk[side])
|
||||||
|
|
||||||
|
+ reserved = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9']
|
||||||
|
+
|
||||||
|
# HINT: We extract the modified class files
|
||||||
|
with closing(zipfile.ZipFile(jarlk[side])) as zipjar:
|
||||||
|
for in_class in trgclasses:
|
||||||
|
@@ -1561,6 +1633,23 @@
|
||||||
|
out_class = out_class.replace(self.nullpkg, '')
|
||||||
|
if out_class[0] == '/':
|
||||||
|
out_class = out_class[1:]
|
||||||
|
+
|
||||||
|
+ rename = False
|
||||||
|
+ for res in reserved:
|
||||||
|
+ if out_class.upper().startswith(res):
|
||||||
|
+ rename = True
|
||||||
|
+ break
|
||||||
|
+
|
||||||
|
+ if rename:
|
||||||
|
+ try:
|
||||||
|
+ f = open(os.path.join(outpathlk[side], '_' + out_class), 'wb')
|
||||||
|
+ f.write(zipjar.read(out_class))
|
||||||
|
+ f.close()
|
||||||
|
+ self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], '_' + out_class)
|
||||||
|
+ except IOError:
|
||||||
|
+ self.logger.error('* File %s failed extracting for %s', out_class, in_class)
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
try:
|
||||||
|
zipjar.extract(out_class, outpathlk[side])
|
||||||
|
self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class)
|
||||||
|
@@ -1607,6 +1696,9 @@
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for entry in newfiles:
|
for entry in newfiles:
|
||||||
@@ -190,7 +259,7 @@
|
|||||||
if entry[3] == 'U':
|
if entry[3] == 'U':
|
||||||
self.logger.info('Retrieving file from server : %s', entry[0])
|
self.logger.info('Retrieving file from server : %s', entry[0])
|
||||||
cur_file = os.path.normpath(entry[0])
|
cur_file = os.path.normpath(entry[0])
|
||||||
@@ -1614,6 +1654,9 @@
|
@@ -1627,6 +1719,9 @@
|
||||||
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
|
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
|
||||||
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
|
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
|
||||||
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
||||||
@@ -200,28 +269,3 @@
|
|||||||
|
|
||||||
# HINT: We need a table for the old md5 and the new ones
|
# HINT: We need a table for the old md5 and the new ones
|
||||||
md5table = {}
|
md5table = {}
|
||||||
@@ -1646,6 +1689,7 @@
|
|
||||||
# HINT: We extract the source files for the modified class files
|
|
||||||
for in_class in trgclasses:
|
|
||||||
src_file = os.path.normpath(os.path.join(src[side], in_class + '.java'))
|
|
||||||
+ cmn_file = os.path.normpath(os.path.join(self.srcshared, in_class + '.java'))
|
|
||||||
dest_file = os.path.normpath(os.path.join(outpathlk[side], in_class + '.java'))
|
|
||||||
if os.path.isfile(src_file):
|
|
||||||
if not os.path.exists(os.path.dirname(dest_file)):
|
|
||||||
@@ -1655,4 +1699,15 @@
|
|
||||||
self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
|
||||||
except IOError:
|
|
||||||
self.logger.error('* File %s copy failed', in_class)
|
|
||||||
-
|
|
||||||
+ elif os.path.isfile(cmn_file):
|
|
||||||
+ if not os.path.exists(os.path.dirname(dest_file)):
|
|
||||||
+ os.makedirs(os.path.dirname(dest_file))
|
|
||||||
+ try:
|
|
||||||
+ shutil.copyfile(cmn_file, dest_file)
|
|
||||||
+ self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
|
||||||
+ except IOError:
|
|
||||||
+ self.logger.error('* File %s copy failed', in_class)
|
|
||||||
+
|
|
||||||
+def commands_sanity_check():
|
|
||||||
+ print 'Commands patch applied successfully'
|
|
||||||
+
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
@@ -23,7 +35,7 @@ public @interface BukkitPluginRef
|
|||||||
* specification. If this is a bukkit enabled environment the field annotated by this
|
* specification. If this is a bukkit enabled environment the field annotated by this
|
||||||
* will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by
|
* will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by
|
||||||
* reflectively calling the "getModProxy" method on the bukkit plugin instance.
|
* reflectively calling the "getModProxy" method on the bukkit plugin instance.
|
||||||
* @return
|
* @return The name of the plugin which we will inject into this field
|
||||||
*/
|
*/
|
||||||
String value();
|
String value();
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A marker interface for retrieving a proxy to a bukkit plugin.
|
* A marker interface for retrieving a proxy to a bukkit plugin.
|
||||||
* Fields associated with {@link BukkitPluginRef} annotations should be should probably
|
* Fields associated with {@link BukkitPluginRef} annotations should
|
||||||
* declare this type and cast down if the target is available (not null)
|
* declare this type and cast down if the target is available (not null)
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
|
|
||||||
|
public class CertificateHelper {
|
||||||
|
|
||||||
|
private static final String HEXES = "0123456789abcdef";
|
||||||
|
|
||||||
|
public static String getFingerprint(Certificate certificate)
|
||||||
|
{
|
||||||
|
if (certificate == null)
|
||||||
|
{
|
||||||
|
return "NO VALID CERTIFICATE FOUND";
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||||
|
byte[] der = certificate.getEncoded();
|
||||||
|
md.update(der);
|
||||||
|
byte[] digest = md.digest();
|
||||||
|
return hexify(digest);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFingerprint(ByteBuffer buffer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MessageDigest digest = MessageDigest.getInstance("SHA-1");
|
||||||
|
digest.update(buffer);
|
||||||
|
byte[] chksum = digest.digest();
|
||||||
|
return hexify(chksum);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String hexify(byte[] chksum)
|
||||||
|
{
|
||||||
|
final StringBuilder hex = new StringBuilder( 2 * chksum.length );
|
||||||
|
for ( final byte b : chksum ) {
|
||||||
|
hex.append(HEXES.charAt((b & 0xF0) >> 4))
|
||||||
|
.append(HEXES.charAt((b & 0x0F)));
|
||||||
|
}
|
||||||
|
return hex.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -138,4 +151,10 @@ public class DummyModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* Contributors:
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* cpw - implementation
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@@ -18,29 +17,34 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
|
import net.minecraft.crash.CrashReportCategory;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet131MapData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.CrashReport;
|
import net.minecraft.server.ServerListenThread;
|
||||||
import net.minecraft.src.DedicatedServer;
|
import net.minecraft.server.ThreadMinecraftServer;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
import net.minecraft.world.storage.SaveHandler;
|
||||||
import net.minecraft.src.NBTBase;
|
import net.minecraft.world.storage.WorldInfo;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import net.minecraft.src.SaveHandler;
|
|
||||||
import net.minecraft.src.ServerListenThread;
|
|
||||||
import net.minecraft.src.ThreadMinecraftServer;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableList.Builder;
|
import com.google.common.collect.ImmutableList.Builder;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.MapDifference;
|
||||||
import com.google.common.collect.MapMaker;
|
import com.google.common.collect.MapMaker;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@@ -48,7 +52,9 @@ import com.google.common.collect.Sets;
|
|||||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
import cpw.mods.fml.common.registry.TickRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.server.FMLServerHandler;
|
import cpw.mods.fml.server.FMLServerHandler;
|
||||||
|
|
||||||
|
|
||||||
@@ -89,10 +95,10 @@ public class FMLCommonHandler
|
|||||||
public void beginLoading(IFMLSidedHandler handler)
|
public void beginLoading(IFMLSidedHandler handler)
|
||||||
{
|
{
|
||||||
sidedDelegate = handler;
|
sidedDelegate = handler;
|
||||||
FMLLog.info("Attempting early MinecraftForge initialization");
|
FMLLog.log("MinecraftForge", Level.INFO, "Attempting early MinecraftForge initialization");
|
||||||
callForgeMethod("initialize");
|
callForgeMethod("initialize");
|
||||||
callForgeMethod("registerCrashCallable");
|
callForgeMethod("registerCrashCallable");
|
||||||
FMLLog.info("Completed early MinecraftForge initialization");
|
FMLLog.log("MinecraftForge", Level.INFO, "Completed early MinecraftForge initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rescheduleTicks(Side side)
|
public void rescheduleTicks(Side side)
|
||||||
@@ -110,7 +116,7 @@ public class FMLCommonHandler
|
|||||||
for (IScheduledTickHandler ticker : scheduledTicks)
|
for (IScheduledTickHandler ticker : scheduledTicks)
|
||||||
{
|
{
|
||||||
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
|
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
|
||||||
ticksToRun.removeAll(EnumSet.complementOf(ticks));
|
ticksToRun.retainAll(ticks);
|
||||||
if (!ticksToRun.isEmpty())
|
if (!ticksToRun.isEmpty())
|
||||||
{
|
{
|
||||||
ticker.tickStart(ticksToRun, data);
|
ticker.tickStart(ticksToRun, data);
|
||||||
@@ -129,7 +135,7 @@ public class FMLCommonHandler
|
|||||||
for (IScheduledTickHandler ticker : scheduledTicks)
|
for (IScheduledTickHandler ticker : scheduledTicks)
|
||||||
{
|
{
|
||||||
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
|
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
|
||||||
ticksToRun.removeAll(EnumSet.complementOf(ticks));
|
ticksToRun.retainAll(ticks);
|
||||||
if (!ticksToRun.isEmpty())
|
if (!ticksToRun.isEmpty())
|
||||||
{
|
{
|
||||||
ticker.tickEnd(ticksToRun, data);
|
ticker.tickEnd(ticksToRun, data);
|
||||||
@@ -154,7 +160,7 @@ public class FMLCommonHandler
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the forge mod loader logging instance (goes to the forgemodloader log file)
|
* Get the forge mod loader logging instance (goes to the forgemodloader log file)
|
||||||
* @return
|
* @return The log instance for the FML log file
|
||||||
*/
|
*/
|
||||||
public Logger getFMLLogger()
|
public Logger getFMLLogger()
|
||||||
{
|
{
|
||||||
@@ -186,7 +192,7 @@ public class FMLCommonHandler
|
|||||||
*/
|
*/
|
||||||
public void raiseException(Throwable exception, String message, boolean stopGame)
|
public void raiseException(Throwable exception, String message, boolean stopGame)
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception);
|
FMLLog.log(Level.SEVERE, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
|
||||||
if (stopGame)
|
if (stopGame)
|
||||||
{
|
{
|
||||||
getSidedDelegate().haltGame(message,exception);
|
getSidedDelegate().haltGame(message,exception);
|
||||||
@@ -228,19 +234,20 @@ public class FMLCommonHandler
|
|||||||
{
|
{
|
||||||
Builder brd = ImmutableList.<String>builder();
|
Builder brd = ImmutableList.<String>builder();
|
||||||
brd.add(Loader.instance().getMCVersionString());
|
brd.add(Loader.instance().getMCVersionString());
|
||||||
|
brd.add(Loader.instance().getMCPVersionString());
|
||||||
brd.add("FML v"+Loader.instance().getFMLVersionString());
|
brd.add("FML v"+Loader.instance().getFMLVersionString());
|
||||||
String forgeBranding = (String) callForgeMethod("getBrandingVersion");
|
String forgeBranding = (String) callForgeMethod("getBrandingVersion");
|
||||||
if (!Strings.isNullOrEmpty(forgeBranding))
|
if (!Strings.isNullOrEmpty(forgeBranding))
|
||||||
{
|
{
|
||||||
brd.add(forgeBranding);
|
brd.add(forgeBranding);
|
||||||
}
|
}
|
||||||
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
|
if (sidedDelegate!=null)
|
||||||
try {
|
{
|
||||||
Properties props=new Properties();
|
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
|
||||||
props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
|
}
|
||||||
brd.add(props.getProperty("fmlbranding"));
|
if (Loader.instance().getFMLBrandingProperties().containsKey("fmlbranding"))
|
||||||
} catch (Exception ex) {
|
{
|
||||||
// Ignore - no branding file found
|
brd.add(Loader.instance().getFMLBrandingProperties().get("fmlbranding"));
|
||||||
}
|
}
|
||||||
int tModCount = Loader.instance().getModList().size();
|
int tModCount = Loader.instance().getModList().size();
|
||||||
int aModCount = Loader.instance().getActiveModList().size();
|
int aModCount = Loader.instance().getActiveModList().size();
|
||||||
@@ -297,9 +304,14 @@ public class FMLCommonHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleServerStarting(MinecraftServer server)
|
public boolean handleServerAboutToStart(MinecraftServer server)
|
||||||
{
|
{
|
||||||
Loader.instance().serverStarting(server);
|
return Loader.instance().serverAboutToStart(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean handleServerStarting(MinecraftServer server)
|
||||||
|
{
|
||||||
|
return Loader.instance().serverStarting(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleServerStarted()
|
public void handleServerStarted()
|
||||||
@@ -382,11 +394,11 @@ public class FMLCommonHandler
|
|||||||
crashCallables.add(callable);
|
crashCallables.add(callable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enhanceCrashReport(CrashReport crashReport)
|
public void enhanceCrashReport(CrashReport crashReport, CrashReportCategory category)
|
||||||
{
|
{
|
||||||
for (ICrashCallable call: crashCallables)
|
for (ICrashCallable call: crashCallables)
|
||||||
{
|
{
|
||||||
crashReport.func_71500_a(call.getLabel(), call);
|
category.func_71500_a(call.getLabel(), call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,4 +448,39 @@ public class FMLCommonHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldServerBeKilledQuietly()
|
||||||
|
{
|
||||||
|
if (sidedDelegate == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return sidedDelegate.shouldServerShouldBeKilledQuietly();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
|
||||||
|
{
|
||||||
|
sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleServerStopped()
|
||||||
|
{
|
||||||
|
Loader.instance().serverStopped();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModName()
|
||||||
|
{
|
||||||
|
List<String> modNames = Lists.newArrayListWithExpectedSize(3);
|
||||||
|
modNames.add("fml");
|
||||||
|
if (!noForge)
|
||||||
|
{
|
||||||
|
modNames.add("forge");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Loader.instance().getFMLBrandingProperties().containsKey("snooperbranding"))
|
||||||
|
{
|
||||||
|
modNames.add(Loader.instance().getFMLBrandingProperties().get("snooperbranding"));
|
||||||
|
}
|
||||||
|
return Joiner.on(',').join(modNames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.src.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.src.NBTTagString;
|
import net.minecraft.world.storage.SaveHandler;
|
||||||
import net.minecraft.src.SaveHandler;
|
import net.minecraft.world.storage.WorldInfo;
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
import com.google.common.collect.MapMaker;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
@@ -50,8 +50,8 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
|
|||||||
"to cooperate and provide a good modding environment. " +
|
"to cooperate and provide a good modding environment. " +
|
||||||
"The mod loading system is compatible with ModLoader, all your ModLoader " +
|
"The mod loading system is compatible with ModLoader, all your ModLoader " +
|
||||||
"mods should work.";
|
"mods should work.";
|
||||||
meta.url="https://github.com/cpw/FML/wiki";
|
meta.url="https://github.com/MinecraftForge/FML/wiki";
|
||||||
meta.updateUrl="https://github.com/cpw/FML/wiki";
|
meta.updateUrl="https://github.com/MinecraftForge/FML/wiki";
|
||||||
meta.screenshots=new String[0];
|
meta.screenshots=new String[0];
|
||||||
meta.logoFile="";
|
meta.logoFile="";
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,9 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
|
|||||||
list.func_74742_a(mod);
|
list.func_74742_a(mod);
|
||||||
}
|
}
|
||||||
fmlData.func_74782_a("ModList", list);
|
fmlData.func_74782_a("ModList", list);
|
||||||
|
NBTTagList itemList = new NBTTagList();
|
||||||
|
GameData.writeItemData(itemList);
|
||||||
|
fmlData.func_74782_a("ModItemData", itemList);
|
||||||
return fmlData;
|
return fmlData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,14 +95,32 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
|
|||||||
ModContainer container = Loader.instance().getIndexedModList().get(modId);
|
ModContainer container = Loader.instance().getIndexedModList().get(modId);
|
||||||
if (container == null)
|
if (container == null)
|
||||||
{
|
{
|
||||||
FMLLog.severe("This world was saved with mod %s which appears to be missing, things may not work well", modId);
|
FMLLog.log("fml.ModTracker", Level.SEVERE, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!modVersion.equals(container.getVersion()))
|
if (!modVersion.equals(container.getVersion()))
|
||||||
{
|
{
|
||||||
FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
|
FMLLog.log("fml.ModTracker", Level.INFO, "This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (tag.func_74764_b("ModItemData"))
|
||||||
|
{
|
||||||
|
NBTTagList modList = tag.func_74761_m("ModItemData");
|
||||||
|
Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
|
||||||
|
GameData.validateWorldSave(worldSaveItems);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameData.validateWorldSave(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
Certificate[] certificates = getClass().getProtectionDomain().getCodeSource().getCertificates();
|
||||||
|
return certificates != null ? certificates[0] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -7,11 +19,21 @@ public class FMLLog
|
|||||||
{
|
{
|
||||||
private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;
|
private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;
|
||||||
|
|
||||||
|
public static void log(String logChannel, Level level, String format, Object... data)
|
||||||
|
{
|
||||||
|
coreLog.log(logChannel, level, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
public static void log(Level level, String format, Object... data)
|
public static void log(Level level, String format, Object... data)
|
||||||
{
|
{
|
||||||
coreLog.log(level, format, data);
|
coreLog.log(level, format, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void log(String logChannel, Level level, Throwable ex, String format, Object... data)
|
||||||
|
{
|
||||||
|
coreLog.log(logChannel, level, ex, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
public static void log(Level level, Throwable ex, String format, Object... data)
|
public static void log(Level level, Throwable ex, String format, Object... data)
|
||||||
{
|
{
|
||||||
coreLog.log(level, ex, format, data);
|
coreLog.log(level, ex, format, data);
|
||||||
@@ -50,4 +72,9 @@ public class FMLLog
|
|||||||
{
|
{
|
||||||
return coreLog.getLogger();
|
return coreLog.getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void makeLog(String logChannel)
|
||||||
|
{
|
||||||
|
coreLog.makeLog(logChannel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import java.lang.annotation.Annotation;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -29,11 +30,16 @@ import java.util.zip.ZipFile;
|
|||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableList.Builder;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Iterators;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.SetMultimap;
|
import com.google.common.collect.SetMultimap;
|
||||||
@@ -46,11 +52,16 @@ import cpw.mods.fml.common.Mod.Metadata;
|
|||||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
||||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLEvent;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||||
import cpw.mods.fml.common.event.FMLStateEvent;
|
import cpw.mods.fml.common.event.FMLStateEvent;
|
||||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||||
@@ -76,26 +87,40 @@ public class FMLModContainer implements ModContainer
|
|||||||
private DefaultArtifactVersion processedVersion;
|
private DefaultArtifactVersion processedVersion;
|
||||||
private boolean isNetworkMod;
|
private boolean isNetworkMod;
|
||||||
|
|
||||||
private static final BiMap<Class<? extends FMLStateEvent>, Class<? extends Annotation>> modAnnotationTypes = ImmutableBiMap.<Class<? extends FMLStateEvent>, Class<? extends Annotation>>builder()
|
private static final BiMap<Class<? extends FMLEvent>, Class<? extends Annotation>> modAnnotationTypes = ImmutableBiMap.<Class<? extends FMLEvent>, Class<? extends Annotation>>builder()
|
||||||
.put(FMLPreInitializationEvent.class, Mod.PreInit.class)
|
.put(FMLPreInitializationEvent.class, Mod.PreInit.class)
|
||||||
.put(FMLInitializationEvent.class, Mod.Init.class)
|
.put(FMLInitializationEvent.class, Mod.Init.class)
|
||||||
.put(FMLPostInitializationEvent.class, Mod.PostInit.class)
|
.put(FMLPostInitializationEvent.class, Mod.PostInit.class)
|
||||||
|
.put(FMLServerAboutToStartEvent.class, Mod.ServerAboutToStart.class)
|
||||||
.put(FMLServerStartingEvent.class, Mod.ServerStarting.class)
|
.put(FMLServerStartingEvent.class, Mod.ServerStarting.class)
|
||||||
.put(FMLServerStartedEvent.class, Mod.ServerStarted.class)
|
.put(FMLServerStartedEvent.class, Mod.ServerStarted.class)
|
||||||
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
|
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
|
||||||
|
.put(FMLServerStoppedEvent.class, Mod.ServerStopped.class)
|
||||||
|
.put(IMCEvent.class,Mod.IMCCallback.class)
|
||||||
|
.put(FMLFingerprintViolationEvent.class, Mod.FingerprintWarning.class)
|
||||||
.build();
|
.build();
|
||||||
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLStateEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
|
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
|
||||||
private String annotationDependencies;
|
private String annotationDependencies;
|
||||||
private VersionRange minecraftAccepted;
|
private VersionRange minecraftAccepted;
|
||||||
|
private boolean fingerprintNotPresent;
|
||||||
|
private Set<String> sourceFingerprints;
|
||||||
|
private Certificate certificate;
|
||||||
|
private String modLanguage;
|
||||||
|
private ILanguageAdapter languageAdapter;
|
||||||
|
|
||||||
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
||||||
{
|
{
|
||||||
this.className = className;
|
this.className = className;
|
||||||
this.source = modSource;
|
this.source = modSource;
|
||||||
this.descriptor = modDescriptor;
|
this.descriptor = modDescriptor;
|
||||||
|
this.modLanguage = (String) modDescriptor.get("modLanguage");
|
||||||
|
this.languageAdapter = "scala".equals(modLanguage) ? new ILanguageAdapter.ScalaAdapter() : new ILanguageAdapter.JavaAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ILanguageAdapter getLanguageAdapter()
|
||||||
|
{
|
||||||
|
return languageAdapter;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getModId()
|
public String getModId()
|
||||||
{
|
{
|
||||||
@@ -146,15 +171,15 @@ public class FMLModContainer implements ModContainer
|
|||||||
modMetadata.requiredMods = requirements;
|
modMetadata.requiredMods = requirements;
|
||||||
modMetadata.dependencies = dependencies;
|
modMetadata.dependencies = dependencies;
|
||||||
modMetadata.dependants = dependants;
|
modMetadata.dependants = dependants;
|
||||||
FMLLog.finest("Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
|
FMLLog.log(getModId(), Level.FINEST, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FMLLog.finest("Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
|
FMLLog.log(getModId(), Level.FINEST, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(modMetadata.name))
|
if (Strings.isNullOrEmpty(modMetadata.name))
|
||||||
{
|
{
|
||||||
FMLLog.info("Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId());
|
FMLLog.log(getModId(), Level.INFO,"Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId());
|
||||||
modMetadata.name = getModId();
|
modMetadata.name = getModId();
|
||||||
}
|
}
|
||||||
internalVersion = (String) descriptor.get("version");
|
internalVersion = (String) descriptor.get("version");
|
||||||
@@ -164,18 +189,18 @@ public class FMLModContainer implements ModContainer
|
|||||||
if (versionProps != null)
|
if (versionProps != null)
|
||||||
{
|
{
|
||||||
internalVersion = versionProps.getProperty(getModId()+".version");
|
internalVersion = versionProps.getProperty(getModId()+".version");
|
||||||
FMLLog.fine("Found version %s for mod %s in version.properties, using", internalVersion, getModId());
|
FMLLog.log(getModId(), Level.FINE, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
|
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
|
||||||
{
|
{
|
||||||
FMLLog.warning("Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
|
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
|
||||||
internalVersion = modMetadata.version;
|
internalVersion = modMetadata.version;
|
||||||
}
|
}
|
||||||
if (Strings.isNullOrEmpty(internalVersion))
|
if (Strings.isNullOrEmpty(internalVersion))
|
||||||
{
|
{
|
||||||
FMLLog.warning("Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
|
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
|
||||||
modMetadata.version = internalVersion = "1.0";
|
modMetadata.version = internalVersion = "1.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +219,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FMLLog.fine("Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
|
FMLLog.log(getModId(), Level.FINE,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
|
||||||
Properties version = null;
|
Properties version = null;
|
||||||
if (getSource().isFile())
|
if (getSource().isFile())
|
||||||
{
|
{
|
||||||
@@ -223,7 +248,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Throwables.propagateIfPossible(e);
|
Throwables.propagateIfPossible(e);
|
||||||
FMLLog.fine("Failed to find a usable version.properties file");
|
FMLLog.log(getModId(), Level.FINEST, "Failed to find a usable version.properties file");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +300,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
if (this.enabled)
|
if (this.enabled)
|
||||||
{
|
{
|
||||||
FMLLog.fine("Enabling mod %s", getModId());
|
FMLLog.log(getModId(), Level.FINE, "Enabling mod %s", getModId());
|
||||||
this.eventBus = bus;
|
this.eventBus = bus;
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
@@ -306,7 +331,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FMLLog.severe("The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes));
|
FMLLog.log(getModId(), Level.SEVERE,"The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,13 +357,6 @@ public class FMLModContainer implements ModContainer
|
|||||||
return mc.getMetadata();
|
return mc.getMetadata();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO
|
|
||||||
// for (Object o : annotations.get(Block.class))
|
|
||||||
// {
|
|
||||||
// Field f = (Field) o;
|
|
||||||
// f.set(modInstance, GameRegistry.buildBlock(this, f.getType(), f.getAnnotation(Block.class)));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseSimpleFieldAnnotation(SetMultimap<String, ASMData> annotations, String annotationClassName, Function<ModContainer, Object> retreiver) throws IllegalAccessException
|
private void parseSimpleFieldAnnotation(SetMultimap<String, ASMData> annotations, String annotationClassName, Function<ModContainer, Object> retreiver) throws IllegalAccessException
|
||||||
@@ -377,7 +395,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Throwables.propagateIfPossible(e);
|
Throwables.propagateIfPossible(e);
|
||||||
FMLLog.log(Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
|
FMLLog.log(getModId(), Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f != null)
|
if (f != null)
|
||||||
@@ -388,7 +406,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
target = modInstance;
|
target = modInstance;
|
||||||
if (!modInstance.getClass().equals(clz))
|
if (!modInstance.getClass().equals(clz))
|
||||||
{
|
{
|
||||||
FMLLog.warning("Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
|
FMLLog.log(getModId(), Level.WARNING, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,13 +423,52 @@ public class FMLModContainer implements ModContainer
|
|||||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
ModClassLoader modClassLoader = event.getModClassLoader();
|
||||||
modClassLoader.addFile(source);
|
modClassLoader.addFile(source);
|
||||||
Class<?> clazz = Class.forName(className, true, modClassLoader);
|
Class<?> clazz = Class.forName(className, true, modClassLoader);
|
||||||
ASMDataTable asmHarvestedAnnotations = event.getASMHarvestedData();
|
|
||||||
// TODO
|
Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
|
||||||
asmHarvestedAnnotations.getAnnotationsFor(this);
|
int len = 0;
|
||||||
|
if (certificates != null)
|
||||||
|
{
|
||||||
|
len = certificates.length;
|
||||||
|
}
|
||||||
|
Builder<String> certBuilder = ImmutableList.<String>builder();
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
certBuilder.add(CertificateHelper.getFingerprint(certificates[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImmutableList<String> certList = certBuilder.build();
|
||||||
|
sourceFingerprints = ImmutableSet.copyOf(certList);
|
||||||
|
|
||||||
|
String expectedFingerprint = (String) descriptor.get("certificateFingerprint");
|
||||||
|
|
||||||
|
fingerprintNotPresent = true;
|
||||||
|
|
||||||
|
if (expectedFingerprint != null && !expectedFingerprint.isEmpty())
|
||||||
|
{
|
||||||
|
if (!sourceFingerprints.contains(expectedFingerprint))
|
||||||
|
{
|
||||||
|
Level warnLevel = Level.SEVERE;
|
||||||
|
if (source.isDirectory())
|
||||||
|
{
|
||||||
|
warnLevel = Level.FINER;
|
||||||
|
}
|
||||||
|
FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
certificate = certificates[certList.indexOf(expectedFingerprint)];
|
||||||
|
fingerprintNotPresent = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
annotations = gatherAnnotations(clazz);
|
annotations = gatherAnnotations(clazz);
|
||||||
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData());
|
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData());
|
||||||
modInstance = clazz.newInstance();
|
modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader);
|
||||||
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
|
if (fingerprintNotPresent)
|
||||||
|
{
|
||||||
|
eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint));
|
||||||
|
}
|
||||||
|
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), getLanguageAdapter());
|
||||||
processFieldAnnotations(event.getASMHarvestedData());
|
processFieldAnnotations(event.getASMHarvestedData());
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
@@ -422,7 +479,7 @@ public class FMLModContainer implements ModContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handleModStateEvent(FMLStateEvent event)
|
public void handleModStateEvent(FMLEvent event)
|
||||||
{
|
{
|
||||||
Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass());
|
Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass());
|
||||||
if (annotation == null)
|
if (annotation == null)
|
||||||
@@ -476,4 +533,16 @@ public class FMLModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
return minecraftAccepted;
|
return minecraftAccepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return certificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "FMLMod:"+getModId()+"{"+getVersion()+"}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
|
public interface IASMHook {
|
||||||
|
/**
|
||||||
|
* Inject the {@link Mod} class node into this instance. This allows retrieval from custom
|
||||||
|
* attributes or other artifacts in your mod class
|
||||||
|
*
|
||||||
|
* @param modClassNode The mod class
|
||||||
|
* @return optionally some code generated classes that will be injected into the classloader
|
||||||
|
*/
|
||||||
|
ClassNode[] inject(ClassNode modClassNode);
|
||||||
|
/**
|
||||||
|
* Allow mods to manipulate classes loaded from this {@link Mod}'s jar file. The {@link Mod}
|
||||||
|
* class is always guaranteed to be called first.
|
||||||
|
* The node state should be changed in place.
|
||||||
|
*
|
||||||
|
* @param node The class being loaded
|
||||||
|
*/
|
||||||
|
void modifyClass(String className, ClassNode node);
|
||||||
|
}
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a crafting handler for the mod container to call
|
* Return a crafting handler for the mod container to call
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
|
|
||||||
|
|
||||||
public interface IDispenseHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Return -1 if you don't want to dispense anything. the other values seem to have specific meanings
|
|
||||||
* to blockdispenser.
|
|
||||||
*
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVelocity
|
|
||||||
* @param zVelocity
|
|
||||||
* @param world
|
|
||||||
* @param item
|
|
||||||
* @param random
|
|
||||||
* @param entX
|
|
||||||
* @param entY
|
|
||||||
* @param entZ
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
int dispense(double x, double y, double z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IDispenserHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Called to dispense an entity
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVelocity
|
|
||||||
* @param zVelocity
|
|
||||||
* @param world
|
|
||||||
* @param item
|
|
||||||
* @param random
|
|
||||||
* @param entX
|
|
||||||
* @param entY
|
|
||||||
* @param entZ
|
|
||||||
*/
|
|
||||||
int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
public interface IFMLHandledException
|
public interface IFMLHandledException
|
||||||
|
|||||||
@@ -1,16 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.MapDifference;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.Packet131MapData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public interface IFMLSidedHandler
|
public interface IFMLSidedHandler
|
||||||
{
|
{
|
||||||
@@ -41,4 +58,8 @@ public interface IFMLSidedHandler
|
|||||||
void setClientCompatibilityLevel(byte compatibilityLevel);
|
void setClientCompatibilityLevel(byte compatibilityLevel);
|
||||||
|
|
||||||
byte getClientCompatibilityLevel();
|
byte getClientCompatibilityLevel();
|
||||||
|
|
||||||
|
boolean shouldServerShouldBeKilledQuietly();
|
||||||
|
|
||||||
|
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IFuelHandler
|
public interface IFuelHandler
|
||||||
{
|
{
|
||||||
int getBurnTime(ItemStack fuel);
|
int getBurnTime(ItemStack fuel);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public interface ILanguageAdapter {
|
||||||
|
public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader) throws Exception;
|
||||||
|
public boolean supportsStatics();
|
||||||
|
public void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException;
|
||||||
|
|
||||||
|
public static class ScalaAdapter implements ILanguageAdapter {
|
||||||
|
@Override
|
||||||
|
public Object getNewInstance(FMLModContainer container, Class<?> scalaObjectClass, ClassLoader classLoader) throws Exception
|
||||||
|
{
|
||||||
|
Class<?> sObjectClass = Class.forName(scalaObjectClass.getName()+"$",true,classLoader);
|
||||||
|
return sObjectClass.getField("MODULE$").get(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsStatics()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
|
||||||
|
{
|
||||||
|
Field field = proxyTarget.getField("INSTANCE");
|
||||||
|
Object scalaObject = field.get(null);
|
||||||
|
target.set(scalaObject, proxy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class JavaAdapter implements ILanguageAdapter {
|
||||||
|
@Override
|
||||||
|
public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader) throws Exception
|
||||||
|
{
|
||||||
|
return objectClass.newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsStatics()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException,
|
||||||
|
SecurityException
|
||||||
|
{
|
||||||
|
target.set(null, proxy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public interface IPickupNotifier
|
public interface IPickupNotifier
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cpw
|
* @author cpw
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
public interface IScheduledTickHandler extends ITickHandler
|
public interface IScheduledTickHandler extends ITickHandler
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.IChunkProvider;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called back during world generation.
|
* This is called back during world generation.
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -129,4 +142,10 @@ public class InjectedModContainer implements ModContainer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return wrappedContainer.getSigningCertificate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -5,6 +17,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
@@ -19,6 +32,7 @@ import com.google.common.eventbus.EventBus;
|
|||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
|
import cpw.mods.fml.common.event.FMLEvent;
|
||||||
import cpw.mods.fml.common.event.FMLLoadEvent;
|
import cpw.mods.fml.common.event.FMLLoadEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLStateEvent;
|
import cpw.mods.fml.common.event.FMLStateEvent;
|
||||||
@@ -59,14 +73,16 @@ public class LoadController
|
|||||||
boolean isActive = mod.registerBus(bus, this);
|
boolean isActive = mod.registerBus(bus, this);
|
||||||
if (isActive)
|
if (isActive)
|
||||||
{
|
{
|
||||||
FMLLog.fine("Activating mod %s", mod.getModId());
|
Level level = Logger.getLogger(mod.getModId()).getLevel();
|
||||||
|
FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level);
|
||||||
|
FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId());
|
||||||
activeModList.add(mod);
|
activeModList.add(mod);
|
||||||
modStates.put(mod.getModId(), ModState.UNLOADED);
|
modStates.put(mod.getModId(), ModState.UNLOADED);
|
||||||
eventBus.put(mod.getModId(), bus);
|
eventBus.put(mod.getModId(), bus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FMLLog.warning("Mod %s has been disabled through configuration", mod.getModId());
|
FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId());
|
||||||
modStates.put(mod.getModId(), ModState.UNLOADED);
|
modStates.put(mod.getModId(), ModState.UNLOADED);
|
||||||
modStates.put(mod.getModId(), ModState.DISABLED);
|
modStates.put(mod.getModId(), ModState.DISABLED);
|
||||||
}
|
}
|
||||||
@@ -93,20 +109,30 @@ public class LoadController
|
|||||||
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
|
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
printModStates(sb);
|
printModStates(sb);
|
||||||
FMLLog.severe(sb.toString());
|
FMLLog.getLogger().severe(sb.toString());
|
||||||
FMLLog.severe("The following problems were captured during this phase");
|
if (errors.size()>0)
|
||||||
for (Entry<String, Throwable> error : errors.entries())
|
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
|
FMLLog.severe("The following problems were captured during this phase");
|
||||||
if (error.getValue() instanceof IFMLHandledException)
|
for (Entry<String, Throwable> error : errors.entries())
|
||||||
{
|
{
|
||||||
toThrow = error.getValue();
|
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
|
||||||
}
|
if (error.getValue() instanceof IFMLHandledException)
|
||||||
else if (toThrow == null)
|
{
|
||||||
{
|
toThrow = error.getValue();
|
||||||
toThrow = error.getValue();
|
}
|
||||||
|
else if (toThrow == null)
|
||||||
|
{
|
||||||
|
toThrow = error.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" +
|
||||||
|
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
|
||||||
|
"ForgeModLoader, especially Optifine, to see if there are fixes available.");
|
||||||
|
throw new RuntimeException("The ForgeModLoader state engine is invalid");
|
||||||
|
}
|
||||||
if (toThrow != null && toThrow instanceof RuntimeException)
|
if (toThrow != null && toThrow instanceof RuntimeException)
|
||||||
{
|
{
|
||||||
throw (RuntimeException)toThrow;
|
throw (RuntimeException)toThrow;
|
||||||
@@ -124,7 +150,7 @@ public class LoadController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void propogateStateMessage(FMLStateEvent stateEvent)
|
public void propogateStateMessage(FMLEvent stateEvent)
|
||||||
{
|
{
|
||||||
if (stateEvent instanceof FMLPreInitializationEvent)
|
if (stateEvent instanceof FMLPreInitializationEvent)
|
||||||
{
|
{
|
||||||
@@ -135,17 +161,20 @@ public class LoadController
|
|||||||
activeContainer = mc;
|
activeContainer = mc;
|
||||||
String modId = mc.getModId();
|
String modId = mc.getModId();
|
||||||
stateEvent.applyModContainer(activeContainer());
|
stateEvent.applyModContainer(activeContainer());
|
||||||
FMLLog.finer("Posting state event %s to mod %s", stateEvent.getEventType(), modId);
|
FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
|
||||||
eventChannels.get(modId).post(stateEvent);
|
eventChannels.get(modId).post(stateEvent);
|
||||||
FMLLog.finer("State event %s delivered to mod %s", stateEvent.getEventType(), modId);
|
FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
|
||||||
activeContainer = null;
|
activeContainer = null;
|
||||||
if (!errors.containsKey(modId))
|
if (stateEvent instanceof FMLStateEvent)
|
||||||
{
|
{
|
||||||
modStates.put(modId, stateEvent.getModState());
|
if (!errors.containsKey(modId))
|
||||||
}
|
{
|
||||||
else
|
modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
|
||||||
{
|
}
|
||||||
modStates.put(modId, ModState.ERRORED);
|
else
|
||||||
|
{
|
||||||
|
modStates.put(modId, ModState.ERRORED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,7 +216,7 @@ public class LoadController
|
|||||||
{
|
{
|
||||||
for (ModContainer mc : loader.getModList())
|
for (ModContainer mc : loader.getModList())
|
||||||
{
|
{
|
||||||
ret.append("\n\t").append(mc.getModId()).append(" [").append(mc.getName()).append("] (").append(mc.getSource().getName()).append(") ");
|
ret.append("\n\t").append(mc.getModId()).append("{").append(mc.getVersion()).append("} [").append(mc.getName()).append("] (").append(mc.getSource().getName()).append(") ");
|
||||||
Joiner.on("->"). appendTo(ret, modStates.get(mc.getModId()));
|
Joiner.on("->"). appendTo(ret, modStates.get(mc.getModId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,4 +258,13 @@ public class LoadController
|
|||||||
{
|
{
|
||||||
return this.state == state;
|
return this.state == state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasReachedState(LoaderState state) {
|
||||||
|
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void forceState(LoaderState newState)
|
||||||
|
{
|
||||||
|
this.state = newState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* Contributors:
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* cpw - implementation
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
@@ -26,16 +26,21 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.CallableMinecraftVersion;
|
import net.minecraft.crash.CallableMinecraftVersion;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import com.google.common.base.CharMatcher;
|
import com.google.common.base.CharMatcher;
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Joiner.MapJoiner;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableListMultimap;
|
||||||
|
import com.google.common.collect.ImmutableListMultimap.Builder;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMultiset;
|
import com.google.common.collect.ImmutableMultiset;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
@@ -48,18 +53,23 @@ import com.google.common.collect.Multiset.Entry;
|
|||||||
import com.google.common.collect.Multisets;
|
import com.google.common.collect.Multisets;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.google.common.collect.Sets.SetView;
|
import com.google.common.collect.Sets.SetView;
|
||||||
|
import com.google.common.collect.Table;
|
||||||
import com.google.common.collect.TreeMultimap;
|
import com.google.common.collect.TreeMultimap;
|
||||||
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
import cpw.mods.fml.common.discovery.ModDiscoverer;
|
import cpw.mods.fml.common.discovery.ModDiscoverer;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
import cpw.mods.fml.common.event.FMLLoadEvent;
|
import cpw.mods.fml.common.event.FMLLoadEvent;
|
||||||
import cpw.mods.fml.common.functions.ModIdFunction;
|
import cpw.mods.fml.common.functions.ModIdFunction;
|
||||||
import cpw.mods.fml.common.modloader.BaseModProxy;
|
import cpw.mods.fml.common.modloader.BaseModProxy;
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
import cpw.mods.fml.common.toposort.ModSorter;
|
import cpw.mods.fml.common.toposort.ModSorter;
|
||||||
import cpw.mods.fml.common.toposort.ModSortingException;
|
import cpw.mods.fml.common.toposort.ModSortingException;
|
||||||
import cpw.mods.fml.common.toposort.TopologicalSort;
|
import cpw.mods.fml.common.toposort.TopologicalSort;
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
import cpw.mods.fml.common.versioning.VersionParser;
|
import cpw.mods.fml.common.versioning.VersionParser;
|
||||||
|
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The loader class performs the actual loading of the mod code from disk.
|
* The loader class performs the actual loading of the mod code from disk.
|
||||||
@@ -108,7 +118,7 @@ public class Loader
|
|||||||
private static String rev;
|
private static String rev;
|
||||||
private static String build;
|
private static String build;
|
||||||
private static String mccversion;
|
private static String mccversion;
|
||||||
private static String mcsversion;
|
private static String mcpversion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class loader we load the mods into.
|
* The class loader we load the mods into.
|
||||||
@@ -137,9 +147,12 @@ public class Loader
|
|||||||
private File canonicalModsDir;
|
private File canonicalModsDir;
|
||||||
private LoadController modController;
|
private LoadController modController;
|
||||||
private MinecraftDummyContainer minecraft;
|
private MinecraftDummyContainer minecraft;
|
||||||
|
private MCPDummyContainer mcp;
|
||||||
|
|
||||||
private static File minecraftDir;
|
private static File minecraftDir;
|
||||||
private static List<String> injectedContainers;
|
private static List<String> injectedContainers;
|
||||||
|
private File loggingProperties;
|
||||||
|
private ImmutableMap<String, String> fmlBrandingProperties;
|
||||||
|
|
||||||
public static Loader instance()
|
public static Loader instance()
|
||||||
{
|
{
|
||||||
@@ -158,7 +171,7 @@ public class Loader
|
|||||||
rev = (String) data[2];
|
rev = (String) data[2];
|
||||||
build = (String) data[3];
|
build = (String) data[3];
|
||||||
mccversion = (String) data[4];
|
mccversion = (String) data[4];
|
||||||
mcsversion = (String) data[5];
|
mcpversion = (String) data[5];
|
||||||
minecraftDir = (File) data[6];
|
minecraftDir = (File) data[6];
|
||||||
injectedContainers = (List<String>)data[7];
|
injectedContainers = (List<String>)data[7];
|
||||||
}
|
}
|
||||||
@@ -174,6 +187,7 @@ public class Loader
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft = new MinecraftDummyContainer(actualMCVersion);
|
minecraft = new MinecraftDummyContainer(actualMCVersion);
|
||||||
|
mcp = new MCPDummyContainer(MetadataCollection.from(getClass().getResourceAsStream("/mcpmod.info"), "MCP").getMetadataForId("mcp", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,7 +197,7 @@ public class Loader
|
|||||||
*/
|
*/
|
||||||
private void sortModList()
|
private void sortModList()
|
||||||
{
|
{
|
||||||
FMLLog.fine("Verifying mod requirements are satisfied");
|
FMLLog.finer("Verifying mod requirements are satisfied");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BiMap<String, ArtifactVersion> modVersions = HashBiMap.create();
|
BiMap<String, ArtifactVersion> modVersions = HashBiMap.create();
|
||||||
@@ -235,13 +249,13 @@ public class Loader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FMLLog.fine("All mod requirements are satisfied");
|
FMLLog.finer("All mod requirements are satisfied");
|
||||||
|
|
||||||
ModSorter sorter = new ModSorter(getActiveModList(), namedMods);
|
ModSorter sorter = new ModSorter(getActiveModList(), namedMods);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FMLLog.fine("Sorting mods into an ordered list");
|
FMLLog.finer("Sorting mods into an ordered list");
|
||||||
List<ModContainer> sortedMods = sorter.sort();
|
List<ModContainer> sortedMods = sorter.sort();
|
||||||
// Reset active list to the sorted list
|
// Reset active list to the sorted list
|
||||||
modController.getActiveModList().clear();
|
modController.getActiveModList().clear();
|
||||||
@@ -250,7 +264,7 @@ public class Loader
|
|||||||
mods.removeAll(sortedMods);
|
mods.removeAll(sortedMods);
|
||||||
sortedMods.addAll(mods);
|
sortedMods.addAll(mods);
|
||||||
mods = sortedMods;
|
mods = sortedMods;
|
||||||
FMLLog.fine("Mod sorting completed successfully");
|
FMLLog.finer("Mod sorting completed successfully");
|
||||||
}
|
}
|
||||||
catch (ModSortingException sortException)
|
catch (ModSortingException sortException)
|
||||||
{
|
{
|
||||||
@@ -263,17 +277,19 @@ public class Loader
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
FMLLog.fine("Mod sorting data:");
|
FMLLog.fine("Mod sorting data");
|
||||||
|
int unprintedMods = mods.size();
|
||||||
for (ModContainer mod : getActiveModList())
|
for (ModContainer mod : getActiveModList())
|
||||||
{
|
{
|
||||||
if (!mod.isImmutable())
|
if (!mod.isImmutable())
|
||||||
{
|
{
|
||||||
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules());
|
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules());
|
||||||
|
unprintedMods--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mods.size()==0)
|
if (unprintedMods == mods.size())
|
||||||
{
|
{
|
||||||
FMLLog.fine("No mods found to sort");
|
FMLLog.fine("No user mods found to sort");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,6 +319,8 @@ public class Loader
|
|||||||
private ModDiscoverer identifyMods()
|
private ModDiscoverer identifyMods()
|
||||||
{
|
{
|
||||||
FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
|
FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
|
||||||
|
// Add in the MCP mod container
|
||||||
|
mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
|
||||||
File coremod = new File(minecraftDir,"coremods");
|
File coremod = new File(minecraftDir,"coremods");
|
||||||
for (String cont : injectedContainers)
|
for (String cont : injectedContainers)
|
||||||
{
|
{
|
||||||
@@ -330,6 +348,10 @@ public class Loader
|
|||||||
identifyDuplicates(mods);
|
identifyDuplicates(mods);
|
||||||
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
|
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
|
||||||
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
|
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
|
||||||
|
for (String modId: namedMods.keySet())
|
||||||
|
{
|
||||||
|
FMLLog.makeLog(modId);
|
||||||
|
}
|
||||||
return discoverer;
|
return discoverer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +393,7 @@ public class Loader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
*
|
||||||
*/
|
*/
|
||||||
private void initializeLoader()
|
private void initializeLoader()
|
||||||
{
|
{
|
||||||
@@ -430,6 +452,11 @@ public class Loader
|
|||||||
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath);
|
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath);
|
||||||
throw new LoaderException();
|
throw new LoaderException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loggingProperties = new File(canonicalConfigDir, "logging.properties");
|
||||||
|
FMLLog.info("Reading custom logging properties from %s", loggingProperties.getPath());
|
||||||
|
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
|
||||||
|
FMLLog.log(Level.OFF,"Logging level for ForgeModLoader logging is set to %s", FMLRelaunchLog.log.getLogger().getLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModContainer> getModList()
|
public List<ModContainer> getModList()
|
||||||
@@ -451,6 +478,9 @@ public class Loader
|
|||||||
modController.transition(LoaderState.LOADING);
|
modController.transition(LoaderState.LOADING);
|
||||||
ModDiscoverer disc = identifyMods();
|
ModDiscoverer disc = identifyMods();
|
||||||
disableRequestedMods();
|
disableRequestedMods();
|
||||||
|
FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
|
||||||
|
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
|
||||||
|
FMLLog.fine("Reloaded logging properties");
|
||||||
modController.distributeStateMessage(FMLLoadEvent.class);
|
modController.distributeStateMessage(FMLLoadEvent.class);
|
||||||
sortModList();
|
sortModList();
|
||||||
mods = ImmutableList.copyOf(mods);
|
mods = ImmutableList.copyOf(mods);
|
||||||
@@ -471,6 +501,15 @@ public class Loader
|
|||||||
}
|
}
|
||||||
modController.transition(LoaderState.CONSTRUCTING);
|
modController.transition(LoaderState.CONSTRUCTING);
|
||||||
modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
|
modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
|
||||||
|
FMLLog.fine("Mod signature data");
|
||||||
|
for (ModContainer mod : getActiveModList())
|
||||||
|
{
|
||||||
|
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate()));
|
||||||
|
}
|
||||||
|
if (getActiveModList().isEmpty())
|
||||||
|
{
|
||||||
|
FMLLog.fine("No user mod signature data found");
|
||||||
|
}
|
||||||
modController.transition(LoaderState.PREINITIALIZATION);
|
modController.transition(LoaderState.PREINITIALIZATION);
|
||||||
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
|
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
|
||||||
modController.transition(LoaderState.INITIALIZATION);
|
modController.transition(LoaderState.INITIALIZATION);
|
||||||
@@ -479,22 +518,22 @@ public class Loader
|
|||||||
private void disableRequestedMods()
|
private void disableRequestedMods()
|
||||||
{
|
{
|
||||||
String forcedModList = System.getProperty("fml.modStates", "");
|
String forcedModList = System.getProperty("fml.modStates", "");
|
||||||
FMLLog.fine("Received a system property request \'%s\'",forcedModList);
|
FMLLog.finer("Received a system property request \'%s\'",forcedModList);
|
||||||
Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:"))
|
Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:"))
|
||||||
.omitEmptyStrings().trimResults().withKeyValueSeparator("=")
|
.omitEmptyStrings().trimResults().withKeyValueSeparator("=")
|
||||||
.split(forcedModList);
|
.split(forcedModList);
|
||||||
FMLLog.fine("System property request managing the state of %d mods", sysPropertyStateList.size());
|
FMLLog.finer("System property request managing the state of %d mods", sysPropertyStateList.size());
|
||||||
Map<String, String> modStates = Maps.newHashMap();
|
Map<String, String> modStates = Maps.newHashMap();
|
||||||
|
|
||||||
File forcedModFile = new File(canonicalConfigDir, "fmlModState.properties");
|
File forcedModFile = new File(canonicalConfigDir, "fmlModState.properties");
|
||||||
Properties forcedModListProperties = new Properties();
|
Properties forcedModListProperties = new Properties();
|
||||||
if (forcedModFile.exists() && forcedModFile.isFile())
|
if (forcedModFile.exists() && forcedModFile.isFile())
|
||||||
{
|
{
|
||||||
FMLLog.fine("Found a mod state file %s", forcedModFile.getName());
|
FMLLog.finer("Found a mod state file %s", forcedModFile.getName());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
forcedModListProperties.load(new FileReader(forcedModFile));
|
forcedModListProperties.load(new FileReader(forcedModFile));
|
||||||
FMLLog.fine("Loaded states for %d mods from file", forcedModListProperties.size());
|
FMLLog.finer("Loaded states for %d mods from file", forcedModListProperties.size());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -541,6 +580,11 @@ public class Loader
|
|||||||
|
|
||||||
public String getCrashInformation()
|
public String getCrashInformation()
|
||||||
{
|
{
|
||||||
|
// Handle being called before we've begun setup
|
||||||
|
if (modController == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
StringBuilder ret = new StringBuilder();
|
StringBuilder ret = new StringBuilder();
|
||||||
List<String> branding = FMLCommonHandler.instance().getBrandings();
|
List<String> branding = FMLCommonHandler.instance().getBrandings();
|
||||||
|
|
||||||
@@ -645,9 +689,14 @@ public class Loader
|
|||||||
// Mod controller should be in the initialization state here
|
// Mod controller should be in the initialization state here
|
||||||
modController.distributeStateMessage(LoaderState.INITIALIZATION);
|
modController.distributeStateMessage(LoaderState.INITIALIZATION);
|
||||||
modController.transition(LoaderState.POSTINITIALIZATION);
|
modController.transition(LoaderState.POSTINITIALIZATION);
|
||||||
|
// Construct the "mod object table" so mods can refer to it in IMC and postinit
|
||||||
|
GameData.buildModObjectTable();
|
||||||
|
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
|
||||||
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
|
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
|
||||||
modController.transition(LoaderState.AVAILABLE);
|
modController.transition(LoaderState.AVAILABLE);
|
||||||
modController.distributeStateMessage(LoaderState.AVAILABLE);
|
modController.distributeStateMessage(LoaderState.AVAILABLE);
|
||||||
|
// Dump the custom registry data map, if necessary
|
||||||
|
GameData.dumpRegistry(minecraftDir);
|
||||||
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size()==1 ? "" : "s");
|
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size()==1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,10 +732,19 @@ public class Loader
|
|||||||
return "Minecraft " + mccversion;
|
return "Minecraft " + mccversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serverStarting(Object server)
|
public boolean serverStarting(Object server)
|
||||||
{
|
{
|
||||||
modController.distributeStateMessage(LoaderState.SERVER_STARTING, server);
|
try
|
||||||
modController.transition(LoaderState.SERVER_STARTING);
|
{
|
||||||
|
modController.distributeStateMessage(LoaderState.SERVER_STARTING, server);
|
||||||
|
modController.transition(LoaderState.SERVER_STARTING);
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server starting event");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serverStarted()
|
public void serverStarted()
|
||||||
@@ -699,8 +757,6 @@ public class Loader
|
|||||||
{
|
{
|
||||||
modController.distributeStateMessage(LoaderState.SERVER_STOPPING);
|
modController.distributeStateMessage(LoaderState.SERVER_STOPPING);
|
||||||
modController.transition(LoaderState.SERVER_STOPPING);
|
modController.transition(LoaderState.SERVER_STOPPING);
|
||||||
modController.transition(LoaderState.AVAILABLE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiMap<ModContainer, Object> getModObjectList()
|
public BiMap<ModContainer, Object> getModObjectList()
|
||||||
@@ -715,7 +771,7 @@ public class Loader
|
|||||||
|
|
||||||
public ModContainer activeModContainer()
|
public ModContainer activeModContainer()
|
||||||
{
|
{
|
||||||
return modController.activeContainer();
|
return modController != null ? modController.activeContainer() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInState(LoaderState state)
|
public boolean isInState(LoaderState state)
|
||||||
@@ -727,4 +783,60 @@ public class Loader
|
|||||||
{
|
{
|
||||||
return minecraft;
|
return minecraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasReachedState(LoaderState state) {
|
||||||
|
return modController != null ? modController.hasReachedState(state) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMCPVersionString() {
|
||||||
|
return String.format("MCP v%s", mcpversion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serverStopped()
|
||||||
|
{
|
||||||
|
modController.distributeStateMessage(LoaderState.SERVER_STOPPED);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
modController.transition(LoaderState.SERVER_STOPPED);
|
||||||
|
}
|
||||||
|
catch (LoaderException e)
|
||||||
|
{
|
||||||
|
modController.forceState(LoaderState.SERVER_STOPPED);
|
||||||
|
// Discard any exceptions here - they mask other, real, exceptions
|
||||||
|
}
|
||||||
|
modController.transition(LoaderState.AVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean serverAboutToStart(Object server)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
modController.distributeStateMessage(LoaderState.SERVER_ABOUT_TO_START, server);
|
||||||
|
modController.transition(LoaderState.SERVER_ABOUT_TO_START);
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server about to start event");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,String> getFMLBrandingProperties()
|
||||||
|
{
|
||||||
|
if (fmlBrandingProperties == null)
|
||||||
|
{
|
||||||
|
Properties loaded = new Properties();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
loaded.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// File not found - ignore
|
||||||
|
}
|
||||||
|
fmlBrandingProperties = Maps.fromProperties(loaded);
|
||||||
|
}
|
||||||
|
return fmlBrandingProperties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
public class LoaderException extends RuntimeException
|
public class LoaderException extends RuntimeException
|
||||||
@@ -28,4 +27,4 @@ public class LoaderException extends RuntimeException
|
|||||||
public LoaderException()
|
public LoaderException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLEvent;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||||
import cpw.mods.fml.common.event.FMLStateEvent;
|
import cpw.mods.fml.common.event.FMLStateEvent;
|
||||||
|
|
||||||
@@ -26,9 +41,11 @@ public enum LoaderState
|
|||||||
INITIALIZATION("Initializing mods", FMLInitializationEvent.class),
|
INITIALIZATION("Initializing mods", FMLInitializationEvent.class),
|
||||||
POSTINITIALIZATION("Post-initializing mods", FMLPostInitializationEvent.class),
|
POSTINITIALIZATION("Post-initializing mods", FMLPostInitializationEvent.class),
|
||||||
AVAILABLE("Mod loading complete", FMLLoadCompleteEvent.class),
|
AVAILABLE("Mod loading complete", FMLLoadCompleteEvent.class),
|
||||||
|
SERVER_ABOUT_TO_START("Server about to start", FMLServerAboutToStartEvent.class),
|
||||||
SERVER_STARTING("Server starting", FMLServerStartingEvent.class),
|
SERVER_STARTING("Server starting", FMLServerStartingEvent.class),
|
||||||
SERVER_STARTED("Server started", FMLServerStartedEvent.class),
|
SERVER_STARTED("Server started", FMLServerStartedEvent.class),
|
||||||
SERVER_STOPPING("Server stopping", FMLServerStoppingEvent.class),
|
SERVER_STOPPING("Server stopping", FMLServerStoppingEvent.class),
|
||||||
|
SERVER_STOPPED("Server stopped", FMLServerStoppedEvent.class),
|
||||||
ERRORED("Mod Loading errored",null);
|
ERRORED("Mod Loading errored",null);
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +65,7 @@ public enum LoaderState
|
|||||||
return ERRORED;
|
return ERRORED;
|
||||||
}
|
}
|
||||||
// stopping -> available
|
// stopping -> available
|
||||||
if (this == SERVER_STOPPING)
|
if (this == SERVER_STOPPED)
|
||||||
{
|
{
|
||||||
return AVAILABLE;
|
return AVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -59,7 +76,7 @@ public enum LoaderState
|
|||||||
{
|
{
|
||||||
return eventClass != null;
|
return eventClass != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FMLStateEvent getEvent(Object... eventData)
|
public FMLStateEvent getEvent(Object... eventData)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -87,7 +104,7 @@ public enum LoaderState
|
|||||||
AVAILABLE("Available"),
|
AVAILABLE("Available"),
|
||||||
DISABLED("Disabled"),
|
DISABLED("Disabled"),
|
||||||
ERRORED("Errored");
|
ERRORED("Errored");
|
||||||
|
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
private ModState(String label)
|
private ModState(String label)
|
||||||
@@ -100,4 +117,4 @@ public enum LoaderState
|
|||||||
return this.label;
|
return this.label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
public class MCPDummyContainer extends DummyModContainer {
|
||||||
|
public MCPDummyContainer(ModMetadata metadata) {
|
||||||
|
super(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean registerBus(EventBus bus, LoadController controller) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
@@ -18,7 +17,10 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import net.minecraft.src.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new mod style in FML 1.3
|
* The new mod style in FML 1.3
|
||||||
@@ -63,9 +65,75 @@ public @interface Mod
|
|||||||
* An optional bukkit plugin that will be injected into the bukkit plugin framework if
|
* An optional bukkit plugin that will be injected into the bukkit plugin framework if
|
||||||
* this mod is loaded into the FML framework and the bukkit coremod is present.
|
* this mod is loaded into the FML framework and the bukkit coremod is present.
|
||||||
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
|
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
|
||||||
* @return
|
* @return The name of the plugin to load for this mod
|
||||||
*/
|
*/
|
||||||
String bukkitPlugin() default "";
|
String bukkitPlugin() default "";
|
||||||
|
/**
|
||||||
|
* Mods that this mod will <strong>not</strong> load with.
|
||||||
|
* An optional comma separated string of (+|-)(*|modid[@value]) which specify mods that
|
||||||
|
* this mod will refuse to load with, resulting in the game failing to start.
|
||||||
|
* Entries can be prefixed with a + for a positive exclusion assertion, or - for a negative exclusion
|
||||||
|
* assertion. Asterisk is the wildcard and represents <strong>all</strong> mods.
|
||||||
|
*
|
||||||
|
* The <strong>only</strong> mods that cannot be excluded are FML and MCP, trivially.
|
||||||
|
* Other special values:
|
||||||
|
* <ul>
|
||||||
|
* <li>+f indicates that the mod will accept a minecraft forge environment.</li>
|
||||||
|
* <li>-* indicates that the mod will not accept any other mods.</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* Some examples:
|
||||||
|
* <ul>
|
||||||
|
* <li><em>-*,+f,+IronChest</em>: Will run only in a minecraft forge environment with the mod IronChests.
|
||||||
|
* The -* forces all mods to be excluded, then the +f and +IronChest add into the "allowed list".</li>
|
||||||
|
* <li><em>+f,-IC2</em>: Will run in a minecraft forge environment but will <strong>not</strong> run if
|
||||||
|
* IndustrialCraft 2 (IC2) is loaded alongside.</li>
|
||||||
|
* <li><em>-*</em>: Will not run if <strong>any</strong> othe mod is loaded except MCP/FML itself.</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* If a mod is present on the excluded list, the game will stop and show an error screen. If the
|
||||||
|
* class containing the {@link Mod} annotation has a "getCustomErrorException" method, it will be
|
||||||
|
* called to retrieve a custom error message for display in this case. If two mods have a declared
|
||||||
|
* exclusion which is matched, the screen that is shown is indeterminate.
|
||||||
|
*
|
||||||
|
* @return A string listing modids to exclude from loading with this mod.
|
||||||
|
*/
|
||||||
|
String modExclusionList() default "";
|
||||||
|
/**
|
||||||
|
* Specifying this field allows for a mod to expect a signed jar with a fingerprint matching this value.
|
||||||
|
* The fingerprint should be SHA-1 encoded, lowercase with ':' removed. An empty value indicates that
|
||||||
|
* the mod is not expecting to be signed.
|
||||||
|
*
|
||||||
|
* Any incorrectness of the fingerprint, be it missing or wrong, will result in the {@link FingerprintWarning}
|
||||||
|
* method firing <i>prior to any other event on the mod</i>.
|
||||||
|
*
|
||||||
|
* @return A certificate fingerprint that is expected for this mod.
|
||||||
|
*/
|
||||||
|
String certificateFingerprint() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language the mod is authored in. This will be used to control certain libraries being downloaded.
|
||||||
|
* Valid values are currently "java", "scala"
|
||||||
|
*
|
||||||
|
* @return The language the mod is authored in
|
||||||
|
*/
|
||||||
|
String modLanguage() default "java";
|
||||||
|
/**
|
||||||
|
* An optional ASM hook class, that can be used to apply ASM to classes loaded from this mod. It is also given
|
||||||
|
* the ASM tree of the class declaring {@link Mod} to with what it will.
|
||||||
|
*
|
||||||
|
* @return The name of a class to be loaded and executed. Must implement {@link IASMHook}.
|
||||||
|
*/
|
||||||
|
String asmHookClass() default "";
|
||||||
|
/**
|
||||||
|
* Mark the designated method as to be called at if there is something wrong with the certificate fingerprint of
|
||||||
|
* the mod's jar, or it is missing, or otherwise a problem.
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface FingerprintWarning {}
|
||||||
/**
|
/**
|
||||||
* Mark the designated method as being called at the "pre-initialization" phase
|
* Mark the designated method as being called at the "pre-initialization" phase
|
||||||
* @author cpw
|
* @author cpw
|
||||||
@@ -90,6 +158,14 @@ public @interface Mod
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface PostInit {}
|
public @interface PostInit {}
|
||||||
|
/**
|
||||||
|
* Mark the designated method as being called at the "server-about-to-start" phase
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface ServerAboutToStart {}
|
||||||
/**
|
/**
|
||||||
* Mark the designated method as being called at the "server-starting" phase
|
* Mark the designated method as being called at the "server-starting" phase
|
||||||
* @author cpw
|
* @author cpw
|
||||||
@@ -99,7 +175,7 @@ public @interface Mod
|
|||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface ServerStarting {}
|
public @interface ServerStarting {}
|
||||||
/**
|
/**
|
||||||
* Mark the designated method as being called at the "post-initialization" phase
|
* Mark the designated method as being called at the "server-started" phase
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -107,13 +183,30 @@ public @interface Mod
|
|||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface ServerStarted {}
|
public @interface ServerStarted {}
|
||||||
/**
|
/**
|
||||||
* Mark the designated method as being called at the "post-initialization" phase
|
* Mark the designated method as being called at the "server-stopping" phase
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface ServerStopping {}
|
public @interface ServerStopping {}
|
||||||
|
/**
|
||||||
|
* Mark the designated method as being called at the "server-stopped" phase
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface ServerStopped {}
|
||||||
|
/**
|
||||||
|
* Mark the designated method as the receiver for {@link FMLInterModComms} messages
|
||||||
|
* Called between {@link Init} and {@link PostInit}
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface IMCCallback {}
|
||||||
/**
|
/**
|
||||||
* Populate the annotated field with the mod instance.
|
* Populate the annotated field with the mod instance.
|
||||||
* @author cpw
|
* @author cpw
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -70,7 +69,7 @@ public class ModClassLoader extends URLClassLoader
|
|||||||
}
|
}
|
||||||
catch (URISyntaxException e)
|
catch (URISyntaxException e)
|
||||||
{
|
{
|
||||||
FMLLog.log(Level.SEVERE, "Unable to process our input to locate the minecraft code", e);
|
FMLLog.log(Level.SEVERE, e, "Unable to process our input to locate the minecraft code");
|
||||||
throw new LoaderException(e);
|
throw new LoaderException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -80,13 +80,13 @@ public interface ModContainer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of modids that should be loaded prior to this one. The special
|
* A list of modids that should be loaded prior to this one. The special
|
||||||
* value <strong>*</strong> indicates to load <em>before</em> any other mod.
|
* value <strong>*</strong> indicates to load <em>after</em> any other mod.
|
||||||
*/
|
*/
|
||||||
List<ArtifactVersion> getDependencies();
|
List<ArtifactVersion> getDependencies();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of modids that should be loaded <em>after</em> this one. The
|
* A list of modids that should be loaded <em>after</em> this one. The
|
||||||
* special value <strong>*</strong> indicates to load <em>after</em> any
|
* special value <strong>*</strong> indicates to load <em>before</em> any
|
||||||
* other mod.
|
* other mod.
|
||||||
*/
|
*/
|
||||||
List<ArtifactVersion> getDependants();
|
List<ArtifactVersion> getDependants();
|
||||||
@@ -129,4 +129,6 @@ public interface ModContainer
|
|||||||
String getDisplayVersion();
|
String getDisplayVersion();
|
||||||
|
|
||||||
VersionRange acceptableMinecraftVersionRange();
|
VersionRange acceptableMinecraftVersionRange();
|
||||||
|
|
||||||
|
Certificate getSigningCertificate();
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ package cpw.mods.fml.common;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException;
|
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException;
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
|
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
|
||||||
@@ -27,8 +28,6 @@ import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
|
|||||||
*/
|
*/
|
||||||
public class ObfuscationReflectionHelper
|
public class ObfuscationReflectionHelper
|
||||||
{
|
{
|
||||||
public static boolean obfuscation;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
|
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
|
||||||
{
|
{
|
||||||
@@ -43,12 +42,23 @@ public class ObfuscationReflectionHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] remapFieldNames(String className, String... fieldNames)
|
||||||
|
{
|
||||||
|
String internalClassName = FMLDeobfuscatingRemapper.INSTANCE.unmap(className.replace('.', '/'));
|
||||||
|
String[] mappedNames = new String[fieldNames.length];
|
||||||
|
int i = 0;
|
||||||
|
for (String fName : fieldNames)
|
||||||
|
{
|
||||||
|
mappedNames[i++] = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(internalClassName, fName, null);
|
||||||
|
}
|
||||||
|
return mappedNames;
|
||||||
|
}
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, String... fieldNames)
|
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, String... fieldNames)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ReflectionHelper.getPrivateValue(classToAccess, instance, fieldNames);
|
return ReflectionHelper.getPrivateValue(classToAccess, instance, remapFieldNames(classToAccess.getName(),fieldNames));
|
||||||
}
|
}
|
||||||
catch (UnableToFindFieldException e)
|
catch (UnableToFindFieldException e)
|
||||||
{
|
{
|
||||||
@@ -91,7 +101,7 @@ public class ObfuscationReflectionHelper
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldNames);
|
ReflectionHelper.setPrivateValue(classToAccess, instance, value, remapFieldNames(classToAccess.getName(), fieldNames));
|
||||||
}
|
}
|
||||||
catch (UnableToFindFieldException e)
|
catch (UnableToFindFieldException e)
|
||||||
{
|
{
|
||||||
@@ -104,13 +114,4 @@ public class ObfuscationReflectionHelper
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void detectObfuscation(Class<?> clazz)
|
|
||||||
{
|
|
||||||
obfuscation = !clazz.getSimpleName().equals("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* Contributors:
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* cpw - implementation
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
@@ -21,6 +19,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cpw
|
* @author cpw
|
||||||
@@ -28,7 +27,7 @@ import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
|||||||
*/
|
*/
|
||||||
public class ProxyInjector
|
public class ProxyInjector
|
||||||
{
|
{
|
||||||
public static void inject(ModContainer mod, ASMDataTable data, Side side)
|
public static void inject(ModContainer mod, ASMDataTable data, Side side, ILanguageAdapter languageAdapter)
|
||||||
{
|
{
|
||||||
FMLLog.fine("Attempting to inject @SidedProxy classes into %s", mod.getModId());
|
FMLLog.fine("Attempting to inject @SidedProxy classes into %s", mod.getModId());
|
||||||
Set<ASMData> targets = data.getAnnotationsFor(mod).get(SidedProxy.class.getName());
|
Set<ASMData> targets = data.getAnnotationsFor(mod).get(SidedProxy.class.getName());
|
||||||
@@ -50,7 +49,7 @@ public class ProxyInjector
|
|||||||
String targetType = side.isClient() ? target.getAnnotation(SidedProxy.class).clientSide() : target.getAnnotation(SidedProxy.class).serverSide();
|
String targetType = side.isClient() ? target.getAnnotation(SidedProxy.class).clientSide() : target.getAnnotation(SidedProxy.class).serverSide();
|
||||||
Object proxy=Class.forName(targetType, true, mcl).newInstance();
|
Object proxy=Class.forName(targetType, true, mcl).newInstance();
|
||||||
|
|
||||||
if ((target.getModifiers() & Modifier.STATIC) == 0 )
|
if (languageAdapter.supportsStatics() && (target.getModifiers() & Modifier.STATIC) == 0 )
|
||||||
{
|
{
|
||||||
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName());
|
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the field is not static", targetType, targ.getClassName(), targ.getObjectName());
|
||||||
throw new LoaderException();
|
throw new LoaderException();
|
||||||
@@ -60,7 +59,7 @@ public class ProxyInjector
|
|||||||
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName());
|
FMLLog.severe("Attempted to load a proxy type %s into %s.%s, but the types don't match", targetType, targ.getClassName(), targ.getObjectName());
|
||||||
throw new LoaderException();
|
throw new LoaderException();
|
||||||
}
|
}
|
||||||
target.set(null, proxy);
|
languageAdapter.setProxy(target, proxyTarget, proxy);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public enum Side {
|
|
||||||
CLIENT, SERVER, BUKKIT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If this is the server environment
|
|
||||||
*/
|
|
||||||
public boolean isServer()
|
|
||||||
{
|
|
||||||
return !isClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return if this is the Client environment
|
|
||||||
*/
|
|
||||||
public boolean isClient()
|
|
||||||
{
|
|
||||||
return this == CLIENT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
*
|
* All rights reserved. This program and the accompanying materials
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* which accompanies this distribution, and is available at
|
||||||
*
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
*
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
* Contributors:
|
||||||
*
|
* cpw - implementation
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* The FML Forge Mod Loader suite.
|
* Forge Mod Loader
|
||||||
* Copyright (C) 2012 cpw
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
* Contributors:
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
* cpw - implementation
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
@@ -30,19 +28,6 @@ public enum TickType {
|
|||||||
* arg 0 : float "partial render time"
|
* arg 0 : float "partial render time"
|
||||||
*/
|
*/
|
||||||
RENDER,
|
RENDER,
|
||||||
/**
|
|
||||||
* client side
|
|
||||||
* Fired during the render processing phase if a GUI is open
|
|
||||||
* arg 0 : float "partial render time"
|
|
||||||
* arg 1 : the open gui or null if no gui is open
|
|
||||||
*/
|
|
||||||
GUI,
|
|
||||||
/**
|
|
||||||
* client side
|
|
||||||
* Fired during the client evaluation loop
|
|
||||||
* arg 0 : The open gui or null if no gui is open
|
|
||||||
*/
|
|
||||||
CLIENTGUI,
|
|
||||||
/**
|
/**
|
||||||
* server side
|
* server side
|
||||||
* Fired once as the world loads from disk
|
* Fired once as the world loads from disk
|
||||||
@@ -74,8 +59,6 @@ public enum TickType {
|
|||||||
{
|
{
|
||||||
if (this==CLIENT) return EnumSet.of(RENDER);
|
if (this==CLIENT) return EnumSet.of(RENDER);
|
||||||
if (this==RENDER) return EnumSet.of(CLIENT);
|
if (this==RENDER) return EnumSet.of(CLIENT);
|
||||||
if (this==GUI) return EnumSet.of(CLIENTGUI);
|
|
||||||
if (this==CLIENTGUI) return EnumSet.of(GUI);
|
|
||||||
return EnumSet.noneOf(TickType.class);
|
return EnumSet.noneOf(TickType.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.src.NBTBase;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.world.storage.*;
|
||||||
import net.minecraft.src.SaveHandler;
|
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
public interface WorldAccessContainer
|
public interface WorldAccessContainer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
public class WrongMinecraftVersionException extends RuntimeException
|
public class WrongMinecraftVersionException extends RuntimeException
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm;
|
package cpw.mods.fml.common.asm;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
@@ -12,7 +24,7 @@ import cpw.mods.fml.relauncher.IClassTransformer;
|
|||||||
public class ASMTransformer implements IClassTransformer
|
public class ASMTransformer implements IClassTransformer
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public byte[] transform(String name, byte[] bytes)
|
public byte[] transform(String name,String transformedName, byte[] bytes)
|
||||||
{
|
{
|
||||||
if ("net.minecraft.src.Block".equals(name))
|
if ("net.minecraft.src.Block".equals(name))
|
||||||
{
|
{
|
||||||
@@ -24,7 +36,7 @@ public class ASMTransformer implements IClassTransformer
|
|||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
return cw.toByteArray();
|
return cw.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm;
|
package cpw.mods.fml.common.asm;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.ObjectInputStream.GetField;
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.net.JarURLConnection;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.security.CodeSource;
|
||||||
|
import java.security.cert.CertPath;
|
||||||
|
import java.security.cert.CertPathValidator;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
|
import java.security.cert.CertificateFactory;
|
||||||
|
import java.security.cert.PKIXCertPathValidatorResult;
|
||||||
|
import java.security.cert.PKIXParameters;
|
||||||
|
import java.security.cert.TrustAnchor;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
@@ -9,11 +39,16 @@ import org.objectweb.asm.ClassVisitor;
|
|||||||
import org.objectweb.asm.FieldVisitor;
|
import org.objectweb.asm.FieldVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.CertificateHelper;
|
||||||
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
|
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||||
import cpw.mods.fml.relauncher.IFMLCallHook;
|
import cpw.mods.fml.relauncher.IFMLCallHook;
|
||||||
import cpw.mods.fml.relauncher.RelaunchClassLoader;
|
import cpw.mods.fml.relauncher.RelaunchClassLoader;
|
||||||
|
|
||||||
public class FMLSanityChecker implements IFMLCallHook
|
public class FMLSanityChecker implements IFMLCallHook
|
||||||
{
|
{
|
||||||
|
private static final String FMLFINGERPRINT = "AE:F6:54:79:96:E9:1B:D1:59:70:6C:B4:6B:F5:4A:89:C5:CE:08:1D".toLowerCase().replace(":","");
|
||||||
|
private static final String FORGEFINGERPRINT = "DE:4C:F8:A3:F3:BC:15:63:58:10:04:4C:39:24:0B:F9:68:04:EA:7D".toLowerCase().replace(":", "");
|
||||||
static class MLDetectorClassVisitor extends ClassVisitor
|
static class MLDetectorClassVisitor extends ClassVisitor
|
||||||
{
|
{
|
||||||
private boolean foundMarker = false;
|
private boolean foundMarker = false;
|
||||||
@@ -38,6 +73,42 @@ public class FMLSanityChecker implements IFMLCallHook
|
|||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception
|
public Void call() throws Exception
|
||||||
{
|
{
|
||||||
|
CodeSource codeSource = getClass().getProtectionDomain().getCodeSource();
|
||||||
|
boolean goodFML = false;
|
||||||
|
if (codeSource.getLocation().getProtocol().equals("jar"))
|
||||||
|
{
|
||||||
|
Certificate[] certificates = codeSource.getCertificates();
|
||||||
|
if (certificates!=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (Certificate cert : certificates)
|
||||||
|
{
|
||||||
|
String fingerprint = CertificateHelper.getFingerprint(cert);
|
||||||
|
if (fingerprint.equals(FMLFINGERPRINT))
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.info("Found valid fingerprint for FML. Certificate fingerprint %s", fingerprint);
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
else if (fingerprint.equals(FORGEFINGERPRINT))
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint %s", fingerprint);
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.severe("Found invalid fingerprint for FML: %s", fingerprint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
if (!goodFML)
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing");
|
||||||
|
}
|
||||||
byte[] mlClass = cl.getClassBytes("ModLoader");
|
byte[] mlClass = cl.getClassBytes("ModLoader");
|
||||||
// Only care in obfuscated env
|
// Only care in obfuscated env
|
||||||
if (mlClass == null)
|
if (mlClass == null)
|
||||||
@@ -67,6 +138,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
|||||||
public void injectData(Map<String, Object> data)
|
public void injectData(Map<String, Object> data)
|
||||||
{
|
{
|
||||||
cl = (RelaunchClassLoader) data.get("classLoader");
|
cl = (RelaunchClassLoader) data.get("classLoader");
|
||||||
|
FMLDeobfuscatingRemapper.INSTANCE.setup((File)data.get("mcLocation"), cl, (String) data.get("deobfuscationFileName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common.asm;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to force certain classes to reobfuscate
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
public @interface ReobfuscationMarker {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package cpw.mods.fml.common.asm;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
|
|
||||||
public @interface SideOnly
|
|
||||||
{
|
|
||||||
public Side value();
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm.transformers;
|
package cpw.mods.fml.common.asm.transformers;
|
||||||
|
|
||||||
import static org.objectweb.asm.Opcodes.ACC_FINAL;
|
import static org.objectweb.asm.Opcodes.ACC_FINAL;
|
||||||
@@ -35,6 +47,7 @@ import com.google.common.collect.Multimap;
|
|||||||
import com.google.common.io.LineProcessor;
|
import com.google.common.io.LineProcessor;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
import cpw.mods.fml.relauncher.IClassTransformer;
|
import cpw.mods.fml.relauncher.IClassTransformer;
|
||||||
|
|
||||||
public class AccessTransformer implements IClassTransformer
|
public class AccessTransformer implements IClassTransformer
|
||||||
@@ -143,15 +156,45 @@ public class AccessTransformer implements IClassTransformer
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public byte[] transform(String name, byte[] bytes)
|
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes == null) { return null; }
|
if (bytes == null) { return null; }
|
||||||
if (!modifiers.containsKey(name)) { return bytes; }
|
boolean makeAllPublic = FMLDeobfuscatingRemapper.INSTANCE.isRemappedClass(name);
|
||||||
|
|
||||||
|
if (DEBUG)
|
||||||
|
{
|
||||||
|
System.out.printf("Considering all methods and fields on %s (%s): %b\n", name, transformedName, makeAllPublic);
|
||||||
|
}
|
||||||
|
if (!makeAllPublic && !modifiers.containsKey(name)) { return bytes; }
|
||||||
|
|
||||||
ClassNode classNode = new ClassNode();
|
ClassNode classNode = new ClassNode();
|
||||||
ClassReader classReader = new ClassReader(bytes);
|
ClassReader classReader = new ClassReader(bytes);
|
||||||
classReader.accept(classNode, 0);
|
classReader.accept(classNode, 0);
|
||||||
|
|
||||||
|
if (makeAllPublic)
|
||||||
|
{
|
||||||
|
// class
|
||||||
|
Modifier m = new Modifier();
|
||||||
|
m.targetAccess = ACC_PUBLIC;
|
||||||
|
m.modifyClassVisibility = true;
|
||||||
|
modifiers.put(name,m);
|
||||||
|
// fields
|
||||||
|
m = new Modifier();
|
||||||
|
m.targetAccess = ACC_PUBLIC;
|
||||||
|
m.name = "*";
|
||||||
|
modifiers.put(name,m);
|
||||||
|
// methods
|
||||||
|
m = new Modifier();
|
||||||
|
m.targetAccess = ACC_PUBLIC;
|
||||||
|
m.name = "*";
|
||||||
|
m.desc = "<dummy>";
|
||||||
|
modifiers.put(name,m);
|
||||||
|
if (DEBUG)
|
||||||
|
{
|
||||||
|
System.out.printf("Injected all public modifiers for %s (%s)\n", name, transformedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Collection<Modifier> mods = modifiers.get(name);
|
Collection<Modifier> mods = modifiers.get(name);
|
||||||
for (Modifier m : mods)
|
for (Modifier m : mods)
|
||||||
{
|
{
|
||||||
@@ -375,7 +418,7 @@ public class AccessTransformer implements IClassTransformer
|
|||||||
|
|
||||||
for (AccessTransformer trans : transformers)
|
for (AccessTransformer trans : transformers)
|
||||||
{
|
{
|
||||||
entryData = trans.transform(name, entryData);
|
entryData = trans.transform(name, name, entryData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,4 +459,4 @@ public class AccessTransformer implements IClassTransformer
|
|||||||
m.modifyClassVisibility = true;
|
m.modifyClassVisibility = true;
|
||||||
modifiers.put(modClazzName, m);
|
modifiers.put(modClazzName, m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common.asm.transformers;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.commons.RemappingClassAdapter;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
|
import cpw.mods.fml.common.asm.transformers.deobf.FMLRemappingAdapter;
|
||||||
|
import cpw.mods.fml.relauncher.IClassNameTransformer;
|
||||||
|
import cpw.mods.fml.relauncher.IClassTransformer;
|
||||||
|
|
||||||
|
public class DeobfuscationTransformer implements IClassTransformer, IClassNameTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||||
|
{
|
||||||
|
if (bytes == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ClassReader classReader = new ClassReader(bytes);
|
||||||
|
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||||
|
RemappingClassAdapter remapAdapter = new FMLRemappingAdapter(classWriter);
|
||||||
|
classReader.accept(remapAdapter, ClassReader.EXPAND_FRAMES);
|
||||||
|
return classWriter.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String remapClassName(String name)
|
||||||
|
{
|
||||||
|
return FMLDeobfuscatingRemapper.INSTANCE.map(name.replace('.','/')).replace('/', '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String unmapClassName(String name)
|
||||||
|
{
|
||||||
|
return FMLDeobfuscatingRemapper.INSTANCE.unmap(name.replace('.', '/')).replace('/','.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm.transformers;
|
package cpw.mods.fml.common.asm.transformers;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
@@ -35,8 +47,8 @@ import com.google.common.base.Objects;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class MCPMerger
|
public class MCPMerger
|
||||||
{
|
{
|
||||||
@@ -45,6 +57,7 @@ public class MCPMerger
|
|||||||
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
|
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
|
||||||
private static HashSet<String> copyToServer = new HashSet<String>();
|
private static HashSet<String> copyToServer = new HashSet<String>();
|
||||||
private static HashSet<String> copyToClient = new HashSet<String>();
|
private static HashSet<String> copyToClient = new HashSet<String>();
|
||||||
|
private static HashSet<String> dontAnnotate = new HashSet<String>();
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
@@ -134,10 +147,16 @@ public class MCPMerger
|
|||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null)
|
while ((line = br.readLine()) != null)
|
||||||
{
|
{
|
||||||
boolean toClient = line.charAt(0) == '<';
|
line = line.split("#")[0];
|
||||||
line = line.substring(1);
|
char cmd = line.charAt(0);
|
||||||
if (toClient) copyToClient.add(line);
|
line = line.substring(1).trim();
|
||||||
else copyToServer.add(line);
|
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case '!': dontAnnotate.add(line); break;
|
||||||
|
case '<': copyToClient.add(line); break;
|
||||||
|
case '>': copyToServer.add(line); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
@@ -224,20 +243,14 @@ public class MCPMerger
|
|||||||
cAdded.add(name);
|
cAdded.add(name);
|
||||||
sAdded.add(name);
|
sAdded.add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
|
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
|
||||||
{
|
{
|
||||||
if (!copyToClient.contains(entry.getKey()))
|
if (DEBUG)
|
||||||
{
|
{
|
||||||
copyClass(sInJar, entry.getValue(), null, sOutJar, false);
|
System.out.println("Copy class s->c : " + entry.getKey());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.println("Copy class s->c : " + entry.getKey());
|
|
||||||
}
|
|
||||||
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
|
|
||||||
}
|
}
|
||||||
|
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
|
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
|
||||||
@@ -288,7 +301,7 @@ public class MCPMerger
|
|||||||
|
|
||||||
reader.accept(classNode, 0);
|
reader.accept(classNode, 0);
|
||||||
|
|
||||||
if (!classNode.name.equals("bct")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
|
if (!dontAnnotate.contains(classNode.name))
|
||||||
{
|
{
|
||||||
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
|
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||||
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
|
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm.transformers;
|
package cpw.mods.fml.common.asm.transformers;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -87,7 +99,7 @@ public class MarkerTransformer implements IClassTransformer
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public byte[] transform(String name, byte[] bytes)
|
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes == null) { return null; }
|
if (bytes == null) { return null; }
|
||||||
if (!markers.containsKey(name)) { return bytes; }
|
if (!markers.containsKey(name)) { return bytes; }
|
||||||
@@ -240,7 +252,7 @@ public class MarkerTransformer implements IClassTransformer
|
|||||||
|
|
||||||
for (MarkerTransformer trans : transformers)
|
for (MarkerTransformer trans : transformers)
|
||||||
{
|
{
|
||||||
entryData = trans.transform(name, entryData);
|
entryData = trans.transform(name, name, entryData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,4 +286,4 @@ public class MarkerTransformer implements IClassTransformer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.asm.transformers;
|
package cpw.mods.fml.common.asm.transformers;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -11,9 +23,9 @@ import org.objectweb.asm.tree.ClassNode;
|
|||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
import cpw.mods.fml.relauncher.FMLRelauncher;
|
import cpw.mods.fml.relauncher.FMLRelauncher;
|
||||||
import cpw.mods.fml.relauncher.IClassTransformer;
|
import cpw.mods.fml.relauncher.IClassTransformer;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class SideTransformer implements IClassTransformer
|
public class SideTransformer implements IClassTransformer
|
||||||
{
|
{
|
||||||
@@ -21,7 +33,7 @@ public class SideTransformer implements IClassTransformer
|
|||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public byte[] transform(String name, byte[] bytes)
|
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes == null) { return null; }
|
if (bytes == null) { return null; }
|
||||||
|
|
||||||
@@ -69,7 +81,7 @@ public class SideTransformer implements IClassTransformer
|
|||||||
classNode.accept(writer);
|
classNode.accept(writer);
|
||||||
return writer.toByteArray();
|
return writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean remove(List<AnnotationNode> anns, String side)
|
private boolean remove(List<AnnotationNode> anns, String side)
|
||||||
{
|
{
|
||||||
if (anns == null)
|
if (anns == null)
|
||||||
|
|||||||
@@ -0,0 +1,365 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common.asm.transformers.deobf;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
|
||||||
|
import com.google.common.base.CharMatcher;
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.common.collect.BiMap;
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.ListMultimap;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.common.collect.ImmutableBiMap.Builder;
|
||||||
|
import com.google.common.io.CharStreams;
|
||||||
|
import com.google.common.io.InputSupplier;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
import cpw.mods.fml.relauncher.FMLRelaunchLog;
|
||||||
|
import cpw.mods.fml.relauncher.RelaunchClassLoader;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
|
||||||
|
public class FMLDeobfuscatingRemapper extends Remapper {
|
||||||
|
public static final FMLDeobfuscatingRemapper INSTANCE = new FMLDeobfuscatingRemapper();
|
||||||
|
|
||||||
|
private BiMap<String, String> classNameBiMap;
|
||||||
|
private BiMap<String, String> mcpNameBiMap;
|
||||||
|
|
||||||
|
private Map<String,Map<String,String>> rawFieldMaps;
|
||||||
|
private Map<String,Map<String,String>> rawMethodMaps;
|
||||||
|
|
||||||
|
private Map<String,Map<String,String>> fieldNameMaps;
|
||||||
|
private Map<String,Map<String,String>> methodNameMaps;
|
||||||
|
|
||||||
|
private RelaunchClassLoader classLoader;
|
||||||
|
|
||||||
|
private FMLDeobfuscatingRemapper()
|
||||||
|
{
|
||||||
|
classNameBiMap=ImmutableBiMap.of();
|
||||||
|
mcpNameBiMap=ImmutableBiMap.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup(File mcDir, RelaunchClassLoader classLoader, String deobfFileName)
|
||||||
|
{
|
||||||
|
this.classLoader = classLoader;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File libDir = new File(mcDir, "lib");
|
||||||
|
File mapData = new File(libDir, deobfFileName);
|
||||||
|
mapData = mapData.getCanonicalFile();
|
||||||
|
ZipFile mapZip = new ZipFile(mapData);
|
||||||
|
ZipEntry classData = mapZip.getEntry("joined.srg");
|
||||||
|
ZipInputSupplier zis = new ZipInputSupplier(mapZip, classData);
|
||||||
|
InputSupplier<InputStreamReader> srgSupplier = CharStreams.newReaderSupplier(zis,Charsets.UTF_8);
|
||||||
|
List<String> srgList = CharStreams.readLines(srgSupplier);
|
||||||
|
rawMethodMaps = Maps.newHashMap();
|
||||||
|
rawFieldMaps = Maps.newHashMap();
|
||||||
|
Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
|
||||||
|
Builder<String, String> mcpBuilder = ImmutableBiMap.<String,String>builder();
|
||||||
|
Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
|
||||||
|
for (String line : srgList)
|
||||||
|
{
|
||||||
|
String[] parts = Iterables.toArray(splitter.split(line),String.class);
|
||||||
|
String typ = parts[0];
|
||||||
|
if ("CL".equals(typ))
|
||||||
|
{
|
||||||
|
parseClass(builder, parts);
|
||||||
|
parseMCPClass(mcpBuilder,parts);
|
||||||
|
}
|
||||||
|
else if ("MD".equals(typ))
|
||||||
|
{
|
||||||
|
parseMethod(parts);
|
||||||
|
}
|
||||||
|
else if ("FD".equals(typ))
|
||||||
|
{
|
||||||
|
parseField(parts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
classNameBiMap = builder.build();
|
||||||
|
// Special case some mappings for modloader mods
|
||||||
|
mcpBuilder.put("BaseMod","net/minecraft/src/BaseMod");
|
||||||
|
mcpBuilder.put("ModLoader","net/minecraft/src/ModLoader");
|
||||||
|
mcpBuilder.put("EntityRendererProxy","net/minecraft/src/EntityRendererProxy");
|
||||||
|
mcpBuilder.put("MLProp","net/minecraft/src/MLProp");
|
||||||
|
mcpBuilder.put("TradeEntry","net/minecraft/src/TradeEntry");
|
||||||
|
mcpNameBiMap = mcpBuilder.build();
|
||||||
|
}
|
||||||
|
catch (IOException ioe)
|
||||||
|
{
|
||||||
|
FMLRelaunchLog.log(Level.SEVERE, ioe, "An error occurred loading the deobfuscation map data");
|
||||||
|
}
|
||||||
|
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
|
||||||
|
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemappedClass(String className)
|
||||||
|
{
|
||||||
|
className = className.replace('.', '/');
|
||||||
|
return classNameBiMap.containsKey(className) || mcpNameBiMap.containsKey(className) || (!classNameBiMap.isEmpty() && className.indexOf('/') == -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseField(String[] parts)
|
||||||
|
{
|
||||||
|
String oldSrg = parts[1];
|
||||||
|
int lastOld = oldSrg.lastIndexOf('/');
|
||||||
|
String cl = oldSrg.substring(0,lastOld);
|
||||||
|
String oldName = oldSrg.substring(lastOld+1);
|
||||||
|
String newSrg = parts[2];
|
||||||
|
int lastNew = newSrg.lastIndexOf('/');
|
||||||
|
String newName = newSrg.substring(lastNew+1);
|
||||||
|
if (!rawFieldMaps.containsKey(cl))
|
||||||
|
{
|
||||||
|
rawFieldMaps.put(cl, Maps.<String,String>newHashMap());
|
||||||
|
}
|
||||||
|
rawFieldMaps.get(cl).put(oldName + ":" + getFieldType(cl, oldName), newName);
|
||||||
|
rawFieldMaps.get(cl).put(oldName + ":null", newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache the field descriptions for classes so we don't repeatedly reload the same data again and again
|
||||||
|
*/
|
||||||
|
private Map<String,Map<String,String>> fieldDescriptions = Maps.newHashMap();
|
||||||
|
|
||||||
|
private String getFieldType(String owner, String name)
|
||||||
|
{
|
||||||
|
if (fieldDescriptions.containsKey(owner))
|
||||||
|
{
|
||||||
|
return fieldDescriptions.get(owner).get(name);
|
||||||
|
}
|
||||||
|
synchronized (fieldDescriptions)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] classBytes = classLoader.getClassBytes(owner);
|
||||||
|
if (classBytes == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ClassReader cr = new ClassReader(classBytes);
|
||||||
|
ClassNode classNode = new ClassNode();
|
||||||
|
cr.accept(classNode, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||||
|
Map<String,String> resMap = Maps.newHashMap();
|
||||||
|
for (FieldNode fieldNode : (List<FieldNode>) classNode.fields) {
|
||||||
|
resMap.put(fieldNode.name, fieldNode.desc);
|
||||||
|
}
|
||||||
|
fieldDescriptions.put(owner, resMap);
|
||||||
|
return resMap.get(name);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.SEVERE,e, "A critical exception occured reading a class file %s", owner);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseClass(Builder<String, String> builder, String[] parts)
|
||||||
|
{
|
||||||
|
builder.put(parts[1],parts[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseMCPClass(Builder<String, String> builder, String[] parts)
|
||||||
|
{
|
||||||
|
int clIdx = parts[2].lastIndexOf('/');
|
||||||
|
builder.put("net/minecraft/src/"+parts[2].substring(clIdx+1),parts[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseMethod(String[] parts)
|
||||||
|
{
|
||||||
|
String oldSrg = parts[1];
|
||||||
|
int lastOld = oldSrg.lastIndexOf('/');
|
||||||
|
String cl = oldSrg.substring(0,lastOld);
|
||||||
|
String oldName = oldSrg.substring(lastOld+1);
|
||||||
|
String sig = parts[2];
|
||||||
|
String newSrg = parts[3];
|
||||||
|
int lastNew = newSrg.lastIndexOf('/');
|
||||||
|
String newName = newSrg.substring(lastNew+1);
|
||||||
|
if (!rawMethodMaps.containsKey(cl))
|
||||||
|
{
|
||||||
|
rawMethodMaps.put(cl, Maps.<String,String>newHashMap());
|
||||||
|
}
|
||||||
|
rawMethodMaps.get(cl).put(oldName+sig, newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String mapFieldName(String owner, String name, String desc)
|
||||||
|
{
|
||||||
|
if (classNameBiMap == null || classNameBiMap.isEmpty())
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
Map<String, String> fieldMap = getFieldMap(owner);
|
||||||
|
return fieldMap!=null && fieldMap.containsKey(name+":"+desc) ? fieldMap.get(name+":"+desc) : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String map(String typeName)
|
||||||
|
{
|
||||||
|
if (classNameBiMap == null || classNameBiMap.isEmpty())
|
||||||
|
{
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dollarIdx = typeName.indexOf('$');
|
||||||
|
String realType = dollarIdx > -1 ? typeName.substring(0, dollarIdx) : typeName;
|
||||||
|
String subType = dollarIdx > -1 ? typeName.substring(dollarIdx+1) : "";
|
||||||
|
|
||||||
|
String result = classNameBiMap.containsKey(realType) ? classNameBiMap.get(realType) : mcpNameBiMap.containsKey(realType) ? mcpNameBiMap.get(realType) : realType;
|
||||||
|
result = dollarIdx > -1 ? result+"$"+subType : result;
|
||||||
|
// System.out.printf("Mapping %s=>%s\n",typeName,result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String unmap(String typeName)
|
||||||
|
{
|
||||||
|
if (classNameBiMap == null || classNameBiMap.isEmpty())
|
||||||
|
{
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
int dollarIdx = typeName.indexOf('$');
|
||||||
|
String realType = dollarIdx > -1 ? typeName.substring(0, dollarIdx) : typeName;
|
||||||
|
String subType = dollarIdx > -1 ? typeName.substring(dollarIdx+1) : "";
|
||||||
|
|
||||||
|
|
||||||
|
String result = classNameBiMap.containsValue(realType) ? classNameBiMap.inverse().get(realType) : mcpNameBiMap.containsValue(realType) ? mcpNameBiMap.inverse().get(realType) : realType;
|
||||||
|
result = dollarIdx > -1 ? result+"$"+subType : result;
|
||||||
|
// System.out.printf("Unmapping %s=>%s\n",typeName,result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String mapMethodName(String owner, String name, String desc)
|
||||||
|
{
|
||||||
|
if (classNameBiMap==null || classNameBiMap.isEmpty())
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
Map<String, String> methodMap = getMethodMap(owner);
|
||||||
|
String methodDescriptor = name+desc;
|
||||||
|
return methodMap!=null && methodMap.containsKey(methodDescriptor) ? methodMap.get(methodDescriptor) : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String,String> getFieldMap(String className)
|
||||||
|
{
|
||||||
|
if (!fieldNameMaps.containsKey(className))
|
||||||
|
{
|
||||||
|
findAndMergeSuperMaps(className);
|
||||||
|
}
|
||||||
|
return fieldNameMaps.get(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String,String> getMethodMap(String className)
|
||||||
|
{
|
||||||
|
if (!methodNameMaps.containsKey(className))
|
||||||
|
{
|
||||||
|
findAndMergeSuperMaps(className);
|
||||||
|
}
|
||||||
|
return methodNameMaps.get(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findAndMergeSuperMaps(String name)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] classBytes = classLoader.getClassBytes(name);
|
||||||
|
if (classBytes == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ClassReader cr = new ClassReader(classBytes);
|
||||||
|
String superName = cr.getSuperName();
|
||||||
|
String[] interfaces = cr.getInterfaces();
|
||||||
|
if (interfaces == null)
|
||||||
|
{
|
||||||
|
interfaces = new String[0];
|
||||||
|
}
|
||||||
|
mergeSuperMaps(name, superName, interfaces);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void mergeSuperMaps(String name, String superName, String[] interfaces)
|
||||||
|
{
|
||||||
|
// System.out.printf("Computing super maps for %s: %s %s\n", name, superName, Arrays.asList(interfaces));
|
||||||
|
if (classNameBiMap == null || classNameBiMap.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Skip Object
|
||||||
|
if (Strings.isNullOrEmpty(superName))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> allParents = ImmutableList.<String>builder().add(superName).addAll(Arrays.asList(interfaces)).build();
|
||||||
|
// generate maps for all parent objects
|
||||||
|
for (String parentThing : allParents)
|
||||||
|
{
|
||||||
|
if (!methodNameMaps.containsKey(parentThing))
|
||||||
|
{
|
||||||
|
findAndMergeSuperMaps(parentThing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, String> methodMap = Maps.<String,String>newHashMap();
|
||||||
|
Map<String, String> fieldMap = Maps.<String,String>newHashMap();
|
||||||
|
for (String parentThing : allParents)
|
||||||
|
{
|
||||||
|
if (methodNameMaps.containsKey(parentThing))
|
||||||
|
{
|
||||||
|
methodMap.putAll(methodNameMaps.get(parentThing));
|
||||||
|
}
|
||||||
|
if (fieldNameMaps.containsKey(parentThing))
|
||||||
|
{
|
||||||
|
fieldMap.putAll(fieldNameMaps.get(parentThing));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rawMethodMaps.containsKey(name))
|
||||||
|
{
|
||||||
|
methodMap.putAll(rawMethodMaps.get(name));
|
||||||
|
}
|
||||||
|
if (rawFieldMaps.containsKey(name))
|
||||||
|
{
|
||||||
|
fieldMap.putAll(rawFieldMaps.get(name));
|
||||||
|
}
|
||||||
|
methodNameMaps.put(name, ImmutableMap.copyOf(methodMap));
|
||||||
|
fieldNameMaps.put(name, ImmutableMap.copyOf(fieldMap));
|
||||||
|
// System.out.printf("Maps: %s %s\n", name, methodMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common.asm.transformers.deobf;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.commons.Remapper;
|
||||||
|
import org.objectweb.asm.commons.RemappingClassAdapter;
|
||||||
|
|
||||||
|
public class FMLRemappingAdapter extends RemappingClassAdapter {
|
||||||
|
public FMLRemappingAdapter(ClassVisitor cv)
|
||||||
|
{
|
||||||
|
super(cv, FMLDeobfuscatingRemapper.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
|
||||||
|
{
|
||||||
|
if (interfaces == null)
|
||||||
|
{
|
||||||
|
interfaces = new String[0];
|
||||||
|
}
|
||||||
|
FMLDeobfuscatingRemapper.INSTANCE.mergeSuperMaps(name, superName, interfaces);
|
||||||
|
super.visit(version, access, name, signature, superName, interfaces);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cpw.mods.fml.common.asm.transformers.deobf;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import com.google.common.io.InputSupplier;
|
||||||
|
|
||||||
|
public class ZipInputSupplier implements InputSupplier<InputStream> {
|
||||||
|
private ZipFile zipFile;
|
||||||
|
private ZipEntry zipEntry;
|
||||||
|
|
||||||
|
public ZipInputSupplier(ZipFile zip, ZipEntry entry)
|
||||||
|
{
|
||||||
|
this.zipFile = zip;
|
||||||
|
this.zipEntry = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputStream getInput() throws IOException
|
||||||
|
{
|
||||||
|
return zipFile.getInputStream(zipEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.discovery;
|
package cpw.mods.fml.common.discovery;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.discovery;
|
package cpw.mods.fml.common.discovery;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,4 +41,4 @@ public enum ContainerType
|
|||||||
{
|
{
|
||||||
return discoverer.discover(candidate, table);
|
return discoverer.discover(candidate, table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Forge Mod Loader
|
||||||
|
* Copyright (c) 2012-2013 cpw.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the GNU Lesser Public License v2.1
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* cpw - implementation
|
||||||
|
*/
|
||||||
|
|
||||||
package cpw.mods.fml.common.discovery;
|
package cpw.mods.fml.common.discovery;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
Loaded 100 of 372 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user