Compare commits

...
99 Commits
Author SHA1 Message Date
Christian 20337b6e8a Update to MC 1.4.6 2012-12-17 21:48:29 -05:00
Christian 33ff87d8d9 Fix build script 2012-12-17 17:56:00 -05:00
Christian af06bbd373 more 1.4.6 tweaks 2012-12-17 17:00:54 -05:00
Christian 92a47ace8b More work 2012-12-17 14:30:51 -05:00
Christian f285ac369a Merge branch 'securityupdate' 2012-12-17 11:46:47 -05:00
Christian 68e76c273a Merge branch 'master' into securityupdate 2012-12-17 11:46:27 -05:00
Christian e98c311a2c Fix up handling null names. *sigh* 2012-12-17 10:29:54 -05:00
Christian 293edb316e Some tweaks to item identification. The GameRegistry methods are deprecated
to encourage you to use the new named ones instead. These will force a
name on the item/block, allowing for stronger matching than "sequential guessing"
2012-12-16 22:57:11 -05:00
Christian 2d4465eaf7 More fixes 2012-12-16 21:22:55 -05:00
LexManos 9266ff394a Updated MCP download mirriors upon Searge's request. 2012-12-16 05:35:46 -08:00
Christian bbfd85ed1e Move Side and SideOnly to relauncher package 2012-12-15 23:21:26 -05:00
Christian 6ecc2303f4 Fix newline fun 2012-12-15 22:37:32 -05:00
Christian d35cfda798 More stuff for the thingy 2012-12-15 22:30:16 -05:00
Christian cffa2a92a6 Remove old NEI/CCC compatibility code and other classloading tweaks 2012-12-15 20:40:08 -05:00
LexManos 31695d5ec1 Fix var name messup 2012-12-13 00:22:30 -08:00
LexManos bfb3020505 Update released eclipse project to link BouncyCastle 2012-12-12 23:44:28 -08:00
Christian 22a88ea2e4 Change ID management slightly. IDs are tracked by block type for itemblock items now. This means servers will need to update.
Also, ordinal rearrangements within a mod will no longer trigger server disconnection, though a warning will still be logged.
2012-12-12 19:31:05 -05:00
Christian 0423fa5885 Fix possible escape leakage.. 2012-12-12 19:31:05 -05:00
LexManos d17fbb527f More robust eclipse workspace replacement 2012-12-12 14:31:07 -08:00
LexManos d40bb0fe32 Kill decompile if astyle is not found and set execution bits on mcp .sh files and astyle-osx 2012-12-11 21:47:45 -08:00
Christian a513060a81 Change to download bouncy castle as well. We also finally properly use the downloaded libs
even in vanilla code!
2012-12-11 22:37:07 -05:00
Christian 8e594a347c Remove extraneous patch file 2012-12-11 20:37:12 -05:00
Christian 9af365edcc Merge branch 'repackage'
Conflicts:
	build.xml
	client/cpw/mods/fml/client/FMLClientHandler.java
	client/cpw/mods/fml/client/GuiIdMismatchScreen.java
	common/cpw/mods/fml/common/FMLCommonHandler.java
	common/cpw/mods/fml/common/IFMLSidedHandler.java
	common/cpw/mods/fml/common/network/ModIdMapPacket.java
	common/cpw/mods/fml/common/network/ModListResponsePacket.java
	common/cpw/mods/fml/common/registry/GameData.java
	common/cpw/mods/fml/common/registry/GameRegistry.java
	common/cpw/mods/fml/common/registry/ItemData.java
	common/cpw/mods/fml/common/registry/LanguageRegistry.java
	common/cpw/mods/fml/server/FMLServerHandler.java
	install/fml.py
	patches/minecraft/net/minecraft/client/Minecraft.java.patch
	patches/minecraft/net/minecraft/server/MinecraftServer.java.patch
	patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch
2012-12-11 14:58:38 -05:00
Christian 70554d6a2b Merge branch 'repackage' of github.com:cpw/FML into repackage
Conflicts:
	common/cpw/mods/fml/common/registry/GameData.java
2012-12-11 14:49:23 -05:00
cpw eb84f52493 Merge pull request #145 from pahimar/master
More logging of loading files in LanguageRegistry
2012-12-11 08:28:39 -08:00
pahimar d074830d95 Update common/cpw/mods/fml/common/registry/LanguageRegistry.java
Add in logging of what file failed to be loaded
2012-12-11 11:27:05 -05:00
LexManos f7fe9ebeb2 Fix patches, rebased with HEAD 2012-12-10 15:37:48 -08:00
LexManos b2c8f37aec Remade python dist as 32-bit. 2012-12-10 15:26:15 -08:00
Christian a5bcccab59 Fixing id map generation - should validate correctly now 2012-12-10 15:26:13 -08:00
LexManos a11f368b62 Reenabled replacement of the eclipse folder. 2012-12-10 14:56:23 -08:00
LexManos 59656b004b Remade python dist as 32-bit. 2012-12-10 14:56:05 -08:00
Christian ff8cb67a99 Fixing id map generation - should validate correctly now 2012-12-09 22:24:16 -05:00
Christian fa5256c8a7 Fix up idmap code 2012-12-09 22:01:13 -05:00
LexManos 4b19987ee6 Some derp protection in the workspace copy. 2012-12-09 02:20:21 -08:00
LexManos 9f43303073 Removed remaining references to src/common
Fixed eclipse workspace replacemnt on source dist
Cleanup some outputs
2012-12-09 02:10:28 -08:00
LexManos a20958fb56 Updated build script to not use the mcp common directory as it doesn't exist anymore. 2012-12-08 21:41:51 -08:00
LexManos 8c71098081 Fished moving out the rest of the default packaged classes to aproperiate packages. Updated patches and code to reflect. 2012-12-08 21:41:16 -08:00
LexManos a3a5b44acb Updated the update_packages script to support different mcp locations 2012-12-08 21:40:39 -08:00
LexManos 0473273709 Update fml_marker.cfg, Minecraft is now runnable! 2012-12-08 20:25:29 -08:00
LexManos bf492f32f9 Update all imports for repackaging. Branch is compileable. 2012-12-08 20:21:03 -08:00
LexManos 4744677646 Some stragler patches 2012-12-08 19:34:35 -08:00
LexManos f0af2e4ef5 Updated patches to new packages. 2012-12-08 19:33:29 -08:00
LexManos c7f763d6f0 Give new classes a distinct package to be moved from. 2012-12-08 17:50:14 -08:00
LexManos 563b8d1215 Fixed 0.tree to actually refresh the workspace. 2012-12-08 17:35:11 -08:00
LexManos 221493453f Remerged branch, and updated dev eclipse workspace. 2012-12-08 17:08:51 -08:00
Christian 86c928430a Add in storage, detection and validation of the ItemID array between client and server
and also for world saves. May help with item configuration issues.
2012-12-08 17:05:18 -08:00
Christian cd0a0e51d5 Add a modid on the mods list, should make it easier to do things like forge chunkloading config 2012-12-08 16:46:47 -08:00
Christian 66ff95f9d7 Fix build eclipse extractor task 2012-12-08 16:46:46 -08:00
Christian 8ad172295f Add in storage, detection and validation of the ItemID array between client and server
and also for world saves. May help with item configuration issues.
2012-12-07 01:52:16 -05:00
Christian 26a2ef5995 Add a modid on the mods list, should make it easier to do things like forge chunkloading config 2012-12-04 18:08:27 -05:00
Christian b4e3490fa1 Fix build eclipse extractor task 2012-12-04 18:04:45 -05:00
Christian 828341f987 Fix typo 2012-12-04 01:30:38 -05:00
Christian bc03fbb3be Merge branch 'master' into repackage
Conflicts:
	eclipse/Clean/.classpath
	eclipse/Clean/.project
	eclipse/FML/.classpath
	eclipse/FML/.project
	install/fml.py
2012-12-04 01:24:50 -05:00
Christian 7a8dae5e35 Try and make branch non-derpy 2012-12-03 23:47:23 -05:00
Christian d3c0e1f589 Try defaulting branch differently 2012-12-03 22:26:12 -05:00
Christian 9c77d3f25b Remove old eclipse workspace and ship/extract as a zip file (use ant setupenvironment)
Fix up install.py for forge multibranch changes
2012-12-03 19:55:37 -05:00
LexManos 6371e9b71e Assume Forge is the parent directory when checking for AT configs. 2012-12-03 16:53:03 -08:00
Christian 578ef5cfeb Merge branch 'master' into repackage
Conflicts:
	patches/minecraft/net/minecraft/client/EntityFX.java.patch
2012-12-03 17:31:29 -05:00
Christian 516954e6f9 Name both zips the same format 2012-12-03 08:38:20 -05:00
Christian 1151d5c3e3 Last part of branch name only please 2012-12-03 08:30:44 -05:00
Christian 25f1ddac30 Try and get a valid branch name on jenkins 2012-12-03 08:23:21 -05:00
Christian 39a146f8e6 Clean up build.xml script- support outputting a branched jar file 2012-12-03 08:13:20 -05:00
LexManos 037dcaefea Small derp in install.py 2012-12-02 20:26:36 -08:00
LexManos 01d6da3a90 Try marking python as binary. 2012-12-02 20:19:55 -08:00
LexManos 8b2665980d FML will now attempt to download MCP as part of the install process
Now shipping a py2exe version of python for windows.
Linux/Macs should come with python pre-installed so they do not have a distrabution here.
2012-12-02 19:59:22 -08:00
LexManos 42b3e6ad56 Windows Python distrabution created using py2exe, thanks Fesh0r for the script. 2012-12-02 19:56:17 -08:00
LexManos e709ab8a70 Marked more spots in gui/items bitmask as being free. 2012-11-21 15:58:04 -08:00
LexManos 501409d1fb Delete duplicate file 2012-11-20 18:07:39 -08:00
LexManos 0fb3a34235 Finished repackaging net.minecraft.* net.minecraft.client is left 2012-11-20 17:58:22 -08:00
LexManos e4ba1f863e More re-packaging, got most classes out of the default package. 2012-11-20 17:22:55 -08:00
Christian 1f5c58b723 Fix up MCP version 2012-11-20 08:47:14 -05:00
Christian 61e4db2c3b Merge joined.exc add update howto 2012-11-20 08:38:33 -05:00
Christian 5efc1eb34c Revert "Fix MC-2497 - derpy torch flames. Moved from forge. Everyone should benefit."
This reverts commit fa567014a5.
2012-11-20 08:27:13 -05:00
LexManos 96c6f91201 Remove common folder from projects 2012-11-20 03:15:45 -08:00
LexManos 62e69a2804 Move IBossDisplayData to shared 2012-11-20 03:15:16 -08:00
LexManos e9352d2675 First half of new patches 2012-11-20 03:15:01 -08:00
LexManos ee6abdf28d Update FML imports 2012-11-20 03:14:36 -08:00
LexManos 968ee7ab09 Inital script side commit for MC source repackaging done. 2012-11-20 01:55:41 -08:00
LexManos 3b3600d44f Modified merger to just consider all server classes as common. And moved the defnition of CodecMus to the config. 2012-11-19 17:45:53 -08:00
LexManos edcc5ca554 Forgot mcp.cfg 2012-11-19 15:47:18 -08:00
LexManos ca79dfe298 Updated to 1.4.5b 2012-11-19 15:35:08 -08:00
LexManos 5945279b8b Fix python error 2012-11-19 15:03:13 -08:00
LexManos 57bf64318b Modified decompile so that we do not have to decompile the server, saves time. 2012-11-19 15:01:04 -08:00
LexManos d9d0a46809 Cleaned up some tabs 2012-11-19 15:00:11 -08:00
LexManos 2fac644914 Change usage of ZipFile, fixes issues with Mac's default instation of python. Also cleaned the python a little bit. 2012-11-19 13:33:22 -08:00
Christian 570592b24b Attempt to fix a possible comodification risk 2012-11-18 20:40:48 -05:00
Christian fde94144ec Change texturebinding to use the textureId directly rather than iconIndex
to determine if it needs to rebind the texture sheet
2012-11-18 08:45:25 -05:00
Christian f348496c10 Fix mod display list. Shouldn't be derpy anymore. 2012-11-17 23:51:14 -05:00
Christian a5c31b5365 Fix World patch- workaround no longer required and leftovers are bad. 2012-11-17 23:44:53 -05:00
LexManos 2dc3f0ddef Cleaned up the AT config updater, should work for any setup of the MCP workspace now. 2012-11-17 19:08:47 -08:00
Christian fa567014a5 Fix MC-2497 - derpy torch flames. Moved from forge. Everyone should benefit. 2012-11-16 22:50:21 -05:00
Christian 96935bb122 Fix an NPE in TileEntity trying to generate a crash report. Make suspicious classes just return the obvious.
Fix NPE for FML crash report on server. Clean up dead patches.
2012-11-16 22:50:00 -05:00
Christian 43d3042dff Clean up a patch 2012-11-16 16:49:44 -05:00
Christian fec221f8a6 Update FML for MC 1.4.5 2012-11-16 16:31:06 -05:00
LexManos b0f0635eb3 Fix for ModLoader static overrides not displaying. 2012-11-15 14:08:41 -08:00
Christian 23a25131b0 Fix up derpy file name handling: closes #127
Fix up duping childmods: closes #126
FMLPreinitializationEvent now offers a getLogger() that'll return your mod a personalized logger instance
2012-11-12 17:54:21 -05:00
LexManos a6eaa2bebc Fix spelling issue. 2012-11-08 21:01:31 -08:00
LexManos c6a0741379 FML setup should now download and verify all the minecraft files needed to run MCP. 2012-11-08 17:54:05 -08:00
Christian 5a1930e2d6 Small fix to some MCP metadata for pre2 2012-11-08 20:34:45 -05:00
245 changed files with 16952 additions and 13766 deletions

No files matched your search

+5 -2
View File
@@ -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
+3
View File
@@ -8,3 +8,6 @@
fmlbranding.properties fmlbranding.properties
/fernflower.zip /fernflower.zip
/commands.py.bck /commands.py.bck
/mcp*.zip
/mcp
/eclipse
+77 -96
View File
@@ -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
* *
@@ -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);
}
} }
+4 -3
View File
@@ -18,9 +18,10 @@ import java.awt.Dimension;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.src.RenderEngine; import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.src.TextureFX; import net.minecraft.client.renderer.texturefx.TextureFX;
import net.minecraft.src.ITexturePack; import net.minecraft.client.texturepacks.ITexturePack;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
@@ -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_);
}
}
}
+12 -8
View File
@@ -18,12 +18,12 @@ import java.awt.Dimension;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.src.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.src.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.src.GuiSmallButton; import net.minecraft.client.gui.GuiSmallButton;
import net.minecraft.src.StringTranslate; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.src.Tessellator; import net.minecraft.util.StringTranslate;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@@ -54,7 +54,7 @@ public class GuiModList extends GuiScreen
this.mods=new ArrayList<ModContainer>(); this.mods=new ArrayList<ModContainer>();
FMLClientHandler.instance().addSpecialModEntries(mods); FMLClientHandler.instance().addSpecialModEntries(mods);
for (ModContainer mod : Loader.instance().getModList()) { for (ModContainer mod : Loader.instance().getModList()) {
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) { if (mod.getMetadata()!=null && mod.getMetadata().parentMod==null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
String parentMod = mod.getMetadata().parent; String parentMod = mod.getMetadata().parent;
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod); ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
if (parentContainer != null) if (parentContainer != null)
@@ -64,6 +64,10 @@ public class GuiModList extends GuiScreen
continue; continue;
} }
} }
else if (mod.getMetadata()!=null && mod.getMetadata().parentMod!=null)
{
continue;
}
mods.add(mod); mods.add(mod);
} }
} }
@@ -133,7 +137,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
{ {
+2 -2
View File
@@ -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 -1
View File
@@ -14,7 +14,7 @@
package cpw.mods.fml.client; package cpw.mods.fml.client;
import net.minecraft.src.TextureFX; import net.minecraft.client.renderer.texturefx.TextureFX;
class OverrideInfo class OverrideInfo
{ {
+6 -6
View File
@@ -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);
} }
@@ -19,10 +19,10 @@ 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.client.renderer.RenderEngine;
import net.minecraft.client.renderer.texturefx.TextureFX;
import net.minecraft.client.texturepacks.ITexturePack;
import net.minecraft.src.ModTextureStatic; import net.minecraft.src.ModTextureStatic;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TextureFX;
import net.minecraft.src.ITexturePack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@@ -159,15 +159,11 @@ public class TextureFXManager
} }
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D); int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
effect.func_76845_a(client.field_71446_o); effect.func_76845_a(client.field_71446_o);
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D); id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
GL11.glBindTexture(GL_TEXTURE_2D, old); GL11.glBindTexture(GL_TEXTURE_2D, old);
effectTextures.put(effect, id); effectTextures.put(effect, id);
effect.field_76848_d = id;
return id; return id;
} }
@@ -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;
+21 -3
View File
@@ -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,13 @@ import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.texturefx.TextureFX;
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;
+37 -4
View File
@@ -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,41 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.client.Minecraft; import net.minecraft.block.Block;
import net.minecraft.server.MinecraftServer; import net.minecraft.block.BlockDispenser;
import net.minecraft.client.*;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texturefx.TextureFX;
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 +67,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 +75,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
@@ -18,6 +18,8 @@ import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import net.minecraft.client.renderer.RenderEngine;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
@@ -20,6 +20,8 @@ import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import net.minecraft.client.renderer.RenderEngine;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
@@ -32,7 +34,7 @@ public class ModTextureStatic extends FMLTextureFX
private String targetTex = null; private String targetTex = null;
private int storedSize; private int storedSize;
private BufferedImage overrideData = null; private BufferedImage overrideData = null;
private int needApply = 2; private int needApply = 10;
public ModTextureStatic(int icon, int target, BufferedImage image) public ModTextureStatic(int icon, int target, BufferedImage image)
@@ -106,7 +108,7 @@ public class ModTextureStatic extends FMLTextureFX
public void update() public void update()
{ {
needApply = 2; needApply = 10;
for (int idx = 0; idx < pixels.length; idx++) for (int idx = 0; idx < pixels.length; idx++)
{ {
int i = idx * 4; int i = idx * 4;
+12 -121
View File
@@ -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,16 @@
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.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 @@ @@ -1197,20 +1205,20 @@
self.runmc(forkcmd)
def startclient(self):
- classpath = [self.binclient] + self.cpathclient
+ classpath = [self.binclient, self.srcshared] + self.cpathclient
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
natives = os.path.join('..', self.dirnatives)
@@ -1197,20 +1210,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 +62,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 +78,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 +87,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 +97,7 @@
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 @@ @@ -1594,6 +1605,9 @@
sys.exit(1) sys.exit(1)
for entry in newfiles: for entry in newfiles:
@@ -198,7 +107,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 +1628,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 +117,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 +1673,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,14 @@ 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);
}
} }
@@ -17,19 +17,19 @@ package cpw.mods.fml.common;
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 +75,9 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
list.func_74742_a(mod); list.func_74742_a(mod);
} }
fmlData.func_74782_a("ModList", list); fmlData.func_74782_a("ModList", list);
NBTTagList itemList = new NBTTagList();
GameData.writeItemData(itemList);
fmlData.func_74782_a("ModItemData", itemList);
return fmlData; return fmlData;
} }
@@ -101,5 +104,16 @@ 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);
}
} }
} }
+52 -10
View File
@@ -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,6 +55,7 @@ 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;
@@ -86,10 +93,14 @@ public class FMLModContainer implements ModContainer
.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(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 +346,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 +412,44 @@ 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");
if (expectedFingerprint != "" && !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)];
}
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)
{
handleModStateEvent(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints)));
}
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide()); ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
processFieldAnnotations(event.getASMHarvestedData()); processFieldAnnotations(event.getASMHarvestedData());
} }
@@ -479,4 +515,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 -1
View File
@@ -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())
{ {
+8 -3
View File
@@ -26,7 +26,7 @@ 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 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 +476,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);
@@ -721,7 +726,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,7 +740,7 @@ 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() {
+22 -2
View File
@@ -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
@@ -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("beg")) //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,23 @@
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 FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints)
{
super();
this.isDirectory = isDirectory;
this.source = source;
this.fingerprints = fingerprints;
}
}
@@ -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,37 @@ 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.
*
* @return Certificates used to sign FML and Forge
*/
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
@@ -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;
@@ -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,8 +1,8 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.Container; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.EntityPlayer; import net.minecraft.inventory.Container;
import net.minecraft.src.World; import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.IGuiHandler;
public class ModLoaderGuiHelper implements IGuiHandler public class ModLoaderGuiHelper implements IGuiHandler
@@ -23,13 +23,13 @@ import com.google.common.collect.ArrayListMultimap;
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 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;
@@ -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_92014_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));
}
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
{ {
@@ -7,13 +7,13 @@ import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.logging.Level; import java.util.logging.Level;
import net.minecraft.src.BiomeGenBase; import net.minecraft.entity.Entity;
import net.minecraft.src.Entity; import net.minecraft.entity.EntityList;
import net.minecraft.src.EntityList; import net.minecraft.entity.EntityLiving;
import net.minecraft.src.EntityLiving; import net.minecraft.entity.EntityTracker;
import net.minecraft.src.EntityTracker; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.src.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.src.SpawnListEntry; import net.minecraft.world.biome.SpawnListEntry;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
@@ -0,0 +1,168 @@
package cpw.mods.fml.common.registry;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.google.common.base.Function;
import com.google.common.collect.MapDifference;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.ModContainer;
public class GameData {
private static Map<Integer, ItemData> idMap = Maps.newHashMap();
private static CountDownLatch serverValidationLatch;
private static CountDownLatch clientValidationLatch;
private static MapDifference<Integer, ItemData> difference;
private static boolean shouldContinue = true;
private static boolean isSaveValid = true;
public static void newItemAdded(Item item)
{
ModContainer mc = Loader.instance().activeModContainer();
if (mc == null)
{
mc = Loader.instance().getMinecraftModContainer();
if (Loader.instance().hasReachedState(LoaderState.AVAILABLE))
{
FMLLog.severe("It appears something has tried to allocate an Item outside of the initialization phase of Minecraft, this could be very bad for your network connectivity.");
}
}
String itemType = item.getClass().getName();
ItemData itemData = new ItemData(item, mc);
if (idMap.containsKey(item.field_77779_bT))
{
ItemData id = idMap.get(item.field_77779_bT);
FMLLog.warning("[ItemTracker] The mod %s is attempting to overwrite existing item at %d (%s from %s) with %s", mc.getModId(), id.getItemId(), id.getItemType(), id.getModId(), itemType);
}
idMap.put(item.field_77779_bT, itemData);
FMLLog.fine("[ItemTracker] Adding item %s(%d) owned by %s", item.getClass().getName(), item.field_77779_bT, mc.getModId());
}
public static void validateWorldSave(Set<ItemData> worldSaveItems)
{
isSaveValid = true;
shouldContinue = true;
// allow ourselves to continue if there's no saved data
if (worldSaveItems == null)
{
serverValidationLatch.countDown();
try
{
clientValidationLatch.await();
}
catch (InterruptedException e)
{
}
return;
}
Function<? super ItemData, Integer> idMapFunction = new Function<ItemData, Integer>() {
public Integer apply(ItemData input) {
return input.getItemId();
};
};
Map<Integer,ItemData> worldMap = Maps.uniqueIndex(worldSaveItems,idMapFunction);
difference = Maps.difference(worldMap, idMap);
FMLLog.fine("The difference set is %s", difference);
if (!difference.entriesDiffering().isEmpty() || !difference.entriesOnlyOnLeft().isEmpty())
{
FMLLog.severe("FML has detected item discrepancies");
FMLLog.severe("Missing items : %s", difference.entriesOnlyOnLeft());
FMLLog.severe("Mismatched items : %s", difference.entriesDiffering());
isSaveValid = false;
serverValidationLatch.countDown();
}
else
{
isSaveValid = true;
serverValidationLatch.countDown();
}
try
{
clientValidationLatch.await();
if (!shouldContinue)
{
throw new RuntimeException("This server instance is going to stop abnormally because of a fatal ID mismatch");
}
}
catch (InterruptedException e)
{
}
}
public static void writeItemData(NBTTagList itemList)
{
for (ItemData dat : idMap.values())
{
itemList.func_74742_a(dat.toNBT());
}
}
/**
* Initialize the server gate
* @param gateCount the countdown amount. If it's 2 we're on the client and the client and server
* will wait at the latch. 1 is a server and the server will proceed
*/
public static void initializeServerGate(int gateCount)
{
serverValidationLatch = new CountDownLatch(gateCount - 1);
clientValidationLatch = new CountDownLatch(gateCount - 1);
}
public static MapDifference<Integer, ItemData> gateWorldLoadingForValidation()
{
try
{
serverValidationLatch.await();
if (!isSaveValid)
{
return difference;
}
}
catch (InterruptedException e)
{
}
difference = null;
return null;
}
public static void releaseGate(boolean carryOn)
{
shouldContinue = carryOn;
clientValidationLatch.countDown();
}
public static Set<ItemData> buildWorldItemData(NBTTagList modList)
{
Set<ItemData> worldSaveItems = Sets.newHashSet();
for (int i = 0; i < modList.func_74745_c(); i++)
{
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
ItemData dat = new ItemData(mod);
worldSaveItems.add(dat);
}
return worldSaveItems;
}
static void setName(Item item, String name, String modId)
{
int id = item.field_77779_bT;
ItemData itemData = idMap.get(id);
itemData.setName(name,modId);
}
}
@@ -1,28 +1,38 @@
package cpw.mods.fml.common.registry; package cpw.mods.fml.common.registry;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level; import java.util.logging.Level;
import net.minecraft.src.BiomeGenBase; import net.minecraft.entity.item.EntityItem;
import net.minecraft.src.CraftingManager; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.EntityItem; import net.minecraft.inventory.IInventory;
import net.minecraft.src.EntityPlayer; import net.minecraft.item.Item;
import net.minecraft.src.FurnaceRecipes; import net.minecraft.item.ItemBlock;
import net.minecraft.src.IChunkProvider; import net.minecraft.item.ItemStack;
import net.minecraft.src.IInventory; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.src.IRecipe; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.src.ItemBlock; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.src.ItemStack; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.TileEntity; import net.minecraft.nbt.NBTTagList;
import net.minecraft.src.World; import net.minecraft.tileentity.TileEntity;
import net.minecraft.src.WorldType; import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import com.google.common.base.Function;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.MapDifference;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.collect.Sets.SetView;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ICraftingHandler; import cpw.mods.fml.common.ICraftingHandler;
@@ -41,11 +51,9 @@ import cpw.mods.fml.common.ModContainer;
public class GameRegistry public class GameRegistry
{ {
private static Multimap<ModContainer, BlockProxy> blockRegistry = ArrayListMultimap.create(); private static Multimap<ModContainer, BlockProxy> blockRegistry = ArrayListMultimap.create();
private static Multimap<ModContainer, ItemProxy> itemRegistry = ArrayListMultimap.create();
private static Set<IWorldGenerator> worldGenerators = Sets.newHashSet(); private static Set<IWorldGenerator> worldGenerators = Sets.newHashSet();
private static List<IFuelHandler> fuelHandlers = Lists.newArrayList(); private static List<IFuelHandler> fuelHandlers = Lists.newArrayList();
private static List<ICraftingHandler> craftingHandlers = Lists.newArrayList(); private static List<ICraftingHandler> craftingHandlers = Lists.newArrayList();
private static List<IDispenserHandler> dispenserHandlers = Lists.newArrayList();
private static List<IPickupNotifier> pickupHandlers = Lists.newArrayList(); private static List<IPickupNotifier> pickupHandlers = Lists.newArrayList();
private static List<IPlayerTracker> playerTrackers = Lists.newArrayList(); private static List<IPlayerTracker> playerTrackers = Lists.newArrayList();
@@ -83,33 +91,29 @@ public class GameRegistry
} }
} }
/**
* Deprecated without replacement. Use vanilla DispenserRegistry code
*
* @param handler
*/
@Deprecated
public static void registerDispenserHandler(IDispenserHandler handler) public static void registerDispenserHandler(IDispenserHandler handler)
{ {
dispenserHandlers.add(handler);
} }
/** /**
* Register a handler for dispensers * Deprecated without replacement. Use vanilla DispenserRegistry code
* *
* @param handler * @param handler
*/ */
@Deprecated @Deprecated
public static void registerDispenserHandler(final IDispenseHandler handler) public static void registerDispenserHandler(final IDispenseHandler handler)
{ {
registerDispenserHandler(new IDispenserHandler()
{
@Override
public int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ)
{
return handler.dispense(x, y, z, xVelocity, zVelocity, world, item, random, entX, entY, entZ);
}
});
} }
/** /**
* Callback hook for dispenser activities - if you add a block and want mods to be able *
* to extend their dispenser related activities to it call this * Deprecated without replacement, use vanilla DispenserRegistry code
* *
* @param world * @param world
* @param x * @param x
@@ -119,16 +123,9 @@ public class GameRegistry
* @param zVelocity * @param zVelocity
* @param item * @param item
*/ */
@Deprecated
public static int tryDispense(World world, int x, int y, int z, int xVelocity, int zVelocity, ItemStack item, Random random, double entX, double entY, double entZ) public static int tryDispense(World world, int x, int y, int z, int xVelocity, int zVelocity, ItemStack item, Random random, double entX, double entY, double entZ)
{ {
for (IDispenserHandler handler : dispenserHandlers)
{
int dispensed = handler.dispense(x, y, z, xVelocity, zVelocity, world, item, random, entX, entY, entZ);
if (dispensed>-1)
{
return dispensed;
}
}
return -1; return -1;
} }
/** /**
@@ -141,7 +138,7 @@ public class GameRegistry
public static Object buildBlock(ModContainer container, Class<?> type, Block annotation) throws Exception public static Object buildBlock(ModContainer container, Class<?> type, Block annotation) throws Exception
{ {
Object o = type.getConstructor(int.class).newInstance(findSpareBlockId()); Object o = type.getConstructor(int.class).newInstance(findSpareBlockId());
registerBlock((net.minecraft.src.Block) o); registerBlock((net.minecraft.block.Block) o);
return o; return o;
} }
@@ -155,22 +152,81 @@ public class GameRegistry
return BlockTracker.nextBlockId(); return BlockTracker.nextBlockId();
} }
/**
* Register an item with the item registry with a custom name : this allows for easier server->client resolution
*
* @param item The item to register
* @param name The mod-unique name of the item
*/
public static void registerItem(net.minecraft.item.Item item, String name)
{
registerItem(item, name, null);
}
/**
* Register the specified Item with a mod specific name : overrides the standard type based name
* @param item The item to register
* @param name The mod-unique name to register it as - null will remove a custom name
* @param modId An optional modId that will "own" this block - generally used by multi-mod systems
* where one mod should "own" all the blocks of all the mods, null defaults to the active mod
*/
public static void registerItem(net.minecraft.item.Item item, String name, String modId)
{
GameData.setName(item, name, modId);
}
/** /**
* Register a block with the world * Register a block with the world
* *
*/ */
public static void registerBlock(net.minecraft.src.Block block) @Deprecated
public static void registerBlock(net.minecraft.block.Block block)
{ {
registerBlock(block, ItemBlock.class); registerBlock(block, ItemBlock.class);
} }
/**
* Register a block with the specified mod specific name : overrides the standard type based name
* @param block The block to register
* @param name The mod-unique name to register it as
*/
public static void registerBlock(net.minecraft.block.Block block, String name)
{
registerBlock(block, ItemBlock.class, name);
}
/** /**
* Register a block with the world, with the specified item class * Register a block with the world, with the specified item class
* *
* @param block * Deprecated in favour of named versions
* @param itemclass *
* @param block The block to register
* @param itemclass The item type to register with it
*/ */
public static void registerBlock(net.minecraft.src.Block block, Class<? extends ItemBlock> itemclass) @Deprecated
public static void registerBlock(net.minecraft.block.Block block, Class<? extends ItemBlock> itemclass)
{
registerBlock(block, itemclass, null);
}
/**
* Register a block with the world, with the specified item class and block name
* @param block The block to register
* @param itemclass The item type to register with it
* @param name The mod-unique name to register it with
*/
public static void registerBlock(net.minecraft.block.Block block, Class<? extends ItemBlock> itemclass, String name)
{
registerBlock(block, itemclass, name, null);
}
/**
* Register a block with the world, with the specified item class, block name and owning modId
* @param block The block to register
* @param itemclass The iterm type to register with it
* @param name The mod-unique name to register it with
* @param modId The modId that will own the block name. null defaults to the active modId
*/
public static void registerBlock(net.minecraft.block.Block block, Class<? extends ItemBlock> itemclass, String name, String modId)
{ {
if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) if (Loader.instance().isInState(LoaderState.CONSTRUCTING))
{ {
@@ -181,7 +237,8 @@ public class GameRegistry
assert block != null : "registerBlock: block cannot be null"; assert block != null : "registerBlock: block cannot be null";
assert itemclass != null : "registerBlock: itemclass cannot be null"; assert itemclass != null : "registerBlock: itemclass cannot be null";
int blockItemId = block.field_71990_ca - 256; int blockItemId = block.field_71990_ca - 256;
itemclass.getConstructor(int.class).newInstance(blockItemId); Item i = itemclass.getConstructor(int.class).newInstance(blockItemId);
GameRegistry.registerItem(i,name, modId);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -193,7 +250,7 @@ public class GameRegistry
public static void addRecipe(ItemStack output, Object... params) public static void addRecipe(ItemStack output, Object... params)
{ {
CraftingManager.func_77594_a().func_77595_a(output, params); CraftingManager.func_77594_a().func_92051_a(output, params);
} }
public static void addShapelessRecipe(ItemStack output, Object... params) public static void addShapelessRecipe(ItemStack output, Object... params)
@@ -302,4 +359,5 @@ public class GameRegistry
for(IPlayerTracker tracker : playerTrackers) for(IPlayerTracker tracker : playerTrackers)
tracker.onPlayerRespawn(player); tracker.onPlayerRespawn(player);
} }
} }
Loaded 100 of 245 files, more files were not shown because too many files have changed in this diff. Show more