mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
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 |
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,6 @@
|
|||||||
fmlbranding.properties
|
fmlbranding.properties
|
||||||
/fernflower.zip
|
/fernflower.zip
|
||||||
/commands.py.bck
|
/commands.py.bck
|
||||||
|
/mcp*.zip
|
||||||
|
/mcp
|
||||||
|
/eclipse
|
||||||
@@ -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" />
|
||||||
@@ -38,21 +24,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 +53,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 +63,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 +87,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 +108,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,52 +124,29 @@
|
|||||||
</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" />
|
|
||||||
<zip destfile="${basedir}/target/${jarname}.zip">
|
|
||||||
<fileset dir="${output}" 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>
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-universal" depends="build-client">
|
|
||||||
<property name="universal.jarname" value="${modname}-universal-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
<mkdir dir="${basedir}/target" />
|
||||||
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
||||||
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" />
|
<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="${common.src.dir}" includes="mcpmod.info" />
|
||||||
@@ -197,13 +168,13 @@
|
|||||||
</concat>
|
</concat>
|
||||||
<mergemapper to="README-fml.txt" />
|
<mergemapper to="README-fml.txt" />
|
||||||
</mappedresources>
|
</mappedresources>
|
||||||
</jar>
|
</zip>
|
||||||
</target>
|
</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="${client.src.dir}" includes="mcp.png" prefix="fml/client" />
|
||||||
@@ -212,6 +183,7 @@
|
|||||||
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" 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" />
|
||||||
@@ -231,7 +203,7 @@
|
|||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-client,build-universal,build-source-pack" />
|
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-universal,build-source-pack" />
|
||||||
|
|
||||||
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
|
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
|
||||||
|
|
||||||
@@ -252,7 +224,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}"/>
|
||||||
@@ -270,14 +242,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}" />
|
||||||
@@ -285,11 +254,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}" />
|
||||||
@@ -329,20 +294,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">
|
||||||
@@ -353,6 +319,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}"/>
|
||||||
@@ -368,4 +341,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>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
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,6 +121,8 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
|
|
||||||
private DuplicateModsFoundException dupesFound;
|
private DuplicateModsFoundException dupesFound;
|
||||||
|
|
||||||
|
private boolean serverShouldBeKilledQuietly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to start the whole game off
|
* Called to start the whole game off
|
||||||
*
|
*
|
||||||
@@ -129,7 +140,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
loading = true;
|
loading = true;
|
||||||
client = minecraft;
|
client = minecraft;
|
||||||
ObfuscationReflectionHelper.detectObfuscation(World.class);
|
ObfuscationReflectionHelper.detectObfuscation(World.class);
|
||||||
TextureFXManager.instance().setClient(client);
|
// TextureFXManager.instance().setClient(client);
|
||||||
FMLCommonHandler.instance().beginLoading(this);
|
FMLCommonHandler.instance().beginLoading(this);
|
||||||
new ModLoaderClientHelper(client);
|
new ModLoaderClientHelper(client);
|
||||||
try
|
try
|
||||||
@@ -233,7 +244,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
|
// TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -289,7 +300,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +414,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||||||
@Override
|
@Override
|
||||||
public void beginServerLoading(MinecraftServer server)
|
public void beginServerLoading(MinecraftServer server)
|
||||||
{
|
{
|
||||||
|
serverShouldBeKilledQuietly = false;
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,4 +470,64 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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,8 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ 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,88 @@
|
|||||||
|
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 (ModID: %s, type %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. World: (ModID: %s, type %s, ordinal %d) Game (ModID: %s, type %s, ordinal %d)", world.getItemId(), world.getModId(), world.getItemType(), world.getOrdinal(), game.getModId(), game.getItemType(), game.getOrdinal()));
|
||||||
|
}
|
||||||
|
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() * 10 + mismatchedIds.size() * 30, 10);
|
||||||
|
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found world ID mismatches", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||||
|
offset += 10;
|
||||||
|
for (String s: missingIds) {
|
||||||
|
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
|
offset += 10;
|
||||||
|
}
|
||||||
|
for (String s: mismatchedIds) {
|
||||||
|
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||||
|
offset += 10;
|
||||||
|
}
|
||||||
|
offset += 10;
|
||||||
|
if (allowContinue)
|
||||||
|
{
|
||||||
|
this.func_73732_a(this.field_73886_k, "Do you wish to continue loading?", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||||
|
offset += 10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.func_73732_a(this.field_73886_k, "You cannot connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||||
|
offset += 10;
|
||||||
|
}
|
||||||
|
// 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 = Math.min(offset + 10, 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_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,14 +16,17 @@ package cpw.mods.fml.client;
|
|||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.client.renderer.texture.Texture;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.util.StringTranslate;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@@ -54,7 +57,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 +67,10 @@ public class GuiModList extends GuiScreen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mod.getMetadata()!=null && mod.getMetadata().parentMod!=null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,17 +121,16 @@ public class GuiModList extends GuiScreen
|
|||||||
int shifty = 35;
|
int shifty = 35;
|
||||||
if (!selectedMod.getMetadata().logoFile.isEmpty())
|
if (!selectedMod.getMetadata().logoFile.isEmpty())
|
||||||
{
|
{
|
||||||
int texture = this.field_73882_e.field_71446_o.func_78341_b(selectedMod.getMetadata().logoFile);
|
List<Texture> texList = TextureManager.func_94267_b().func_94266_e(selectedMod.getMetadata().logoFile);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
Texture texture = texList.get(0);
|
||||||
this.field_73882_e.field_71446_o.func_78342_b(texture);
|
texture.func_94277_a(0);
|
||||||
Dimension dim = TextureFXManager.instance().getTextureDimensions(texture);
|
|
||||||
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();
|
||||||
tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1);
|
tess.func_78374_a(offset, top + texture.func_94284_b(), field_73735_i, 0, 1);
|
||||||
tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1);
|
tess.func_78374_a(offset + texture.func_94282_c(), top + texture.func_94284_b(), field_73735_i, 1, 1);
|
||||||
tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0);
|
tess.func_78374_a(offset + texture.func_94282_c(), top, field_73735_i, 1, 0);
|
||||||
tess.func_78374_a(offset, top, field_73735_i, 0, 0);
|
tess.func_78374_a(offset, top, field_73735_i, 0, 0);
|
||||||
tess.func_78381_a();
|
tess.func_78381_a();
|
||||||
|
|
||||||
shifty += 65;
|
shifty += 65;
|
||||||
@@ -133,7 +139,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
public class GuiModsMissing extends GuiErrorScreen
|
public class GuiModsMissing extends GuiErrorScreen
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
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;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ 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;
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ 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,9 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ 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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -60,12 +60,12 @@ public class SpriteHelper
|
|||||||
"0000000000000000" +
|
"0000000000000000" +
|
||||||
"0000000000000000" +
|
"0000000000000000" +
|
||||||
"0000000000000000" +
|
"0000000000000000" +
|
||||||
"0111100000000000" +
|
"0111110000000000" +
|
||||||
"1111100010000000" +
|
"1111111010000000" +
|
||||||
"0000101110000000" +
|
"0111111110000000" +
|
||||||
"0111000000000000" +
|
"0111111111111001" +
|
||||||
"1100001100001111" +
|
"1111111111111111" +
|
||||||
"0000000000001111" +
|
"0000011111111111" +
|
||||||
"0000000000000000");
|
"0000000000000000");
|
||||||
spriteInfo.put("/gui/items.png", slots);
|
spriteInfo.put("/gui/items.png", slots);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,306 +1,24 @@
|
|||||||
package cpw.mods.fml.client;
|
package cpw.mods.fml.client;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_BINDING_2D;
|
|
||||||
|
|
||||||
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 javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.src.ModTextureStatic;
|
import net.minecraft.client.renderer.RenderEngine;
|
||||||
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.Multimap;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,17 +7,18 @@ 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.Equivalences;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|||||||
@@ -23,7 +23,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,9 @@
|
|||||||
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,8 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ 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 +14,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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,11 @@ 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;
|
||||||
@@ -109,7 +106,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ 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.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;
|
||||||
@@ -47,31 +53,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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,8 +20,40 @@ 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.SpriteHelper;
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
import cpw.mods.fml.client.TextureFXManager;
|
||||||
@@ -34,7 +66,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 +74,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
|
||||||
@@ -87,12 +119,6 @@ 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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+47
-114
@@ -9,26 +9,7 @@
|
|||||||
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 @@
|
@@ -788,6 +790,8 @@
|
||||||
self.has_astyle_cfg = False
|
|
||||||
if os.path.isfile(self.astyleconf):
|
|
||||||
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):
|
|
||||||
"""Create the files necessary for RetroGuard"""
|
|
||||||
@@ -781,13 +786,16 @@
|
|
||||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
|
|
||||||
- return False
|
|
||||||
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))):
|
|
||||||
+ return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def checkbins(self, side):
|
|
||||||
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
|
||||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
||||||
|
|
||||||
@@ -37,7 +18,7 @@
|
|||||||
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@@ -1029,6 +1037,10 @@
|
@@ -1029,6 +1033,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}
|
||||||
|
|
||||||
@@ -48,33 +29,25 @@
|
|||||||
if not os.path.exists(pathbinlk[side]):
|
if not os.path.exists(pathbinlk[side]):
|
||||||
os.makedirs(pathbinlk[side])
|
os.makedirs(pathbinlk[side])
|
||||||
|
|
||||||
@@ -1041,6 +1053,7 @@
|
@@ -1062,7 +1070,7 @@
|
||||||
all_files = True
|
|
||||||
append_pattern = False
|
|
||||||
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
|
|
||||||
dirs = ' '.join(pkglist)
|
|
||||||
classpath = os.pathsep.join(cplk[side])
|
|
||||||
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
|
||||||
@@ -1062,7 +1075,7 @@
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def startserver(self):
|
def startserver(self):
|
||||||
- classpath = [self.binserver] + self.cpathserver
|
- classpath = [self.binserver] + self.cpathserver
|
||||||
+ classpath = [self.binclient, 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 +1083,7 @@
|
@@ -1070,7 +1078,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 +1210,20 @@
|
@@ -1197,20 +1205,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:
|
||||||
@@ -98,56 +71,7 @@
|
|||||||
names['params'][row['param']] = row['name']
|
names['params'][row['param']] = row['name']
|
||||||
|
|
||||||
regexps = {
|
regexps = {
|
||||||
@@ -1240,6 +1253,11 @@
|
@@ -1344,13 +1352,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 +1340,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 +1356,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 +1379,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
|
||||||
@@ -163,13 +87,7 @@
|
|||||||
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
||||||
|
|
||||||
regexps = {
|
regexps = {
|
||||||
@@ -1422,12 +1457,13 @@
|
@@ -1427,7 +1435,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
|
||||||
|
|
||||||
@@ -178,7 +96,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 +1478,9 @@
|
@@ -1442,6 +1450,9 @@
|
||||||
class_path = ''
|
class_path = ''
|
||||||
else:
|
else:
|
||||||
class_path += '/'
|
class_path += '/'
|
||||||
@@ -188,7 +106,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 +1633,9 @@
|
@@ -1535,6 +1546,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:
|
||||||
|
@@ -1548,6 +1561,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)
|
||||||
|
@@ -1594,6 +1624,9 @@
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for entry in newfiles:
|
for entry in newfiles:
|
||||||
@@ -198,7 +149,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 +1656,9 @@
|
@@ -1614,6 +1647,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}
|
||||||
@@ -208,28 +159,10 @@
|
|||||||
|
|
||||||
# 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 +1691,7 @@
|
@@ -1656,3 +1692,6 @@
|
||||||
# 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 +1701,15 @@
|
|
||||||
self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
|
||||||
except IOError:
|
except IOError:
|
||||||
self.logger.error('* File %s copy failed', in_class)
|
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():
|
+def commands_sanity_check():
|
||||||
+ print 'Commands patch applied successfully'
|
+ print 'Commands patch applied successfully'
|
||||||
+
|
+
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
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,7 @@
|
|||||||
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 +139,10 @@ public class DummyModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,28 +20,28 @@ import java.util.Properties;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.src.CrashReport;
|
import net.minecraft.crash.CrashReportCategory;
|
||||||
import net.minecraft.src.CrashReportCategory;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.src.DedicatedServer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.src.NBTBase;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.NBTTagCompound;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.packet.Packet131MapData;
|
||||||
import net.minecraft.src.Packet131MapData;
|
import net.minecraft.server.*;
|
||||||
import net.minecraft.src.SaveHandler;
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
import net.minecraft.src.ServerListenThread;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.ThreadMinecraftServer;
|
import net.minecraft.world.storage.SaveHandler;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.storage.WorldInfo;
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -49,7 +49,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;
|
||||||
|
|
||||||
|
|
||||||
@@ -441,4 +443,19 @@ public class FMLCommonHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldServerBeKilledQuietly()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,22 +14,23 @@
|
|||||||
|
|
||||||
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 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
|
||||||
*
|
*
|
||||||
@@ -75,6 +76,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,5 +105,23 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -49,10 +55,12 @@ import cpw.mods.fml.common.event.FMLConstructionEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLEvent;
|
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.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.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;
|
||||||
@@ -85,11 +93,16 @@ public class FMLModContainer implements ModContainer
|
|||||||
.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(IMCEvent.class,Mod.IMCCallback.class)
|
||||||
|
.put(FMLFingerprintViolationEvent.class, Mod.FingerprintWarning.class)
|
||||||
.build();
|
.build();
|
||||||
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLEvent>> 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;
|
||||||
|
|
||||||
|
|
||||||
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
||||||
@@ -335,13 +348,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
|
||||||
@@ -408,12 +414,51 @@ 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(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 = clazz.newInstance();
|
||||||
|
if (fingerprintNotPresent)
|
||||||
|
{
|
||||||
|
eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint));
|
||||||
|
}
|
||||||
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
|
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
|
||||||
processFieldAnnotations(event.getASMHarvestedData());
|
processFieldAnnotations(event.getASMHarvestedData());
|
||||||
}
|
}
|
||||||
@@ -479,4 +524,10 @@ public class FMLModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
return minecraftAccepted;
|
return minecraftAccepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return certificate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
*/
|
*/
|
||||||
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
|
||||||
|
|||||||
@@ -14,10 +14,17 @@ package cpw.mods.fml.common;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated without replacement, use vanilla DispenserRegistry code
|
||||||
|
*
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IDispenseHandler
|
public interface IDispenseHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,13 +2,17 @@ package cpw.mods.fml.common;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Deprecated without replacement. Use vanilla DispenserRegistry code.
|
||||||
|
*
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IDispenserHandler
|
public interface IDispenserHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,15 +2,20 @@ 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 +46,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,6 +1,6 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
*/
|
*/
|
||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ 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,7 @@
|
|||||||
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 +130,10 @@ public class InjectedModContainer implements ModContainer
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return wrappedContainer.getSigningCertificate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ 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");
|
FMLLog.severe("The following problems were captured during this phase");
|
||||||
for (Entry<String, Throwable> error : errors.entries())
|
for (Entry<String, Throwable> error : errors.entries())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ 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.server.MinecraftServer;
|
||||||
|
|
||||||
import com.google.common.base.CharMatcher;
|
import com.google.common.base.CharMatcher;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@@ -476,6 +477,11 @@ 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()));
|
||||||
|
}
|
||||||
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);
|
||||||
@@ -705,8 +711,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()
|
||||||
@@ -721,7 +725,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)
|
||||||
@@ -735,10 +739,17 @@ public class Loader
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasReachedState(LoaderState state) {
|
public boolean hasReachedState(LoaderState state) {
|
||||||
return modController.hasReachedState(state);
|
return modController != null ? modController.hasReachedState(state) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMCPVersionString() {
|
public String getMCPVersionString() {
|
||||||
return String.format("MCP v%s", mcpversion);
|
return String.format("MCP v%s", mcpversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void serverStopped()
|
||||||
|
{
|
||||||
|
modController.distributeStateMessage(LoaderState.SERVER_STOPPED);
|
||||||
|
modController.transition(LoaderState.SERVER_STOPPED);
|
||||||
|
modController.transition(LoaderState.AVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ 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.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;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ public enum LoaderState
|
|||||||
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);
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ public enum LoaderState
|
|||||||
return ERRORED;
|
return ERRORED;
|
||||||
}
|
}
|
||||||
// stopping -> available
|
// stopping -> available
|
||||||
if (this == SERVER_STOPPING)
|
if (this == SERVER_STOPPED)
|
||||||
{
|
{
|
||||||
return AVAILABLE;
|
return AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ 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.item.ItemBlock;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
import net.minecraft.src.ItemBlock;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new mod style in FML 1.3
|
* The new mod style in FML 1.3
|
||||||
*
|
*
|
||||||
@@ -100,6 +100,26 @@ public @interface Mod
|
|||||||
* @return A string listing modids to exclude from loading with this mod.
|
* @return A string listing modids to exclude from loading with this mod.
|
||||||
*/
|
*/
|
||||||
String modExclusionList() default "";
|
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 "";
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
@@ -148,6 +168,14 @@ public @interface Mod
|
|||||||
@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
|
* Mark the designated method as the receiver for {@link FMLInterModComms} messages
|
||||||
* Called between {@link Init} and {@link PostInit}
|
* Called between {@link Init} and {@link PostInit}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
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 +130,6 @@ public interface ModContainer
|
|||||||
String getDisplayVersion();
|
String getDisplayVersion();
|
||||||
|
|
||||||
VersionRange acceptableMinecraftVersionRange();
|
VersionRange acceptableMinecraftVersionRange();
|
||||||
|
|
||||||
|
Certificate getSigningCertificate();
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,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
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ 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,5 +1,22 @@
|
|||||||
package cpw.mods.fml.common.asm;
|
package cpw.mods.fml.common.asm;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
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 +26,15 @@ 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.FMLLog;
|
||||||
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 +59,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))
|
||||||
|
{
|
||||||
|
FMLLog.info("Found valid fingerprint for FML. Certificate fingerprint %s", fingerprint);
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
else if (fingerprint.equals(FORGEFINGERPRINT))
|
||||||
|
{
|
||||||
|
FMLLog.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint %s", fingerprint);
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FMLLog.severe("Found invalid fingerprint for FML: %s", fingerprint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goodFML = true;
|
||||||
|
}
|
||||||
|
if (!goodFML)
|
||||||
|
{
|
||||||
|
FMLLog.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)
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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 {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -35,8 +35,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 +45,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,11 +135,16 @@ public class MCPMerger
|
|||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null)
|
while ((line = br.readLine()) != null)
|
||||||
{
|
{
|
||||||
line = line.split("#")[0];
|
line = line.split("#")[0];
|
||||||
boolean toClient = line.charAt(0) == '<';
|
char cmd = line.charAt(0);
|
||||||
line = line.substring(1).trim();
|
line = line.substring(1).trim();
|
||||||
if (toClient) copyToClient.add(line);
|
|
||||||
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();
|
||||||
@@ -225,20 +231,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()})
|
||||||
@@ -289,7 +289,7 @@ public class MCPMerger
|
|||||||
|
|
||||||
reader.accept(classNode, 0);
|
reader.accept(classNode, 0);
|
||||||
|
|
||||||
if (!classNode.name.equals("bdz")) //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));
|
||||||
|
|||||||
@@ -11,9 +11,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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public class JarDiscoverer implements ITypeDiscoverer
|
|||||||
}
|
}
|
||||||
for (ZipEntry ze : Collections.list(jar.entries()))
|
for (ZipEntry ze : Collections.list(jar.entries()))
|
||||||
{
|
{
|
||||||
|
if (ze.getName()!=null && ze.getName().startsWith("__MACOSX"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Matcher match = classFile.matcher(ze.getName());
|
Matcher match = classFile.matcher(ze.getName());
|
||||||
if (match.matches())
|
if (match.matches())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cpw.mods.fml.common.event;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
|
||||||
|
public class FMLFingerprintViolationEvent extends FMLEvent {
|
||||||
|
|
||||||
|
public final boolean isDirectory;
|
||||||
|
public final Set<String> fingerprints;
|
||||||
|
public final File source;
|
||||||
|
public final String expectedFingerprint;
|
||||||
|
|
||||||
|
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.isDirectory = isDirectory;
|
||||||
|
this.source = source;
|
||||||
|
this.fingerprints = fingerprints;
|
||||||
|
this.expectedFingerprint = expectedFingerprint;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,9 @@ package cpw.mods.fml.common.event;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Functions;
|
import com.google.common.base.Functions;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
@@ -13,80 +16,197 @@ import com.google.common.collect.ImmutableListMultimap;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.LoaderState;
|
import cpw.mods.fml.common.LoaderState;
|
||||||
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.Mod.Init;
|
import cpw.mods.fml.common.Mod.Init;
|
||||||
import cpw.mods.fml.common.Mod.PostInit;
|
import cpw.mods.fml.common.Mod.PostInit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple intermod communications to receive simple messages directed at you from
|
* Simple intermod communications to receive simple messages directed at you
|
||||||
* other mods
|
* from other mods
|
||||||
*
|
*
|
||||||
* @author cpw
|
* @author cpw
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FMLInterModComms {
|
public class FMLInterModComms {
|
||||||
private static ArrayListMultimap<String, IMCMessage> modMessages = ArrayListMultimap.create();
|
private static final ImmutableList<IMCMessage> emptyIMCList = ImmutableList.<IMCMessage>of();
|
||||||
/**
|
private static ArrayListMultimap<String, IMCMessage> modMessages = ArrayListMultimap.create();
|
||||||
* Subscribe to this event to receive your messages (they are sent between {@link Init} and {@link PostInit})
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static class IMCEvent extends FMLEvent {
|
|
||||||
@Override
|
|
||||||
public void applyModContainer(ModContainer activeContainer) {
|
|
||||||
currentList = ImmutableList.copyOf(modMessages.get(activeContainer.getModId()));
|
|
||||||
}
|
|
||||||
private ImmutableList<IMCMessage> currentList;
|
|
||||||
|
|
||||||
public ImmutableList<IMCMessage> getMessages()
|
/**
|
||||||
{
|
* Subscribe to this event to receive your messages (they are sent between
|
||||||
return currentList;
|
* {@link Init} and {@link PostInit})
|
||||||
}
|
*
|
||||||
}
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static class IMCEvent extends FMLEvent {
|
||||||
|
@Override
|
||||||
|
public void applyModContainer(ModContainer activeContainer)
|
||||||
|
{
|
||||||
|
currentList = ImmutableList.copyOf(modMessages.removeAll(activeContainer.getModId()));
|
||||||
|
FMLLog.finest("Attempting to deliver %d IMC messages to mod %s", currentList.size(), activeContainer.getModId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
private ImmutableList<IMCMessage> currentList;
|
||||||
* You will receive an instance of this for each message sent
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static final class IMCMessage {
|
|
||||||
/**
|
|
||||||
* This is the modid of the mod that sent you the message
|
|
||||||
*/
|
|
||||||
public final String sender;
|
|
||||||
|
|
||||||
/**
|
public ImmutableList<IMCMessage> getMessages()
|
||||||
* This field, and {@link #value} are both at the mod's discretion
|
{
|
||||||
*/
|
return currentList;
|
||||||
public final String key;
|
}
|
||||||
/**
|
}
|
||||||
* This field, and {@link #key} are both at the mod's discretion
|
|
||||||
*/
|
|
||||||
public final String value;
|
|
||||||
|
|
||||||
private IMCMessage(String sender, String key, String value)
|
/**
|
||||||
{
|
* You will receive an instance of this for each message sent
|
||||||
this.key = key;
|
*
|
||||||
this.value = value;
|
* @author cpw
|
||||||
this.sender = sender;
|
*
|
||||||
}
|
*/
|
||||||
@Override
|
public static final class IMCMessage {
|
||||||
public String toString() {
|
/**
|
||||||
return sender;
|
* This is the modid of the mod that sent you the message
|
||||||
}
|
*/
|
||||||
}
|
private String sender;
|
||||||
|
/**
|
||||||
|
* This field, and {@link #value} are both at the mod's discretion
|
||||||
|
*/
|
||||||
|
public final String key;
|
||||||
|
/**
|
||||||
|
* This field, and {@link #key} are both at the mod's discretion
|
||||||
|
*/
|
||||||
|
private Object value;
|
||||||
|
|
||||||
public static boolean sendMessage(String modId, String key, String value)
|
private IMCMessage(String key, Object value)
|
||||||
{
|
{
|
||||||
if (Loader.instance().activeModContainer()==null)
|
this.key = key;
|
||||||
{
|
this.value = value;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
modMessages.put(modId, new IMCMessage(Loader.instance().activeModContainer().getModId(), key, value));
|
@Override
|
||||||
return Loader.isModLoaded(modId) && !Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION);
|
public String toString()
|
||||||
}
|
{
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender()
|
||||||
|
{
|
||||||
|
return this.sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSender(ModContainer activeModContainer)
|
||||||
|
{
|
||||||
|
this.sender = activeModContainer.getModId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStringValue()
|
||||||
|
{
|
||||||
|
return (String) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound getNBTValue()
|
||||||
|
{
|
||||||
|
return (NBTTagCompound) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getItemStackValue()
|
||||||
|
{
|
||||||
|
return (ItemStack) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getMessageType()
|
||||||
|
{
|
||||||
|
return value.getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStringMessage()
|
||||||
|
{
|
||||||
|
return String.class.isAssignableFrom(getMessageType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemStackMessage()
|
||||||
|
{
|
||||||
|
return ItemStack.class.isAssignableFrom(getMessageType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNBTMessage()
|
||||||
|
{
|
||||||
|
return NBTTagCompound.class.isAssignableFrom(getMessageType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean sendMessage(String modId, String key, NBTTagCompound value)
|
||||||
|
{
|
||||||
|
return enqueueStartupMessage(modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
public static boolean sendMessage(String modId, String key, ItemStack value)
|
||||||
|
{
|
||||||
|
return enqueueStartupMessage(modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
public static boolean sendMessage(String modId, String key, String value)
|
||||||
|
{
|
||||||
|
return enqueueStartupMessage(modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, NBTTagCompound value)
|
||||||
|
{
|
||||||
|
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, ItemStack value)
|
||||||
|
{
|
||||||
|
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, String value)
|
||||||
|
{
|
||||||
|
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean enqueueStartupMessage(String modTarget, IMCMessage message)
|
||||||
|
{
|
||||||
|
if (Loader.instance().activeModContainer() == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
enqueueMessage(Loader.instance().activeModContainer(), modTarget, message);
|
||||||
|
return Loader.isModLoaded(modTarget) && !Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION);
|
||||||
|
|
||||||
|
}
|
||||||
|
private static void enqueueMessage(Object sourceMod, String modTarget, IMCMessage message)
|
||||||
|
{
|
||||||
|
ModContainer mc;
|
||||||
|
if (sourceMod instanceof ModContainer) {
|
||||||
|
mc = (ModContainer) sourceMod;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mc = FMLCommonHandler.instance().findContainerFor(sourceMod);
|
||||||
|
}
|
||||||
|
if (mc != null && Loader.isModLoaded(modTarget))
|
||||||
|
{
|
||||||
|
message.setSender(mc);
|
||||||
|
modMessages.put(modTarget, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve any pending runtime messages for the mod
|
||||||
|
* @param forMod The {@link Instance} of the Mod to fetch messages for
|
||||||
|
* @return any messages - the collection will never be null
|
||||||
|
*/
|
||||||
|
public static ImmutableList<IMCMessage> fetchRuntimeMessages(Object forMod)
|
||||||
|
{
|
||||||
|
ModContainer mc = FMLCommonHandler.instance().findContainerFor(forMod);
|
||||||
|
if (mc != null)
|
||||||
|
{
|
||||||
|
return ImmutableList.copyOf(modMessages.removeAll(mc));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return emptyIMCList;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
package cpw.mods.fml.common.event;
|
package cpw.mods.fml.common.event;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.security.CodeSource;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
import cpw.mods.fml.common.FMLModContainer;
|
import cpw.mods.fml.common.FMLModContainer;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
@@ -74,4 +78,41 @@ public class FMLPreInitializationEvent extends FMLStateEvent
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging!
|
||||||
|
*
|
||||||
|
* @return A logger
|
||||||
|
*/
|
||||||
|
public Logger getModLog()
|
||||||
|
{
|
||||||
|
Logger log = Logger.getLogger(modContainer.getModId());
|
||||||
|
log.setParent(FMLLog.getLogger());
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the FML signing certificates, if any. Validate these against the
|
||||||
|
* published FML certificates in your mod, if you wish.
|
||||||
|
*
|
||||||
|
* Deprecated because mods should <b>NOT</b> trust this code. Rather
|
||||||
|
* they should copy this, or something like this, into their own mods.
|
||||||
|
*
|
||||||
|
* @return Certificates used to sign FML and Forge
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Certificate[] getFMLSigningCertificates()
|
||||||
|
{
|
||||||
|
CodeSource codeSource = getClass().getClassLoader().getParent().getClass().getProtectionDomain().getCodeSource();
|
||||||
|
Certificate[] certs = codeSource.getCertificates();
|
||||||
|
if (certs == null)
|
||||||
|
{
|
||||||
|
return new Certificate[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return certs;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package cpw.mods.fml.common.event;
|
package cpw.mods.fml.common.event;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandHandler;
|
||||||
|
import net.minecraft.command.ICommand;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.CommandHandler;
|
|
||||||
import net.minecraft.src.ICommand;
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
|
|
||||||
public class FMLServerStartingEvent extends FMLStateEvent
|
public class FMLServerStartingEvent extends FMLStateEvent
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cpw.mods.fml.common.event;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.LoaderState;
|
||||||
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
|
|
||||||
|
public class FMLServerStoppedEvent extends FMLStateEvent {
|
||||||
|
|
||||||
|
public FMLServerStoppedEvent(Object... data)
|
||||||
|
{
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ModState getModState()
|
||||||
|
{
|
||||||
|
return ModState.AVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.event;
|
|||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
import cpw.mods.fml.common.LoaderState.ModState;
|
||||||
import cpw.mods.fml.common.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public abstract class FMLStateEvent extends FMLEvent
|
public abstract class FMLStateEvent extends FMLEvent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,21 +16,18 @@ package cpw.mods.fml.common.modloader;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.src.GuiScreen;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.src.IInventory;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.network.NetServerHandler;
|
||||||
import net.minecraft.src.NetClientHandler;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.src.NetServerHandler;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import net.minecraft.src.WorldClient;
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
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 net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
|
|
||||||
public interface IModLoaderSidedHelper
|
public interface IModLoaderSidedHelper
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.NetServerHandler;
|
||||||
import net.minecraft.src.NetServerHandler;
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.src.Packet3Chat;
|
|
||||||
import cpw.mods.fml.common.network.IChatListener;
|
import cpw.mods.fml.common.network.IChatListener;
|
||||||
|
|
||||||
public class ModLoaderChatListener implements IChatListener
|
public class ModLoaderChatListener implements IChatListener
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.NetLoginHandler;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet1Login;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetLoginHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet1Login;
|
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class ModLoaderConnectionHandler implements IConnectionHandler
|
|||||||
@Override
|
@Override
|
||||||
public void connectionClosed(INetworkManager manager)
|
public void connectionClosed(INetworkManager manager)
|
||||||
{
|
{
|
||||||
if (!ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
|
if (ModLoaderHelper.sidedHelper==null || !ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
|
||||||
{
|
{
|
||||||
mod.serverDisconnect();
|
mod.serverDisconnect();
|
||||||
mod.onClientLogout(manager);
|
mod.onClientLogout(manager);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
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;
|
||||||
import cpw.mods.fml.common.ICraftingHandler;
|
import cpw.mods.fml.common.ICraftingHandler;
|
||||||
|
|
||||||
public class ModLoaderCraftingHelper implements ICraftingHandler
|
public class ModLoaderCraftingHelper implements ICraftingHandler
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package cpw.mods.fml.common.modloader;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import cpw.mods.fml.common.IDispenseHandler;
|
import cpw.mods.fml.common.IDispenseHandler;
|
||||||
import cpw.mods.fml.common.IDispenserHandler;
|
import cpw.mods.fml.common.IDispenserHandler;
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ package cpw.mods.fml.common.modloader;
|
|||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
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 net.minecraft.src.Entity;
|
|
||||||
|
|
||||||
public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity>
|
public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import cpw.mods.fml.common.IFuelHandler;
|
import cpw.mods.fml.common.IFuelHandler;
|
||||||
|
|
||||||
public class ModLoaderFuelHelper implements IFuelHandler
|
public class ModLoaderFuelHelper implements IFuelHandler
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
import net.minecraft.src.Container;
|
import java.util.Set;
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
public class ModLoaderGuiHelper implements IGuiHandler
|
public class ModLoaderGuiHelper implements IGuiHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
private BaseModProxy mod;
|
private BaseModProxy mod;
|
||||||
private int id;
|
private Set<Integer> ids;
|
||||||
private Container container;
|
private Container container;
|
||||||
|
private int currentID;
|
||||||
|
|
||||||
ModLoaderGuiHelper(BaseModProxy mod, int id)
|
ModLoaderGuiHelper(BaseModProxy mod)
|
||||||
{
|
{
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
this.id = id;
|
this.ids = Sets.newHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,9 +36,10 @@ public class ModLoaderGuiHelper implements IGuiHandler
|
|||||||
return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
|
return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectContainer(Container container)
|
public void injectContainerAndID(Container container, int ID)
|
||||||
{
|
{
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
this.currentID = ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getMod()
|
public Object getMod()
|
||||||
@@ -40,4 +47,9 @@ public class ModLoaderGuiHelper implements IGuiHandler
|
|||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void associateId(int additionalID)
|
||||||
|
{
|
||||||
|
this.ids.add(additionalID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,16 +20,18 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.SetMultimap;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommand;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.passive.IAnimals;
|
||||||
|
import net.minecraft.entity.boss.EntityDragon;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.src.BaseMod;
|
import net.minecraft.src.BaseMod;
|
||||||
import net.minecraft.src.Container;
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityDragon;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.IAnimals;
|
|
||||||
import net.minecraft.src.ICommand;
|
|
||||||
import net.minecraft.src.TradeEntry;
|
import net.minecraft.src.TradeEntry;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
@@ -60,7 +62,8 @@ public class ModLoaderHelper
|
|||||||
{
|
{
|
||||||
public static IModLoaderSidedHelper sidedHelper;
|
public static IModLoaderSidedHelper sidedHelper;
|
||||||
|
|
||||||
private static Map<Integer, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap();
|
private static Map<BaseModProxy, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap();
|
||||||
|
private static Map<Integer, ModLoaderGuiHelper> guiIDs = Maps.newHashMap();
|
||||||
|
|
||||||
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock)
|
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock)
|
||||||
{
|
{
|
||||||
@@ -161,15 +164,21 @@ public class ModLoaderHelper
|
|||||||
|
|
||||||
public static void buildGuiHelper(BaseModProxy mod, int id)
|
public static void buildGuiHelper(BaseModProxy mod, int id)
|
||||||
{
|
{
|
||||||
ModLoaderGuiHelper handler = new ModLoaderGuiHelper(mod, id);
|
ModLoaderGuiHelper handler = guiHelpers.get(mod);
|
||||||
guiHelpers.put(id, handler);
|
if (handler == null)
|
||||||
NetworkRegistry.instance().registerGuiHandler(mod, handler);
|
{
|
||||||
|
handler = new ModLoaderGuiHelper(mod);
|
||||||
|
guiHelpers.put(mod,handler);
|
||||||
|
NetworkRegistry.instance().registerGuiHandler(mod, handler);
|
||||||
|
}
|
||||||
|
handler.associateId(id);
|
||||||
|
guiIDs.put(id, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z)
|
public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z)
|
||||||
{
|
{
|
||||||
ModLoaderGuiHelper helper = guiHelpers.get(id);
|
ModLoaderGuiHelper helper = guiIDs.get(id);
|
||||||
helper.injectContainer(container);
|
helper.injectContainerAndID(container, id);
|
||||||
player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z);
|
player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.security.cert.Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,7 +29,7 @@ import java.util.Properties;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.ICommand;
|
import net.minecraft.command.ICommand;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
@@ -48,7 +49,6 @@ import cpw.mods.fml.common.ModClassLoader;
|
|||||||
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.ProxyInjector;
|
import cpw.mods.fml.common.ProxyInjector;
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
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;
|
||||||
@@ -66,6 +66,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
|
|||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
import cpw.mods.fml.common.versioning.VersionRange;
|
import cpw.mods.fml.common.versioning.VersionRange;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class ModLoaderModContainer implements ModContainer
|
public class ModLoaderModContainer implements ModContainer
|
||||||
{
|
{
|
||||||
@@ -616,4 +617,9 @@ public class ModLoaderModContainer implements ModContainer
|
|||||||
{
|
{
|
||||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Certificate getSigningCertificate()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import cpw.mods.fml.common.network.IPacketHandler;
|
import cpw.mods.fml.common.network.IPacketHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
package cpw.mods.fml.common.modloader;
|
||||||
|
|
||||||
import net.minecraft.src.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import cpw.mods.fml.common.IPickupNotifier;
|
import cpw.mods.fml.common.IPickupNotifier;
|
||||||
|
|
||||||
public class ModLoaderPickupNotifier implements IPickupNotifier
|
public class ModLoaderPickupNotifier implements IPickupNotifier
|
||||||
@@ -17,7 +17,7 @@ public class ModLoaderPickupNotifier implements IPickupNotifier
|
|||||||
@Override
|
@Override
|
||||||
public void notifyPickup(EntityItem item, EntityPlayer player)
|
public void notifyPickup(EntityItem item, EntityPlayer player)
|
||||||
{
|
{
|
||||||
mod.onItemPickup(player, item.field_70294_a);
|
mod.onItemPickup(player, item.func_92059_d());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,10 +5,10 @@ import java.util.Random;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.src.EntityVillager;
|
import net.minecraft.entity.passive.EntityVillager;
|
||||||
import net.minecraft.src.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.src.MerchantRecipeList;
|
|
||||||
import net.minecraft.src.TradeEntry;
|
import net.minecraft.src.TradeEntry;
|
||||||
|
import net.minecraft.village.MerchantRecipeList;
|
||||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package cpw.mods.fml.common.modloader;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.src.ChunkProviderGenerate;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.ChunkProviderHell;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.src.IChunkProvider;
|
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.gen.ChunkProviderHell;
|
||||||
|
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
import cpw.mods.fml.common.IWorldGenerator;
|
||||||
|
|
||||||
public class ModLoaderWorldGenerator implements IWorldGenerator
|
public class ModLoaderWorldGenerator implements IWorldGenerator
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ import java.io.IOException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.DataWatcher;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.EntityLiving;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.src.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
|||||||
@@ -11,24 +11,17 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.network.*;
|
||||||
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.server.management.ServerConfigurationManager;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.world.EnumGameType;
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.EnumGameType;
|
import net.minecraft.world.WorldType;
|
||||||
import net.minecraft.src.Item;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetLoginHandler;
|
|
||||||
import net.minecraft.src.NetServerHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import net.minecraft.src.Packet1Login;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import net.minecraft.src.Packet3Chat;
|
|
||||||
import net.minecraft.src.ServerConfigurationManager;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import net.minecraft.src.WorldType;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -47,7 +40,7 @@ import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|||||||
public class FMLNetworkHandler
|
public class FMLNetworkHandler
|
||||||
{
|
{
|
||||||
private static final int FML_HASH = Hashing.murmur3_32().hashString("FML").asInt();
|
private static final int FML_HASH = Hashing.murmur3_32().hashString("FML").asInt();
|
||||||
private static final int PROTOCOL_VERSION = 0x1;
|
private static final int PROTOCOL_VERSION = 0x2;
|
||||||
private static final FMLNetworkHandler INSTANCE = new FMLNetworkHandler();
|
private static final FMLNetworkHandler INSTANCE = new FMLNetworkHandler();
|
||||||
|
|
||||||
// List of states for connections from clients to server
|
// List of states for connections from clients to server
|
||||||
@@ -86,7 +79,12 @@ public class FMLNetworkHandler
|
|||||||
|
|
||||||
private void handleFMLPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler netHandler)
|
private void handleFMLPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler netHandler)
|
||||||
{
|
{
|
||||||
FMLPacket pkt = FMLPacket.readPacket(packet.field_73629_c);
|
FMLPacket pkt = FMLPacket.readPacket(network, packet.field_73629_c);
|
||||||
|
// Part of an incomplete multipart packet
|
||||||
|
if (pkt == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
String userName = "";
|
String userName = "";
|
||||||
if (netHandler instanceof NetLoginHandler)
|
if (netHandler instanceof NetLoginHandler)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.collect.MapMaker;
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.UnsignedBytes;
|
import com.google.common.primitives.UnsignedBytes;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
@@ -19,38 +22,45 @@ public abstract class FMLPacket
|
|||||||
/**
|
/**
|
||||||
* Opening salutation from the server to the client -> request all mods from the client
|
* Opening salutation from the server to the client -> request all mods from the client
|
||||||
*/
|
*/
|
||||||
MOD_LIST_REQUEST(ModListRequestPacket.class),
|
MOD_LIST_REQUEST(ModListRequestPacket.class, false),
|
||||||
/**
|
/**
|
||||||
* The client responds with the list of mods and versions it has. This is verified by the server.
|
* The client responds with the list of mods and versions it has. This is verified by the server.
|
||||||
*/
|
*/
|
||||||
MOD_LIST_RESPONSE(ModListResponsePacket.class),
|
MOD_LIST_RESPONSE(ModListResponsePacket.class, false),
|
||||||
/**
|
/**
|
||||||
* At which point the server tells the client the mod identifiers for this session.
|
* At which point the server tells the client the mod identifiers for this session.
|
||||||
*/
|
*/
|
||||||
MOD_IDENTIFIERS(ModIdentifiersPacket.class),
|
MOD_IDENTIFIERS(ModIdentifiersPacket.class, false),
|
||||||
/**
|
/**
|
||||||
* Or, if there is missing stuff, the server tells the client what's missing and drops the connection.
|
* Or, if there is missing stuff, the server tells the client what's missing and drops the connection.
|
||||||
*/
|
*/
|
||||||
MOD_MISSING(ModMissingPacket.class),
|
MOD_MISSING(ModMissingPacket.class, false),
|
||||||
/**
|
/**
|
||||||
* Open a GUI on the client from the server
|
* Open a GUI on the client from the server
|
||||||
*/
|
*/
|
||||||
GUIOPEN(OpenGuiPacket.class),
|
GUIOPEN(OpenGuiPacket.class, false),
|
||||||
/**
|
/**
|
||||||
* Spawn an entity on the client from the server
|
* Spawn an entity on the client from the server
|
||||||
*/
|
*/
|
||||||
ENTITYSPAWN(EntitySpawnPacket.class),
|
ENTITYSPAWN(EntitySpawnPacket.class, false),
|
||||||
/**
|
/**
|
||||||
* Fixes entity location data after spawning
|
* Fixes entity location data after spawning
|
||||||
*/
|
*/
|
||||||
ENTITYSPAWNADJUSTMENT(EntitySpawnAdjustmentPacket.class);
|
ENTITYSPAWNADJUSTMENT(EntitySpawnAdjustmentPacket.class, false),
|
||||||
|
/**
|
||||||
|
* The ID map to send to the client
|
||||||
|
*/
|
||||||
|
MOD_IDMAP(ModIdMapPacket.class, true);
|
||||||
|
|
||||||
|
|
||||||
private Class<? extends FMLPacket> packetType;
|
private Class<? extends FMLPacket> packetType;
|
||||||
|
private boolean isMultipart;
|
||||||
|
private ConcurrentMap<INetworkManager, FMLPacket> partTracker;
|
||||||
|
|
||||||
private Type(Class<? extends FMLPacket> clazz)
|
private Type(Class<? extends FMLPacket> clazz, boolean isMultipart)
|
||||||
{
|
{
|
||||||
this.packetType = clazz;
|
this.packetType = clazz;
|
||||||
|
this.isMultipart = isMultipart;
|
||||||
}
|
}
|
||||||
|
|
||||||
FMLPacket make()
|
FMLPacket make()
|
||||||
@@ -66,20 +76,64 @@ public abstract class FMLPacket
|
|||||||
throw new FMLNetworkException(e);
|
throw new FMLNetworkException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMultipart()
|
||||||
|
{
|
||||||
|
return isMultipart;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FMLPacket findCurrentPart(INetworkManager network)
|
||||||
|
{
|
||||||
|
if (partTracker == null)
|
||||||
|
{
|
||||||
|
partTracker = new MapMaker().weakKeys().weakValues().makeMap();
|
||||||
|
}
|
||||||
|
if (!partTracker.containsKey(network))
|
||||||
|
{
|
||||||
|
partTracker.put(network, make());
|
||||||
|
}
|
||||||
|
return partTracker.get(network);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
|
public static byte[][] makePacketSet(Type type, Object... data)
|
||||||
|
{
|
||||||
|
if (!type.isMultipart())
|
||||||
|
{
|
||||||
|
return new byte[0][];
|
||||||
|
}
|
||||||
|
byte[] packetData = type.make().generatePacket(data);
|
||||||
|
|
||||||
|
byte[][] chunks = new byte[packetData.length / 32000 + 1][];
|
||||||
|
for (int i = 0; i < packetData.length / 32000 + 1; i++)
|
||||||
|
{
|
||||||
|
int len = Math.min(32000, packetData.length - i* 32000);
|
||||||
|
chunks[i] = Bytes.concat(new byte[] { UnsignedBytes.checkedCast(type.ordinal()), UnsignedBytes.checkedCast(i), UnsignedBytes.checkedCast(chunks.length)}, Ints.toByteArray(len), Arrays.copyOfRange(packetData, i * 32000, len + i * 32000));
|
||||||
|
}
|
||||||
|
return chunks;
|
||||||
|
}
|
||||||
public static byte[] makePacket(Type type, Object... data)
|
public static byte[] makePacket(Type type, Object... data)
|
||||||
{
|
{
|
||||||
byte[] packetData = type.make().generatePacket(data);
|
byte[] packetData = type.make().generatePacket(data);
|
||||||
return Bytes.concat(new byte[] { UnsignedBytes.checkedCast(type.ordinal()) }, packetData );
|
return Bytes.concat(new byte[] { UnsignedBytes.checkedCast(type.ordinal()) }, packetData );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FMLPacket readPacket(byte[] payload)
|
public static FMLPacket readPacket(INetworkManager network, byte[] payload)
|
||||||
{
|
{
|
||||||
int type = UnsignedBytes.toInt(payload[0]);
|
int type = UnsignedBytes.toInt(payload[0]);
|
||||||
return Type.values()[type].make().consumePacket(Arrays.copyOfRange(payload, 1, payload.length));
|
Type eType = Type.values()[type];
|
||||||
|
FMLPacket pkt;
|
||||||
|
if (eType.isMultipart())
|
||||||
|
{
|
||||||
|
pkt = eType.findCurrentPart(network);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pkt = eType.make();
|
||||||
|
}
|
||||||
|
return pkt.consumePacket(Arrays.copyOfRange(payload, 1, payload.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FMLPacket(Type type)
|
public FMLPacket(Type type)
|
||||||
@@ -92,8 +146,4 @@ public abstract class FMLPacket
|
|||||||
public abstract FMLPacket consumePacket(byte[] data);
|
public abstract FMLPacket consumePacket(byte[] data);
|
||||||
|
|
||||||
public abstract void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
|
public abstract void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.src.NetServerHandler;
|
|
||||||
import net.minecraft.src.Packet3Chat;
|
|
||||||
|
|
||||||
public interface IChatListener
|
public interface IChatListener
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.NetLoginHandler;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet1Login;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetLoginHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet1Login;
|
|
||||||
|
|
||||||
public interface IConnectionHandler
|
public interface IConnectionHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IGuiHandler
|
public interface IGuiHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
|
|
||||||
public interface IPacketHandler
|
public interface IPacketHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
|
|
||||||
public interface ITinyPacketHandler
|
public interface ITinyPacketHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.*;
|
||||||
|
import net.minecraft.network.INetworkManager;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
|
import com.google.common.collect.MapDifference;
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import com.google.common.primitives.Bytes;
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
|
import com.google.common.primitives.UnsignedBytes;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import cpw.mods.fml.common.registry.ItemData;
|
||||||
|
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
|
||||||
|
|
||||||
|
public class ModIdMapPacket extends FMLPacket {
|
||||||
|
private byte[][] partials;
|
||||||
|
|
||||||
|
public ModIdMapPacket()
|
||||||
|
{
|
||||||
|
super(MOD_IDMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] generatePacket(Object... data)
|
||||||
|
{
|
||||||
|
NBTTagList completeList = (NBTTagList) data[0];
|
||||||
|
NBTTagCompound wrap = new NBTTagCompound();
|
||||||
|
wrap.func_74782_a("List", completeList);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return CompressedStreamTools.func_74798_a(wrap);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.SEVERE, e, "A critical error writing the id map");
|
||||||
|
throw new FMLNetworkException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FMLPacket consumePacket(byte[] data)
|
||||||
|
{
|
||||||
|
ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
|
||||||
|
int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
|
||||||
|
int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
|
||||||
|
int chunkLength = bdi.readInt();
|
||||||
|
if (partials == null)
|
||||||
|
{
|
||||||
|
partials = new byte[chunkTotal][];
|
||||||
|
}
|
||||||
|
partials[chunkIdx] = new byte[chunkLength];
|
||||||
|
bdi.readFully(partials[chunkIdx]);
|
||||||
|
for (int i = 0; i < partials.length; i++)
|
||||||
|
{
|
||||||
|
if (partials[i] == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||||
|
{
|
||||||
|
byte[] allData = Bytes.concat(partials);
|
||||||
|
GameData.initializeServerGate(1);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
|
||||||
|
NBTTagList list = serverList.func_74761_m("List");
|
||||||
|
Set<ItemData> itemData = GameData.buildWorldItemData(list);
|
||||||
|
GameData.validateWorldSave(itemData);
|
||||||
|
MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
|
||||||
|
if (serverDifference!=null)
|
||||||
|
{
|
||||||
|
FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,8 +6,8 @@ import java.util.Collection;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ package cpw.mods.fml.common.network;
|
|||||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
|
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDENTIFIERS;
|
||||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
|
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_LIST_RESPONSE;
|
||||||
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_MISSING;
|
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_MISSING;
|
||||||
|
import static cpw.mods.fml.common.network.FMLPacket.Type.MOD_IDMAP;
|
||||||
|
|
||||||
import java.util.List;
|
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.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.src.NetLoginHandler;
|
import net.minecraft.network.*;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -23,6 +23,8 @@ import com.google.common.io.ByteStreams;
|
|||||||
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.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
|
import cpw.mods.fml.common.registry.GameData;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModListResponsePacket extends FMLPacket
|
public class ModListResponsePacket extends FMLPacket
|
||||||
{
|
{
|
||||||
@@ -113,16 +115,25 @@ public class ModListResponsePacket extends FMLPacket
|
|||||||
FMLLog.info("User %s connection failed: missing %s, bad versions %s", userName, missingClientMods, versionIncorrectMods);
|
FMLLog.info("User %s connection failed: missing %s, bad versions %s", userName, missingClientMods, versionIncorrectMods);
|
||||||
// Mark this as bad
|
// Mark this as bad
|
||||||
FMLNetworkHandler.setHandlerState((NetLoginHandler) netHandler, FMLNetworkHandler.MISSING_MODS_OR_VERSIONS);
|
FMLNetworkHandler.setHandlerState((NetLoginHandler) netHandler, FMLNetworkHandler.MISSING_MODS_OR_VERSIONS);
|
||||||
|
pkt.field_73628_b = pkt.field_73629_c.length;
|
||||||
|
network.func_74429_a(pkt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pkt.field_73629_c = FMLPacket.makePacket(MOD_IDENTIFIERS, netHandler);
|
pkt.field_73629_c = FMLPacket.makePacket(MOD_IDENTIFIERS, netHandler);
|
||||||
Logger.getLogger("Minecraft").info(String.format("User %s connecting with mods %s", userName, modVersions.keySet()));
|
Logger.getLogger("Minecraft").info(String.format("User %s connecting with mods %s", userName, modVersions.keySet()));
|
||||||
FMLLog.info("User %s connecting with mods %s", userName, modVersions.keySet());
|
FMLLog.info("User %s connecting with mods %s", userName, modVersions.keySet());
|
||||||
|
pkt.field_73628_b = pkt.field_73629_c.length;
|
||||||
|
network.func_74429_a(pkt);
|
||||||
|
NBTTagList itemList = new NBTTagList();
|
||||||
|
GameData.writeItemData(itemList);
|
||||||
|
byte[][] registryPackets = FMLPacket.makePacketSet(MOD_IDMAP, itemList);
|
||||||
|
for (int i = 0; i < registryPackets.length; i++)
|
||||||
|
{
|
||||||
|
network.func_74429_a(PacketDispatcher.getPacket("FML", registryPackets[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt.field_73628_b = pkt.field_73629_c.length;
|
|
||||||
network.func_74429_a(pkt);
|
|
||||||
// reset the continuation flag - we have completed extra negotiation and the login should complete now
|
// reset the continuation flag - we have completed extra negotiation and the login should complete now
|
||||||
NetLoginHandler.func_72531_a((NetLoginHandler) netHandler, true);
|
NetLoginHandler.func_72531_a((NetLoginHandler) netHandler, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|||||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
import cpw.mods.fml.common.versioning.VersionRange;
|
import cpw.mods.fml.common.versioning.VersionRange;
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
public class ModMissingPacket extends FMLPacket
|
public class ModMissingPacket extends FMLPacket
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ 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.Packet131MapData;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface NetworkMod
|
public @interface NetworkMod
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.src.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
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 cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
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.versioning.DefaultArtifactVersion;
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException;
|
import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException;
|
||||||
import cpw.mods.fml.common.versioning.VersionRange;
|
import cpw.mods.fml.common.versioning.VersionRange;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class NetworkModHandler
|
public class NetworkModHandler
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,19 +6,13 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.network.*;
|
||||||
|
import net.minecraft.network.packet.*;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.Container;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetLoginHandler;
|
|
||||||
import net.minecraft.src.NetServerHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import net.minecraft.src.Packet1Login;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import net.minecraft.src.Packet3Chat;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
@@ -35,8 +29,8 @@ 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.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.network.FMLPacket.Type;
|
import cpw.mods.fml.common.network.FMLPacket.Type;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cpw
|
* @author cpw
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.src.NetHandler;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.src.INetworkManager;
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package cpw.mods.fml.common.network;
|
package cpw.mods.fml.common.network;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.Packet131MapData;
|
||||||
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.src.EntityPlayerMP;
|
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.registry;
|
|||||||
|
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
|
||||||
import net.minecraft.src.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
class BlockTracker
|
class BlockTracker
|
||||||
{
|
{
|
||||||
|
|||||||
Loaded 100 of 269 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user