Compare commits

...
154 Commits
Author SHA1 Message Date
Christian f7cc50b521 Update for MC 1.4.7 2012-12-28 10:07:53 -05:00
Christian 1a232cf766 Fix multiple GUI containers for ML containers. Sorry ultimatechest that
this fix took so long, a bug report at github.com/cpw/FML would help,
next time ;)
2012-12-27 23:00:52 -05:00
Christian 853f54bcc2 Log if there's a problem reading the class bytes 2012-12-27 23:00:37 -05:00
LexManos 127be2237d Fix NPE in fingerprint loading, and pass expectged fingerprint to FMLFingerprintViolationEvent 2012-12-25 15:59:30 -08:00
Christian 7e6456d7cd Fix a message delivery issue in IMC 2012-12-24 09:41:22 -05:00
Christian 664ebda599 Some tweaks for signing and ID matching 2012-12-23 22:27:26 -05:00
LexManos 9b4a225ad2 Remove unneeded file 2012-12-20 14:30:59 -08:00
LexManos 6c59fa2d2c Fixed placement of onConnectionClosed callback. 2012-12-20 14:30:41 -08:00
LexManos 5736d850f0 MCP will reobf classes with reserved names in windows to a legal file name. And FML will try to read these classes over the default ones. 2012-12-19 19:10:00 -08:00
LexManos 127d6ee8ac Output obfed files with reserved windows names to _NAME.class 2012-12-19 18:12:11 -08:00
LexManos 2055543042 Add quotes around javac command. 2012-12-19 02:58:09 -08:00
Christian 40e57a26a9 Update MCP to newer version
Fix fingerprint fire
2012-12-18 16:43:48 -05:00
Christian d604e44195 InterModComms now supports a runtime polling based model for inter-mod comms at
runtime.
Deprecate method that shouldn't be used. COPY it's content to your mod. Don't CALL it.
2012-12-18 13:58:57 -05:00
Christian 8b7778ccb6 Don't be as alarming about item overwrites. 2012-12-18 08:33:46 -05:00
Christian 7e30814ecb Added configuration file which allows modids to ignore ID validation checking. IT WILL CRASH YOUR GAME in 99.999% of cases.
Immibis is a whingy ass. And TinyTimRob too. Now STFU and GTFO. closes #510 for ever.
2012-12-18 08:15:46 -05:00
LexManos e5b1dfb74c Dixed ev eclipse worksapce, now references BC. 2012-12-18 05:10:32 -08:00
LexManos 27bc77363e Added client src folder to classpath for startclient/startserver. 2012-12-18 05:06:20 -08:00
LexManos 506b73d0a0 Removed hardcoded additions 2012-12-18 05:05:25 -08:00
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
Christian 418deba5bf Update to MC 1.4.4 2012-11-08 17:55:20 -05:00
Christian 4ff2cff3c0 Fix bug when a modloader mod is run on a dedicated server and has a
connection handler assigned to it. Hi SmartMoving! Perhaps you should try
@Mod instead of BaseMod?
2012-11-04 10:57:49 -05:00
Christian bd2123cf9d Clean up some patch fuzz 2012-11-02 17:32:39 -04:00
Christian c2a603c910 Update joined.exc file from latest conf 2012-11-02 17:23:54 -04:00
Christian db12af48fa Update to 1.4.3 2012-11-01 23:53:13 -04:00
Christian a0f574a0ac A useful tool for performing updates 2012-11-01 23:11:21 -04:00
Christian 8356fe9a7b FUUUUUU! Stupid ticking. STOP REGISTERING TICK HANDLERS IN YOUR CONSTRUCTORS.
I'm looking at you Rei's!
2012-11-01 10:51:17 -04:00
Christian 6edce8b5f4 Patch a file handle leak in RegionFileCache handling when under memory pressure. 2012-10-31 22:58:01 -04:00
LexManos ca2bbe0b5f Update MCP mapings again, yay bad syncs. 2012-10-31 09:23:17 -07:00
LexManos c8941a7faa Updated MCP mapings. 2012-10-31 07:40:53 -07:00
LexManos 5e20c03736 StartServer is now useable in merged code base. 2012-10-31 07:40:40 -07:00
Christian b19e882aab Remove some debug, closes #123 2012-10-30 21:53:08 -04:00
Christian 9d7d32a1b5 Fix up tick management outside of mod loading phases for ModLoader mods. 2012-10-30 21:47:06 -04:00
Christian d512539554 Negatively cache failed class lookups, should help with @SideOnly performance issues. 2012-10-30 21:17:17 -04:00
Christian a3a93f3387 Fix some whitespace issues, handle possibly bugged entities as well 2012-10-30 09:13:18 -04:00
Christian a7eb5dc773 Vanilla/mod bug fixes: CME on entity processing, TileEntity resetting chunk on save/load. 2012-10-29 17:41:08 -04:00
Christian b23081df78 Support for ModLoader 1.4.2. Good job Risu! 2012-10-28 23:55:58 -04:00
Christian 66db4ec46e Add in an exclusion list tag for @Mod. The backend code isn't yet implemented, but shows the basic idea. 2012-10-27 15:13:28 -04:00
Christian 8bd98c3a2d Fix a small problem with the new MCP container- it can cause NPEs. Nice. 2012-10-26 07:55:23 -04:00
Christian 34cc42d3cb Fix up some javadoc complaints 2012-10-25 16:18:42 -04:00
Christian 09eade4623 Update build - include MCP information in the source pack 2012-10-25 10:00:34 -04:00
Christian 9bfe7df373 MCP deserves lots of credit. So here it is. 2012-10-25 09:02:49 -04:00
Christian 8006b774bf Fix instantiation bug 2012-10-24 21:58:36 -04:00
Christian 7cc91cfb0c Simple InterMod comms. Send a message using FMLInterModComms.sendMessage(). Receive messages through an @IMCCallback 2012-10-24 16:39:55 -04:00
Christian 24d72852e7 Update for MC 1.4.2 2012-10-24 15:12:06 -04:00
Christian cedf3d55d5 Duplicate Mod display screen. 2012-10-24 09:41:46 -04:00
Christian d915f39996 Fix typo in access transformer 2012-10-23 21:21:28 -04:00
Christian 346691c298 Fix the merge for forge 2012-10-23 18:36:05 -04:00
Christian 6dadc1d889 Fix up references to minecraftDir in obf code 2012-10-23 18:10:06 -04:00
Christian 8a55f68a18 Update FML for Minecraft 1.4.1 2012-10-23 18:00:33 -04:00
LexManos 5645fa5847 First update to 1.4.1, patches need updating. 2012-10-23 14:44:04 -07:00
LexManos ff0f00f64f Add some null checks, and throw descriptive exception when SideTransformer prevents a class from loading. 2012-10-23 13:32:02 -07:00
Christian 7a34246dc9 Ship a client only class so the merge works both sides. 2012-10-21 22:50:20 -04:00
Christian 62a6b52487 Fix RenderRegistry render ID - now at 36
Fix SpriteMaps - they're running out fast! Switch to forge if you can!
RenderBiped now has an armorlist- so armortypes add to it as well
2012-10-21 12:41:53 -04:00
Christian b845cde73d Fix up FML python script for forge 2012-10-21 08:19:36 -04:00
Christian 2c36dfbb34 Update to MCP pre 3. Fixes some weirdnesses with explosions. 2012-10-21 07:11:09 -04:00
Christian acd880dd2a Merge branch '1.4' 2012-10-20 18:07:22 -04:00
258 changed files with 23108 additions and 18011 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
+85 -100
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,23 +124,33 @@
</target> </target>
<target name="merge-common"> <target name="merge-common">
<copy todir="${common.mcp.srcdir}" overwrite="true" verbose="true"> <copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
<fileset dir="${common.src.dir}" includes="**/*.java" /> <fileset dir="${common.src.dir}" includes="**/*.java" />
</copy> </copy>
</target> </target>
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" /> <target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
<target name="build-client" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion"/> <target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<target name="extract-built-jar">
<side prop="output" src="mcp.obfoutput" side="${side}" />
<property name="jarname" value="${modname}-${side}-${version}" />
<mkdir dir="${basedir}/target" /> <mkdir dir="${basedir}/target" />
<zip destfile="${basedir}/target/${jarname}.zip"> <jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
<fileset dir="${output}" includes="**/*.class" /> <manifest>
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
<attribute name="Class-Path" value="minecraft_server.jar"/>
</manifest>
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class"/>
</jar>
<antcall target="signjar"/>
<zip update="true" destfile="${basedir}/target/${universal.jarname}.zip" >
<fileset dir="${client.mcp.obfoutput}" includes="*.class"/>
<zipfileset dir="${basedir}" includes="fmlversion.properties"/> <zipfileset dir="${basedir}" includes="fmlversion.properties"/>
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" /> <zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
<zipfileset dir="${client.src.dir}" includes="mcp.png" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/> <zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
<zipfileset dir="${common.src.dir}" includes="*.cfg" /> <zipfileset dir="${common.src.dir}" includes="*.cfg" />
<mappedresources> <mappedresources>
@@ -167,47 +171,19 @@
</zip> </zip>
</target> </target>
<target name="build-universal" depends="build-client">
<property name="universal.jarname" value="${modname}-universal-${version}" />
<mkdir dir="${basedir}/target" />
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
<attribute name="Class-Path" value="minecraft_server.jar"/>
</manifest>
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="README-fml.txt" />
</mappedresources>
</jar>
</target>
<target name="build-source-pack" depends="makeversion"> <target name="build-source-pack" depends="makeversion">
<property name="srcpack.jarname" value="${modname}-src-${version}" /> <property name="srcpack.jarname" value="${modname}-src-${version.minecraft}-${version}-${version.branch}" />
<zip destfile="${basedir}/target/${srcpack.jarname}.zip"> <zip destfile="${basedir}/target/${srcpack.jarname}.zip">
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg" prefix="fml" /> <zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg,mc_versions.cfg" prefix="fml" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" /> <zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" /> <zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
<zipfileset dir="${client.src.dir}" includes="mcp.png" prefix="fml/client" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" /> <zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" /> <zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" prefix="fml/common" />
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" /> <zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" /> <zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
<mappedresources> <mappedresources>
<concat> <concat>
<fileset dir="${basedir}/install" includes="README.txt" /> <fileset dir="${basedir}/install" includes="README.txt" />
@@ -227,7 +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"/>
@@ -248,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}"/>
@@ -266,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}" />
@@ -281,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}" />
@@ -325,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">
@@ -349,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}"/>
@@ -364,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
+101 -19
View File
@@ -17,32 +17,39 @@ 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;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.DuplicateModsFoundException;
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.IFMLSidedHandler; import cpw.mods.fml.common.IFMLSidedHandler;
@@ -53,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;
/** /**
@@ -109,11 +119,14 @@ public class FMLClientHandler implements IFMLSidedHandler
private CustomModLoadingErrorDisplayException customError; private CustomModLoadingErrorDisplayException customError;
private DuplicateModsFoundException dupesFound;
private boolean serverShouldBeKilledQuietly;
/** /**
* Called to start the whole game off from * Called to start the whole game off
* {@link MinecraftServer#startServer}
* *
* @param minecraftServer * @param minecraft The minecraft instance being launched
*/ */
public void beginMinecraftLoading(Minecraft minecraft) public void beginMinecraftLoading(Minecraft minecraft)
{ {
@@ -151,6 +164,10 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
wrongMC = wrong; wrongMC = wrong;
} }
catch (DuplicateModsFoundException dupes)
{
dupesFound = dupes;
}
catch (MissingModsException missing) catch (MissingModsException missing)
{ {
modsMissing = missing; modsMissing = missing;
@@ -181,7 +198,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void finishMinecraftLoading() public void finishMinecraftLoading()
{ {
if (modsMissing != null || wrongMC != null) if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null)
{ {
return; return;
} }
@@ -217,6 +234,10 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
client.func_71373_a(new GuiModsMissing(modsMissing)); client.func_71373_a(new GuiModsMissing(modsMissing));
} }
else if (dupesFound != null)
{
client.func_71373_a(new GuiDupesFound(dupesFound));
}
else if (customError != null) else if (customError != null)
{ {
client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError)); client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError));
@@ -279,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();
} }
} }
@@ -393,6 +414,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override @Override
public void beginServerLoading(MinecraftServer server) public void beginServerLoading(MinecraftServer server)
{ {
serverShouldBeKilledQuietly = false;
// NOOP // NOOP
} }
@@ -448,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
{ {
@@ -0,0 +1,45 @@
package cpw.mods.fml.client;
import java.io.File;
import java.util.Map.Entry;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.common.DuplicateModsFoundException;
import cpw.mods.fml.common.MissingModsException;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.versioning.ArtifactVersion;
public class GuiDupesFound extends GuiErrorScreen
{
private DuplicateModsFoundException dupes;
public GuiDupesFound(DuplicateModsFoundException dupes)
{
this.dupes = dupes;
}
@Override
public void func_73866_w_()
{
super.func_73866_w_();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
int offset = Math.max(85 - dupes.dupes.size() * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "You have mod sources that are duplicate within your system", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "Mod Id : File name", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=5;
for (Entry<ModContainer, File> mc : dupes.dupes.entries())
{
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.field_73880_f / 2, offset, 0xEEEEEE);
}
}
}
@@ -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
{ {
+13 -13
View File
@@ -34,7 +34,7 @@ public class SpriteHelper
SpriteHelper.toBitSet( SpriteHelper.toBitSet(
"0000000000000000" + "0000000000000000" +
"0000000000110000" + "0000000000110000" +
"0000000001100000" + "0000000000100000" +
"0000000001100000" + "0000000001100000" +
"0000000000000000" + "0000000000000000" +
"0000000000000000" + "0000000000000000" +
@@ -43,10 +43,10 @@ public class SpriteHelper
"0000000000000000" + "0000000000000000" +
"0000000000000000" + "0000000000000000" +
"0000000000000000" + "0000000000000000" +
"0000000011111111" + "0000000000011111" +
"0000000011111000" + "0000000000000000" +
"0000000111111100" + "0000000001111100" +
"0000000111111000" + "0000000001111000" +
"0000000000000000"); "0000000000000000");
spriteInfo.put("/terrain.png", slots); spriteInfo.put("/terrain.png", slots);
@@ -57,15 +57,15 @@ public class SpriteHelper
"0000000000000000" + "0000000000000000" +
"0000000000000000" + "0000000000000000" +
"0000000000000000" + "0000000000000000" +
"0000001000000000" + "0000000000000000" +
"0000001110000000" + "0000000000000000" +
"0000001000000000" + "0000000000000000" +
"1111101010000000" + "0111110000000000" +
"1111101010000000" + "1111111010000000" +
"1111101110000000" + "0111111110000000" +
"1111111111110000" + "0111111111111001" +
"1111111111111111" +
"1111111111111111" + "1111111111111111" +
"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,13 +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.RenderBlocks; import net.minecraft.world.IBlockAccess;
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;
@@ -26,7 +24,7 @@ public class RenderingRegistry
{ {
private static final RenderingRegistry INSTANCE = new RenderingRegistry(); private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private int nextRenderId = 32; private int nextRenderId = 36;
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap(); private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
@@ -40,6 +38,7 @@ public class RenderingRegistry
public static int addNewArmourRendererPrefix(String armor) public static int addNewArmourRendererPrefix(String armor)
{ {
RenderPlayer.field_77110_j = ObjectArrays.concat(RenderPlayer.field_77110_j, armor); RenderPlayer.field_77110_j = ObjectArrays.concat(RenderPlayer.field_77110_j, armor);
RenderBiped.field_82424_k = RenderPlayer.field_77110_j;
return RenderPlayer.field_77110_j.length - 1; return RenderPlayer.field_77110_j.length - 1;
} }
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

+22 -21
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
{ {
@@ -169,23 +187,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
{ {
} }
/**
* Override if you wish to perform some action other than just dispensing the item from the dispenser
*
* @param world
* @param x
* @param y
* @param z
* @param xVel
* @param zVel
* @param item
*/
@Override
public int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX, double entY, double entZ)
{
return -1;
}
/** /**
* Override if you wish to generate Nether (Hell biome) blocks * Override if you wish to generate Nether (Hell biome) blocks
* *
@@ -299,7 +300,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/** /**
* Only implemented on the client side * Only implemented on the client side
* {@link #serverChat(EntityPlayer, Packet3Chat)} * {@link #serverChat(NetServerHandler, String)}
* *
* @param text * @param text
*/ */
@@ -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;
+59 -17
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
@@ -69,7 +102,7 @@ public class ModLoader
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented elsewhere.
* *
* {@link GameRegistry#getFuelValue(ItemStack))} * {@link GameRegistry#getFuelValue(ItemStack)}
* *
* @param id The Item ID * @param id The Item ID
* @param metadata The Item Metadata * @param metadata The Item Metadata
@@ -95,9 +128,9 @@ public class ModLoader
/** /**
* Adds a new prefix to the armor texture list * Adds a new prefix to the armor texture list
* *
* {@link RenderingRegistry#addNewArmourRendererPrefix(String))} * {@link RenderingRegistry#addNewArmourRendererPrefix(String)}
* *
* @param armor The new armor prefix * @param armor The new armor prefix
* @return The new armor index * @return The new armor index
*/ */
@@ -126,6 +159,17 @@ public class ModLoader
{ {
ModLoaderHelper.addCommand(command); ModLoaderHelper.addCommand(command);
} }
/**
* Add a behaviour to the dispenser
*
* @param item
* @param behavior
*/
public static void addDispenserBehavior(Item item, IBehaviorDispenseItem behavior)
{
BlockDispenser.field_82527_a.func_82595_a(item, behavior);
}
/** /**
* Add localization for the specified string * Add localization for the specified string
* *
@@ -173,13 +217,13 @@ public class ModLoader
} }
/** /**
* Attempts to register a small image to be applied to a larger texture image, * Attempts to register a small image to be applied to a larger texture image,
* typically how old ModLoader mods add custom Item/Block textures. * typically how old ModLoader mods add custom Item/Block textures.
* *
* Forge mods should use setTextureFile in Item/Block * Forge mods should use setTextureFile in Item/Block
* *
* Will return the icon index it was applied to. * Will return the icon index it was applied to.
* *
* Unimplemented on the server as it does not render textures * Unimplemented on the server as it does not render textures
* *
* @param fileToOverride The texture to apply the new image to * @param fileToOverride The texture to apply the new image to
@@ -193,11 +237,11 @@ public class ModLoader
} }
/** /**
* Attempts to register a small image to be applied to a larger texture image, * Attempts to register a small image to be applied to a larger texture image,
* typically how old ModLoader mods add custom Item/Block textures. * typically how old ModLoader mods add custom Item/Block textures.
* *
* Forge mods should use setTextureFile in Item/Block * Forge mods should use setTextureFile in Item/Block
* *
* Unimplemented on the server as it does not render textures * Unimplemented on the server as it does not render textures
* *
* @param path The texture to apply the new image to * @param path The texture to apply the new image to
@@ -563,7 +607,6 @@ public class ModLoader
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented elsewhere.
* {@link FMLNetworkHandler#handlePacket250(Packet250CustomPayload, NetworkManager, NetHandler)}
* *
* @param packet * @param packet
*/ */
@@ -767,7 +810,6 @@ public class ModLoader
} }
/** /**
* Send a chat message to the server * Send a chat message to the server
* {@link FMLNetworkHandler#handleChatMessage(NetHandler, Packet3Chat)}
* *
* @param text * @param text
*/ */
@@ -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;
+52 -111
View File
@@ -9,27 +9,16 @@
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 binlk = {CLIENT: self.binclient, SERVER: self.binserver}
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,7 +786,8 @@
testlk = {CLIENT: self.testclient, SERVER: self.testserver} testlk = {CLIENT: self.testclient, SERVER: self.testserver}
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))): + if side == SERVER:
- return False + return self.checkbins(CLIENT)
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))): if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
+ return False return False
return True return True
@@ -1029,6 +1033,10 @@
def checkbins(self, side):
@@ -1029,6 +1035,10 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver} pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog} pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
@@ -40,33 +29,25 @@
if not os.path.exists(pathbinlk[side]): if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side]) os.makedirs(pathbinlk[side])
@@ -1041,6 +1051,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 +1073,7 @@
raise raise
def startserver(self): def startserver(self):
- classpath = [self.binserver] + self.cpathserver - classpath = [self.binserver] + self.cpathserver
+ classpath = [self.binserver, self.srcshared] + self.cpathserver + classpath = [self.binclient, self.srcclient] + self.cpathserver
classpath = [os.path.join('..', p) for p in classpath] classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath) classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars) os.chdir(self.dirjars)
@@ -1070,7 +1081,7 @@ @@ -1070,7 +1078,7 @@
self.runmc(forkcmd) self.runmc(forkcmd)
def startclient(self): def startclient(self):
- classpath = [self.binclient] + self.cpathclient - classpath = [self.binclient] + self.cpathclient
+ classpath = [self.binclient, self.srcshared] + self.cpathclient + classpath = [self.binclient, self.srcclient] + self.cpathclient
classpath = [os.path.join('..', p) for p in classpath] classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath) classpath = os.pathsep.join(classpath)
natives = os.path.join('..', self.dirnatives) natives = os.path.join('..', self.dirnatives)
@@ -1197,20 +1208,20 @@ @@ -1197,20 +1205,20 @@
with open(self.csvmethods, 'rb') as fh: with open(self.csvmethods, 'rb') as fh:
methodsreader = csv.DictReader(fh) methodsreader = csv.DictReader(fh)
for row in methodsreader: for row in methodsreader:
@@ -90,56 +71,7 @@
names['params'][row['param']] = row['name'] names['params'][row['param']] = row['name']
regexps = { regexps = {
@@ -1240,6 +1251,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 +1338,14 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
strip_comments(pathsrclk[side])
+ strip_comments(self.srcshared)
def process_cleanup(self, side):
"""Do lots of random cleanups including stripping comments, trailing whitespace and extra blank lines"""
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
src_cleanup(pathsrclk[side], fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
+ src_cleanup(self.srcshared, fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
def process_javadoc(self, side):
"""Add CSV descriptions to methods and fields as javadoc"""
@@ -1336,6 +1354,21 @@
if not self.has_doc_csv:
self.logger.warning('!! javadoc disabled due to no csvs !!')
return False
+
+ #FML Recall this function on the common folder
+ #Potential bug: If this is called without a subsiquent rename call, will cause double comments
+ if pathsrclk[side] != self.srcshared:
+ if side == CLIENT:
+ tmp = self.srcclient
+ self.srcclient = self.srcshared
+ self.process_javadoc(side)
+ self.srcclient = tmp
+ else:
+ tmp = self.srcserver
+ self.srcserver = self.srcshared
+ self.process_javadoc(side)
+ self.srcserver = tmp
+
#HINT: We read the relevant CSVs
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
@@ -1344,13 +1377,13 @@
methods = {} methods = {}
for row in methodsreader: for row in methodsreader:
#HINT: Only include methods that have a non-empty description #HINT: Only include methods that have a non-empty description
@@ -155,13 +87,7 @@
fields[row['searge']] = row['desc'].replace('*/', '* /') fields[row['searge']] = row['desc'].replace('*/', '* /')
regexps = { regexps = {
@@ -1422,12 +1455,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
@@ -170,7 +96,7 @@
if not reobf: if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server} md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else: else:
@@ -1442,6 +1476,9 @@ @@ -1442,6 +1450,9 @@
class_path = '' class_path = ''
else: else:
class_path += '/' class_path += '/'
@@ -180,7 +106,40 @@
for class_file in fnmatch.filter(filelist, '*.class'): for class_file in fnmatch.filter(filelist, '*.class'):
class_name = class_path + os.path.splitext(class_file)[0] class_name = class_path + os.path.splitext(class_file)[0]
bin_file = os.path.normpath(os.path.join(path, class_file)) bin_file = os.path.normpath(os.path.join(path, class_file))
@@ -1594,6 +1631,9 @@ @@ -1535,6 +1546,8 @@
if not os.path.exists(outpathlk[side]):
os.makedirs(outpathlk[side])
+ reserved = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9']
+
# HINT: We extract the modified class files
with closing(zipfile.ZipFile(jarlk[side])) as zipjar:
for in_class in trgclasses:
@@ -1548,6 +1561,23 @@
out_class = out_class.replace(self.nullpkg, '')
if out_class[0] == '/':
out_class = out_class[1:]
+
+ rename = False
+ for res in reserved:
+ if out_class.upper().startswith(res):
+ rename = True
+ break
+
+ if rename:
+ try:
+ f = open(os.path.join(outpathlk[side], '_' + out_class), 'wb')
+ f.write(zipjar.read(out_class))
+ f.close()
+ self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], '_' + out_class)
+ except IOError:
+ self.logger.error('* File %s failed extracting for %s', out_class, in_class)
+ continue
+
try:
zipjar.extract(out_class, outpathlk[side])
self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class)
@@ -1594,6 +1624,9 @@
sys.exit(1) sys.exit(1)
for entry in newfiles: for entry in newfiles:
@@ -190,7 +149,7 @@
if entry[3] == 'U': if entry[3] == 'U':
self.logger.info('Retrieving file from server : %s', entry[0]) self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0]) cur_file = os.path.normpath(entry[0])
@@ -1614,6 +1654,9 @@ @@ -1614,6 +1647,9 @@
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver} md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver} outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver} src = {CLIENT: self.srcclient, SERVER: self.srcserver}
@@ -200,28 +159,10 @@
# HINT: We need a table for the old md5 and the new ones # HINT: We need a table for the old md5 and the new ones
md5table = {} md5table = {}
@@ -1646,6 +1689,7 @@ @@ -1656,3 +1692,6 @@
# HINT: We extract the source files for the modified class files
for in_class in trgclasses:
src_file = os.path.normpath(os.path.join(src[side], in_class + '.java'))
+ cmn_file = os.path.normpath(os.path.join(self.srcshared, in_class + '.java'))
dest_file = os.path.normpath(os.path.join(outpathlk[side], in_class + '.java'))
if os.path.isfile(src_file):
if not os.path.exists(os.path.dirname(dest_file)):
@@ -1655,4 +1699,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'
+ +
@@ -23,7 +23,7 @@ public @interface BukkitPluginRef
* specification. If this is a bukkit enabled environment the field annotated by this * specification. If this is a bukkit enabled environment the field annotated by this
* will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by * will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by
* reflectively calling the "getModProxy" method on the bukkit plugin instance. * reflectively calling the "getModProxy" method on the bukkit plugin instance.
* @return * @return The name of the plugin which we will inject into this field
*/ */
String value(); String value();
} }
@@ -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;
}
} }
@@ -0,0 +1,16 @@
package cpw.mods.fml.common;
import java.io.File;
import java.util.List;
import com.google.common.collect.SetMultimap;
public class DuplicateModsFoundException extends LoaderException {
public SetMultimap<ModContainer,File> dupes;
public DuplicateModsFoundException(SetMultimap<ModContainer, File> dupes) {
this.dupes = dupes;
}
}
@@ -20,27 +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.DedicatedServer; import net.minecraft.entity.Entity;
import net.minecraft.src.Entity; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.src.EntityPlayerMP; import net.minecraft.nbt.NBTBase;
import net.minecraft.src.NBTBase; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.NBTTagCompound; import net.minecraft.network.INetworkManager;
import net.minecraft.src.NetHandler; import net.minecraft.network.packet.NetHandler;
import net.minecraft.src.Packet131MapData; import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.src.SaveHandler; import net.minecraft.server.*;
import net.minecraft.src.ServerListenThread; import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.src.ThreadMinecraftServer; import net.minecraft.world.World;
import net.minecraft.src.World; import net.minecraft.world.storage.SaveHandler;
import net.minecraft.src.WorldInfo; import net.minecraft.world.storage.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;
@@ -48,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;
@@ -154,7 +157,7 @@ public class FMLCommonHandler
} }
/** /**
* Get the forge mod loader logging instance (goes to the forgemodloader log file) * Get the forge mod loader logging instance (goes to the forgemodloader log file)
* @return * @return The log instance for the FML log file
*/ */
public Logger getFMLLogger() public Logger getFMLLogger()
{ {
@@ -228,13 +231,17 @@ public class FMLCommonHandler
{ {
Builder brd = ImmutableList.<String>builder(); Builder brd = ImmutableList.<String>builder();
brd.add(Loader.instance().getMCVersionString()); brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getMCPVersionString());
brd.add("FML v"+Loader.instance().getFMLVersionString()); brd.add("FML v"+Loader.instance().getFMLVersionString());
String forgeBranding = (String) callForgeMethod("getBrandingVersion"); String forgeBranding = (String) callForgeMethod("getBrandingVersion");
if (!Strings.isNullOrEmpty(forgeBranding)) if (!Strings.isNullOrEmpty(forgeBranding))
{ {
brd.add(forgeBranding); brd.add(forgeBranding);
} }
brd.addAll(sidedDelegate.getAdditionalBrandingInformation()); if (sidedDelegate!=null)
{
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
}
try { try {
Properties props=new Properties(); Properties props=new Properties();
props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties")); props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
@@ -382,11 +389,11 @@ public class FMLCommonHandler
crashCallables.add(callable); crashCallables.add(callable);
} }
public void enhanceCrashReport(CrashReport crashReport) public void enhanceCrashReport(CrashReport crashReport, CrashReportCategory category)
{ {
for (ICrashCallable call: crashCallables) for (ICrashCallable call: crashCallables)
{ {
crashReport.func_71500_a(call.getLabel(), call); category.func_71500_a(call.getLabel(), call);
} }
} }
@@ -436,4 +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);
}
} }
@@ -14,22 +14,23 @@
package cpw.mods.fml.common; package cpw.mods.fml.common;
import java.security.cert.Certificate;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import net.minecraft.src.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.src.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.src.NBTTagString; import net.minecraft.world.storage.SaveHandler;
import net.minecraft.src.SaveHandler; import net.minecraft.world.storage.WorldInfo;
import net.minecraft.src.WorldInfo;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.ItemData;
/** /**
* @author cpw * @author cpw
* *
@@ -75,6 +76,9 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
list.func_74742_a(mod); list.func_74742_a(mod);
} }
fmlData.func_74782_a("ModList", list); fmlData.func_74782_a("ModList", list);
NBTTagList itemList = new NBTTagList();
GameData.writeItemData(itemList);
fmlData.func_74782_a("ModItemData", itemList);
return fmlData; return fmlData;
} }
@@ -101,5 +105,23 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
} }
} }
} }
if (tag.func_74764_b("ModItemData"))
{
NBTTagList modList = tag.func_74761_m("ModItemData");
Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
GameData.validateWorldSave(worldSaveItems);
}
else
{
GameData.validateWorldSave(null);
}
}
@Override
public Certificate getSigningCertificate()
{
Certificate[] certificates = getClass().getProtectionDomain().getCodeSource().getCertificates();
return certificates != null ? certificates[0] : null;
} }
} }
+65 -13
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;
@@ -46,7 +52,10 @@ import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ASMDataTable;
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData; import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.event.FMLServerStartedEvent;
@@ -76,17 +85,22 @@ public class FMLModContainer implements ModContainer
private DefaultArtifactVersion processedVersion; private DefaultArtifactVersion processedVersion;
private boolean isNetworkMod; private boolean isNetworkMod;
private static final BiMap<Class<? extends FMLStateEvent>, Class<? extends Annotation>> modAnnotationTypes = ImmutableBiMap.<Class<? extends FMLStateEvent>, Class<? extends Annotation>>builder() private static final BiMap<Class<? extends FMLEvent>, Class<? extends Annotation>> modAnnotationTypes = ImmutableBiMap.<Class<? extends FMLEvent>, Class<? extends Annotation>>builder()
.put(FMLPreInitializationEvent.class, Mod.PreInit.class) .put(FMLPreInitializationEvent.class, Mod.PreInit.class)
.put(FMLInitializationEvent.class, Mod.Init.class) .put(FMLInitializationEvent.class, Mod.Init.class)
.put(FMLPostInitializationEvent.class, Mod.PostInit.class) .put(FMLPostInitializationEvent.class, Mod.PostInit.class)
.put(FMLServerStartingEvent.class, Mod.ServerStarting.class) .put(FMLServerStartingEvent.class, Mod.ServerStarting.class)
.put(FMLServerStartedEvent.class, Mod.ServerStarted.class) .put(FMLServerStartedEvent.class, Mod.ServerStarted.class)
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class) .put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
.put(IMCEvent.class,Mod.IMCCallback.class)
.put(FMLFingerprintViolationEvent.class, Mod.FingerprintWarning.class)
.build(); .build();
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLStateEvent>> modTypeAnnotations = modAnnotationTypes.inverse(); private static final BiMap<Class<? extends Annotation>, Class<? extends FMLEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
private String annotationDependencies; private String annotationDependencies;
private VersionRange minecraftAccepted; private VersionRange minecraftAccepted;
private boolean fingerprintNotPresent;
private Set<String> sourceFingerprints;
private Certificate certificate;
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor) public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
@@ -332,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
@@ -405,12 +412,51 @@ public class FMLModContainer implements ModContainer
ModClassLoader modClassLoader = event.getModClassLoader(); ModClassLoader modClassLoader = event.getModClassLoader();
modClassLoader.addFile(source); modClassLoader.addFile(source);
Class<?> clazz = Class.forName(className, true, modClassLoader); Class<?> clazz = Class.forName(className, true, modClassLoader);
ASMDataTable asmHarvestedAnnotations = event.getASMHarvestedData();
// TODO Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
asmHarvestedAnnotations.getAnnotationsFor(this); int len = 0;
if (certificates != null)
{
len = certificates.length;
}
Builder<String> certBuilder = ImmutableList.<String>builder();
for (int i = 0; i < len; i++)
{
certBuilder.add(CertificateHelper.getFingerprint(certificates[i]));
}
ImmutableList<String> certList = certBuilder.build();
sourceFingerprints = ImmutableSet.copyOf(certList);
String expectedFingerprint = (String) descriptor.get("certificateFingerprint");
fingerprintNotPresent = true;
if (expectedFingerprint != null && !expectedFingerprint.isEmpty())
{
if (!sourceFingerprints.contains(expectedFingerprint))
{
Level warnLevel = Level.SEVERE;
if (source.isDirectory())
{
warnLevel = Level.FINER;
}
FMLLog.log(warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
}
else
{
certificate = certificates[certList.indexOf(expectedFingerprint)];
fingerprintNotPresent = false;
}
}
annotations = gatherAnnotations(clazz); annotations = gatherAnnotations(clazz);
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData()); isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData());
modInstance = clazz.newInstance(); modInstance = clazz.newInstance();
if (fingerprintNotPresent)
{
eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint));
}
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide()); ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
processFieldAnnotations(event.getASMHarvestedData()); processFieldAnnotations(event.getASMHarvestedData());
} }
@@ -422,7 +468,7 @@ public class FMLModContainer implements ModContainer
} }
@Subscribe @Subscribe
public void handleModStateEvent(FMLStateEvent event) public void handleModStateEvent(FMLEvent event)
{ {
Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass()); Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass());
if (annotation == null) if (annotation == null)
@@ -476,4 +522,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();
}
} }
+18 -10
View File
@@ -19,6 +19,7 @@ import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLLoadEvent; import cpw.mods.fml.common.event.FMLLoadEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLStateEvent; import cpw.mods.fml.common.event.FMLStateEvent;
@@ -93,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())
{ {
@@ -124,7 +125,7 @@ public class LoadController
} }
@Subscribe @Subscribe
public void propogateStateMessage(FMLStateEvent stateEvent) public void propogateStateMessage(FMLEvent stateEvent)
{ {
if (stateEvent instanceof FMLPreInitializationEvent) if (stateEvent instanceof FMLPreInitializationEvent)
{ {
@@ -135,17 +136,20 @@ public class LoadController
activeContainer = mc; activeContainer = mc;
String modId = mc.getModId(); String modId = mc.getModId();
stateEvent.applyModContainer(activeContainer()); stateEvent.applyModContainer(activeContainer());
FMLLog.finer("Posting state event %s to mod %s", stateEvent.getEventType(), modId); FMLLog.finer("Sending event %s to mod %s", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent); eventChannels.get(modId).post(stateEvent);
FMLLog.finer("State event %s delivered to mod %s", stateEvent.getEventType(), modId); FMLLog.finer("Sent event %s to mod %s", stateEvent.getEventType(), modId);
activeContainer = null; activeContainer = null;
if (!errors.containsKey(modId)) if (stateEvent instanceof FMLStateEvent)
{ {
modStates.put(modId, stateEvent.getModState()); if (!errors.containsKey(modId))
} {
else modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
{ }
modStates.put(modId, ModState.ERRORED); else
{
modStates.put(modId, ModState.ERRORED);
}
} }
} }
} }
@@ -229,4 +233,8 @@ public class LoadController
{ {
return this.state == state; return this.state == state;
} }
boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
}
} }
+34 -8
View File
@@ -18,6 +18,7 @@ import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@@ -25,20 +26,23 @@ 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;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultiset; import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.collect.Multiset.Entry; import com.google.common.collect.Multiset.Entry;
import com.google.common.collect.Multisets; import com.google.common.collect.Multisets;
@@ -48,6 +52,7 @@ import com.google.common.collect.TreeMultimap;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.discovery.ModDiscoverer; import cpw.mods.fml.common.discovery.ModDiscoverer;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadEvent; import cpw.mods.fml.common.event.FMLLoadEvent;
import cpw.mods.fml.common.functions.ModIdFunction; import cpw.mods.fml.common.functions.ModIdFunction;
import cpw.mods.fml.common.modloader.BaseModProxy; import cpw.mods.fml.common.modloader.BaseModProxy;
@@ -104,7 +109,7 @@ public class Loader
private static String rev; private static String rev;
private static String build; private static String build;
private static String mccversion; private static String mccversion;
private static String mcsversion; private static String mcpversion;
/** /**
* The class loader we load the mods into. * The class loader we load the mods into.
@@ -133,6 +138,7 @@ public class Loader
private File canonicalModsDir; private File canonicalModsDir;
private LoadController modController; private LoadController modController;
private MinecraftDummyContainer minecraft; private MinecraftDummyContainer minecraft;
private MCPDummyContainer mcp;
private static File minecraftDir; private static File minecraftDir;
private static List<String> injectedContainers; private static List<String> injectedContainers;
@@ -154,7 +160,7 @@ public class Loader
rev = (String) data[2]; rev = (String) data[2];
build = (String) data[3]; build = (String) data[3];
mccversion = (String) data[4]; mccversion = (String) data[4];
mcsversion = (String) data[5]; mcpversion = (String) data[5];
minecraftDir = (File) data[6]; minecraftDir = (File) data[6];
injectedContainers = (List<String>)data[7]; injectedContainers = (List<String>)data[7];
} }
@@ -170,6 +176,7 @@ public class Loader
} }
minecraft = new MinecraftDummyContainer(actualMCVersion); minecraft = new MinecraftDummyContainer(actualMCVersion);
mcp = new MCPDummyContainer(MetadataCollection.from(getClass().getResourceAsStream("/mcpmod.info"), "MCP").getMetadataForId("mcp", null));
} }
/** /**
@@ -299,6 +306,8 @@ public class Loader
private ModDiscoverer identifyMods() private ModDiscoverer identifyMods()
{ {
FMLLog.fine("Building injected Mod Containers %s", injectedContainers); FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
// Add in the MCP mod container
mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
File coremod = new File(minecraftDir,"coremods"); File coremod = new File(minecraftDir,"coremods");
for (String cont : injectedContainers) for (String cont : injectedContainers)
{ {
@@ -341,7 +350,6 @@ public class Loader
private void identifyDuplicates(List<ModContainer> mods) private void identifyDuplicates(List<ModContainer> mods)
{ {
boolean foundDupe = false;
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary()); TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods) for (ModContainer mc : mods)
{ {
@@ -352,15 +360,19 @@ public class Loader
} }
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys()); ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet()) for (Entry<ModContainer> e : duplist.entrySet())
{ {
if (e.getCount() > 1) if (e.getCount() > 1)
{ {
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement())); FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
foundDupe = true; dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
} }
} }
if (foundDupe) { throw new LoaderException(); } if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
} }
/** /**
@@ -451,7 +463,7 @@ public class Loader
{ {
if (nonMod.isFile()) if (nonMod.isFile())
{ {
FMLLog.severe("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName()); FMLLog.info("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
try try
{ {
modClassLoader.addFile(nonMod); modClassLoader.addFile(nonMod);
@@ -464,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);
@@ -638,6 +655,7 @@ public class Loader
// Mod controller should be in the initialization state here // Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION); modController.distributeStateMessage(LoaderState.INITIALIZATION);
modController.transition(LoaderState.POSTINITIALIZATION); modController.transition(LoaderState.POSTINITIALIZATION);
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION); modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
modController.transition(LoaderState.AVAILABLE); modController.transition(LoaderState.AVAILABLE);
modController.distributeStateMessage(LoaderState.AVAILABLE); modController.distributeStateMessage(LoaderState.AVAILABLE);
@@ -708,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)
@@ -720,4 +738,12 @@ public class Loader
{ {
return minecraft; return minecraft;
} }
public boolean hasReachedState(LoaderState state) {
return modController != null ? modController.hasReachedState(state) : false;
}
public String getMCPVersionString() {
return String.format("MCP v%s", mcpversion);
}
} }
+3 -2
View File
@@ -3,6 +3,7 @@ package cpw.mods.fml.common;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -59,7 +60,7 @@ public enum LoaderState
{ {
return eventClass != null; return eventClass != null;
} }
public FMLStateEvent getEvent(Object... eventData) public FMLStateEvent getEvent(Object... eventData)
{ {
try try
@@ -87,7 +88,7 @@ public enum LoaderState
AVAILABLE("Available"), AVAILABLE("Available"),
DISABLED("Disabled"), DISABLED("Disabled"),
ERRORED("Errored"); ERRORED("Errored");
private String label; private String label;
private ModState(String label) private ModState(String label)
@@ -0,0 +1,14 @@
package cpw.mods.fml.common;
import com.google.common.eventbus.EventBus;
public class MCPDummyContainer extends DummyModContainer {
public MCPDummyContainer(ModMetadata metadata) {
super(metadata);
}
@Override
public boolean registerBus(EventBus bus, LoadController controller) {
return true;
}
}
+67 -4
View File
@@ -18,7 +18,10 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import net.minecraft.src.ItemBlock; import net.minecraft.item.ItemBlock;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
/** /**
* The new mod style in FML 1.3 * The new mod style in FML 1.3
@@ -63,9 +66,60 @@ public @interface Mod
* An optional bukkit plugin that will be injected into the bukkit plugin framework if * An optional bukkit plugin that will be injected into the bukkit plugin framework if
* this mod is loaded into the FML framework and the bukkit coremod is present. * this mod is loaded into the FML framework and the bukkit coremod is present.
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields. * Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
* @return * @return The name of the plugin to load for this mod
*/ */
String bukkitPlugin() default ""; String bukkitPlugin() default "";
/**
* Mods that this mod will <strong>not</strong> load with.
* An optional comma separated string of (+|-)(*|modid[@value]) which specify mods that
* this mod will refuse to load with, resulting in the game failing to start.
* Entries can be prefixed with a + for a positive exclusion assertion, or - for a negative exclusion
* assertion. Asterisk is the wildcard and represents <strong>all</strong> mods.
*
* The <strong>only</strong> mods that cannot be excluded are FML and MCP, trivially.
* Other special values:
* <ul>
* <li>+f indicates that the mod will accept a minecraft forge environment.</li>
* <li>-* indicates that the mod will not accept any other mods.</li>
* </ul>
*
* Some examples:
* <ul>
* <li><em>-*,+f,+IronChest</em>: Will run only in a minecraft forge environment with the mod IronChests.
* The -* forces all mods to be excluded, then the +f and +IronChest add into the "allowed list".</li>
* <li><em>+f,-IC2</em>: Will run in a minecraft forge environment but will <strong>not</strong> run if
* IndustrialCraft 2 (IC2) is loaded alongside.</li>
* <li><em>-*</em>: Will not run if <strong>any</strong> othe mod is loaded except MCP/FML itself.</li>
* </ul>
*
* If a mod is present on the excluded list, the game will stop and show an error screen. If the
* class containing the {@link Mod} annotation has a "getCustomErrorException" method, it will be
* called to retrieve a custom error message for display in this case. If two mods have a declared
* exclusion which is matched, the screen that is shown is indeterminate.
*
* @return A string listing modids to exclude from loading with this mod.
*/
String modExclusionList() default "";
/**
* Specifying this field allows for a mod to expect a signed jar with a fingerprint matching this value.
* The fingerprint should be SHA-1 encoded, lowercase with ':' removed. An empty value indicates that
* the mod is not expecting to be signed.
*
* Any incorrectness of the fingerprint, be it missing or wrong, will result in the {@link FingerprintWarning}
* method firing <i>prior to any other event on the mod</i>.
*
* @return A certificate fingerprint that is expected for this mod.
*/
String certificateFingerprint() default "";
/**
* 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
@@ -99,7 +153,7 @@ public @interface Mod
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
public @interface ServerStarting {} public @interface ServerStarting {}
/** /**
* Mark the designated method as being called at the "post-initialization" phase * Mark the designated method as being called at the "server-started" phase
* @author cpw * @author cpw
* *
*/ */
@@ -107,13 +161,22 @@ public @interface Mod
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
public @interface ServerStarted {} public @interface ServerStarted {}
/** /**
* Mark the designated method as being called at the "post-initialization" phase * Mark the designated method as being called at the "server-stopping" phase
* @author cpw * @author cpw
* *
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
public @interface ServerStopping {} public @interface ServerStopping {}
/**
* Mark the designated method as the receiver for {@link FMLInterModComms} messages
* Called between {@link Init} and {@link PostInit}
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface IMCCallback {}
/** /**
* Populate the annotated field with the mod instance. * Populate the annotated field with the mod instance.
* @author cpw * @author cpw
@@ -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 {
}
@@ -145,6 +145,7 @@ public class AccessTransformer implements IClassTransformer
@Override @Override
public byte[] transform(String name, byte[] bytes) public byte[] transform(String name, byte[] bytes)
{ {
if (bytes == null) { return null; }
if (!modifiers.containsKey(name)) { return bytes; } if (!modifiers.containsKey(name)) { return bytes; }
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
@@ -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,10 +135,16 @@ public class MCPMerger
String line; String line;
while ((line = br.readLine()) != null) while ((line = br.readLine()) != null)
{ {
boolean toClient = line.charAt(0) == '<'; line = line.split("#")[0];
line = line.substring(1); char cmd = line.charAt(0);
if (toClient) copyToClient.add(line); line = line.substring(1).trim();
else copyToServer.add(line);
switch (cmd)
{
case '!': dontAnnotate.add(line); break;
case '<': copyToClient.add(line); break;
case '>': copyToServer.add(line); break;
}
} }
in.close(); in.close();
@@ -224,20 +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()})
@@ -288,7 +289,7 @@ public class MCPMerger
reader.accept(classNode, 0); reader.accept(classNode, 0);
if (!classNode.name.equals("bcs")) //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));
@@ -89,6 +89,7 @@ public class MarkerTransformer implements IClassTransformer
@Override @Override
public byte[] transform(String name, byte[] bytes) public byte[] transform(String name, byte[] bytes)
{ {
if (bytes == null) { return null; }
if (!markers.containsKey(name)) { return bytes; } if (!markers.containsKey(name)) { return bytes; }
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
@@ -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
{ {
@@ -23,6 +23,8 @@ public class SideTransformer implements IClassTransformer
@Override @Override
public byte[] transform(String name, byte[] bytes) public byte[] transform(String name, byte[] bytes)
{ {
if (bytes == null) { return null; }
ClassNode classNode = new ClassNode(); ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(bytes); ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0); classReader.accept(classNode, 0);
@@ -33,7 +35,7 @@ public class SideTransformer implements IClassTransformer
{ {
System.out.println(String.format("Attempted to load class %s for invalid side %s", classNode.name, SIDE)); System.out.println(String.format("Attempted to load class %s for invalid side %s", classNode.name, SIDE));
} }
return null; throw new RuntimeException(String.format("Attempted to load class %s for invalid side %s", classNode.name, SIDE));
} }
Iterator<FieldNode> fields = classNode.fields.iterator(); Iterator<FieldNode> fields = classNode.fields.iterator();
@@ -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())
{ {
@@ -1,9 +1,15 @@
package cpw.mods.fml.common.event; package cpw.mods.fml.common.event;
import cpw.mods.fml.common.ModContainer;
public class FMLEvent public class FMLEvent
{ {
public final String getEventType() public final String getEventType()
{ {
return getClass().getSimpleName(); return getClass().getSimpleName();
} }
public void applyModContainer(ModContainer activeContainer) {
// NO OP
}
} }
@@ -0,0 +1,25 @@
package cpw.mods.fml.common.event;
import java.io.File;
import java.util.List;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
public class FMLFingerprintViolationEvent extends FMLEvent {
public final boolean isDirectory;
public final Set<String> fingerprints;
public final File source;
public final String expectedFingerprint;
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint)
{
super();
this.isDirectory = isDirectory;
this.source = source;
this.fingerprints = fingerprints;
this.expectedFingerprint = expectedFingerprint;
}
}
@@ -0,0 +1,212 @@
package cpw.mods.fml.common.event;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimaps;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PostInit;
/**
* Simple intermod communications to receive simple messages directed at you
* from other mods
*
* @author cpw
*
*/
public class FMLInterModComms {
private static final ImmutableList<IMCMessage> emptyIMCList = ImmutableList.<IMCMessage>of();
private static ArrayListMultimap<String, IMCMessage> modMessages = ArrayListMultimap.create();
/**
* Subscribe to this event to receive your messages (they are sent between
* {@link Init} and {@link PostInit})
*
* @author cpw
*
*/
public static class IMCEvent extends FMLEvent {
@Override
public void applyModContainer(ModContainer activeContainer)
{
currentList = ImmutableList.copyOf(modMessages.removeAll(activeContainer.getModId()));
FMLLog.finest("Attempting to deliver %d IMC messages to mod %s", currentList.size(), activeContainer.getModId());
}
private ImmutableList<IMCMessage> currentList;
public ImmutableList<IMCMessage> getMessages()
{
return currentList;
}
}
/**
* You will receive an instance of this for each message sent
*
* @author cpw
*
*/
public static final class IMCMessage {
/**
* This is the modid of the mod that sent you the message
*/
private String sender;
/**
* This field, and {@link #value} are both at the mod's discretion
*/
public final String key;
/**
* This field, and {@link #key} are both at the mod's discretion
*/
private Object value;
private IMCMessage(String key, Object value)
{
this.key = key;
this.value = value;
}
@Override
public String toString()
{
return sender;
}
public String getSender()
{
return this.sender;
}
void setSender(ModContainer activeModContainer)
{
this.sender = activeModContainer.getModId();
}
public String getStringValue()
{
return (String) value;
}
public NBTTagCompound getNBTValue()
{
return (NBTTagCompound) value;
}
public ItemStack getItemStackValue()
{
return (ItemStack) value;
}
public Class<?> getMessageType()
{
return value.getClass();
}
public boolean isStringMessage()
{
return String.class.isAssignableFrom(getMessageType());
}
public boolean isItemStackMessage()
{
return ItemStack.class.isAssignableFrom(getMessageType());
}
public boolean isNBTMessage()
{
return NBTTagCompound.class.isAssignableFrom(getMessageType());
}
}
public static boolean sendMessage(String modId, String key, NBTTagCompound value)
{
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
public static boolean sendMessage(String modId, String key, ItemStack value)
{
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
public static boolean sendMessage(String modId, String key, String value)
{
return enqueueStartupMessage(modId, new IMCMessage(key, value));
}
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, NBTTagCompound value)
{
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
}
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, ItemStack value)
{
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
}
public static void sendRuntimeMessage(Object sourceMod, String modId, String key, String value)
{
enqueueMessage(sourceMod, modId, new IMCMessage(key, value));
}
private static boolean enqueueStartupMessage(String modTarget, IMCMessage message)
{
if (Loader.instance().activeModContainer() == null)
{
return false;
}
enqueueMessage(Loader.instance().activeModContainer(), modTarget, message);
return Loader.isModLoaded(modTarget) && !Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION);
}
private static void enqueueMessage(Object sourceMod, String modTarget, IMCMessage message)
{
ModContainer mc;
if (sourceMod instanceof ModContainer) {
mc = (ModContainer) sourceMod;
}
else
{
mc = FMLCommonHandler.instance().findContainerFor(sourceMod);
}
if (mc != null && Loader.isModLoaded(modTarget))
{
message.setSender(mc);
modMessages.put(modTarget, message);
}
}
/**
* Retrieve any pending runtime messages for the mod
* @param forMod The {@link Instance} of the Mod to fetch messages for
* @return any messages - the collection will never be null
*/
public static ImmutableList<IMCMessage> fetchRuntimeMessages(Object forMod)
{
ModContainer mc = FMLCommonHandler.instance().findContainerFor(forMod);
if (mc != null)
{
return ImmutableList.copyOf(modMessages.removeAll(mc));
}
else
{
return emptyIMCList;
}
}
}
@@ -1,8 +1,12 @@
package cpw.mods.fml.common.event; package cpw.mods.fml.common.event;
import java.io.File; import java.io.File;
import java.security.CodeSource;
import java.security.cert.Certificate;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Logger;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.FMLModContainer; import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
@@ -74,4 +78,41 @@ public class FMLPreInitializationEvent extends FMLStateEvent
return null; return null;
} }
/**
* Get a logger instance configured to write to the FML Log as a parent, identified by modid. Handy for mod logging!
*
* @return A logger
*/
public Logger getModLog()
{
Logger log = Logger.getLogger(modContainer.getModId());
log.setParent(FMLLog.getLogger());
return log;
}
/**
* Retrieve the FML signing certificates, if any. Validate these against the
* published FML certificates in your mod, if you wish.
*
* Deprecated because mods should <b>NOT</b> trust this code. Rather
* they should copy this, or something like this, into their own mods.
*
* @return Certificates used to sign FML and Forge
*/
@Deprecated
public Certificate[] getFMLSigningCertificates()
{
CodeSource codeSource = getClass().getClassLoader().getParent().getClass().getProtectionDomain().getCodeSource();
Certificate[] certs = codeSource.getCertificates();
if (certs == null)
{
return new Certificate[0];
}
else
{
return certs;
}
}
} }
@@ -1,8 +1,8 @@
package cpw.mods.fml.common.event; package cpw.mods.fml.common.event;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.src.CommandHandler;
import net.minecraft.src.ICommand;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
public class FMLServerStartingEvent extends FMLStateEvent public class FMLServerStartingEvent extends FMLStateEvent
@@ -2,8 +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.ModContainer; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.common.Side;
public abstract class FMLStateEvent extends FMLEvent public abstract class FMLStateEvent extends FMLEvent
{ {
@@ -14,11 +13,6 @@ public abstract class FMLStateEvent extends FMLEvent
public abstract ModState getModState(); public abstract ModState getModState();
public void applyModContainer(ModContainer activeContainer)
{
// NO OP
}
public Side getSide() public Side getSide()
{ {
return FMLCommonHandler.instance().getSide(); return FMLCommonHandler.instance().getSide();
@@ -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;
/** /**
* *
@@ -73,9 +70,6 @@ public interface BaseModProxy
public abstract void onItemPickup(EntityPlayer player, ItemStack item); public abstract void onItemPickup(EntityPlayer player, ItemStack item);
public abstract int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX,
double entY, double entZ);
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet); public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
public abstract void serverChat(NetServerHandler source, String message); public abstract void serverChat(NetServerHandler source, String message);
@@ -1,12 +1,12 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.EntitySpawnPacket; import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NetHandler;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
public interface IModLoaderSidedHelper public interface IModLoaderSidedHelper
{ {
@@ -1,8 +1,7 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.NetHandler; import net.minecraft.network.NetServerHandler;
import net.minecraft.src.NetServerHandler; import net.minecraft.network.packet.*;
import net.minecraft.src.Packet3Chat;
import cpw.mods.fml.common.network.IChatListener; import cpw.mods.fml.common.network.IChatListener;
public class ModLoaderChatListener implements IChatListener public class ModLoaderChatListener implements IChatListener
@@ -1,11 +1,11 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet1Login;
import cpw.mods.fml.common.network.IConnectionHandler; import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
@@ -39,7 +39,7 @@ public class ModLoaderConnectionHandler implements IConnectionHandler
@Override @Override
public void connectionClosed(INetworkManager manager) public void connectionClosed(INetworkManager manager)
{ {
if (!ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod)) if (ModLoaderHelper.sidedHelper==null || !ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
{ {
mod.serverDisconnect(); mod.serverDisconnect();
mod.onClientLogout(manager); mod.onClientLogout(manager);
@@ -1,8 +1,8 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.src.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler; import cpw.mods.fml.common.ICraftingHandler;
public class ModLoaderCraftingHelper implements ICraftingHandler public class ModLoaderCraftingHelper implements ICraftingHandler
@@ -2,8 +2,9 @@ package cpw.mods.fml.common.modloader;
import java.util.Random; import java.util.Random;
import net.minecraft.src.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.src.World; import net.minecraft.world.World;
import cpw.mods.fml.common.IDispenseHandler; import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.IDispenserHandler; import cpw.mods.fml.common.IDispenserHandler;
@@ -21,8 +22,7 @@ public class ModLoaderDispenseHelper implements IDispenserHandler
public int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, 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) double entZ)
{ {
int ret = mod.dispenseEntity(world, item, random, x, y, z, xVelocity, zVelocity, entX, entY, entZ); return -1;
return ret == 0 ? -1 : ret;
} }
} }
@@ -2,14 +2,14 @@ package cpw.mods.fml.common.modloader;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import net.minecraft.entity.Entity;
import com.google.common.base.Function; import com.google.common.base.Function;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.EntitySpawnPacket; import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraft.src.Entity;
public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity> public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity>
{ {
@@ -1,6 +1,6 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.IFuelHandler;
public class ModLoaderFuelHelper implements IFuelHandler public class ModLoaderFuelHelper implements IFuelHandler
@@ -1,21 +1,27 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.Container; import java.util.Set;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.IGuiHandler;
public class ModLoaderGuiHelper implements IGuiHandler public class ModLoaderGuiHelper implements IGuiHandler
{ {
private BaseModProxy mod; private BaseModProxy mod;
private int id; private Set<Integer> ids;
private Container container; private Container container;
private int currentID;
ModLoaderGuiHelper(BaseModProxy mod, int id) ModLoaderGuiHelper(BaseModProxy mod)
{ {
this.mod = mod; this.mod = mod;
this.id = id; this.ids = Sets.newHashSet();
} }
@Override @Override
@@ -30,9 +36,10 @@ public class ModLoaderGuiHelper implements IGuiHandler
return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z); return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
} }
public void injectContainer(Container container) public void injectContainerAndID(Container container, int ID)
{ {
this.container = container; this.container = container;
this.currentID = ID;
} }
public Object getMod() public Object getMod()
@@ -40,4 +47,9 @@ public class ModLoaderGuiHelper implements IGuiHandler
return mod; return mod;
} }
public void associateId(int additionalID)
{
this.ids.add(additionalID);
}
} }
@@ -20,18 +20,21 @@ import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ListMultimap; import com.google.common.collect.ListMultimap;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.SetMultimap;
import net.minecraft.command.ICommand;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.src.BaseMod; import net.minecraft.src.BaseMod;
import net.minecraft.src.Container;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityDragon;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IAnimals;
import net.minecraft.src.ICommand;
import net.minecraft.src.TradeEntry; import net.minecraft.src.TradeEntry;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ICraftingHandler; import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler; import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.IDispenserHandler; import cpw.mods.fml.common.IDispenserHandler;
@@ -59,11 +62,21 @@ public class ModLoaderHelper
{ {
public static IModLoaderSidedHelper sidedHelper; public static IModLoaderSidedHelper sidedHelper;
private static Map<Integer, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap(); private static Map<BaseModProxy, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap();
private static Map<Integer, ModLoaderGuiHelper> guiIDs = Maps.newHashMap();
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock) public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock)
{ {
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer(); ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod);
if (mlmc==null)
{
mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
}
if (mlmc == null)
{
FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod);
return;
}
BaseModTicker ticker = mlmc.getGameTickHandler(); BaseModTicker ticker = mlmc.getGameTickHandler();
EnumSet<TickType> ticks = ticker.ticks(); EnumSet<TickType> ticks = ticker.ticks();
// If we're enabled we get render ticks // If we're enabled we get render ticks
@@ -84,7 +97,16 @@ public class ModLoaderHelper
public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock) public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock)
{ {
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer(); ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod);
if (mlmc==null)
{
mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
}
if (mlmc == null)
{
FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod);
return;
}
EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks(); EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks();
// If we're enabled and we don't want clock ticks we get render ticks // If we're enabled and we don't want clock ticks we get render ticks
if (enable && !useClock) { if (enable && !useClock) {
@@ -142,15 +164,21 @@ public class ModLoaderHelper
public static void buildGuiHelper(BaseModProxy mod, int id) public static void buildGuiHelper(BaseModProxy mod, int id)
{ {
ModLoaderGuiHelper handler = new ModLoaderGuiHelper(mod, id); ModLoaderGuiHelper handler = guiHelpers.get(mod);
guiHelpers.put(id, handler); if (handler == null)
NetworkRegistry.instance().registerGuiHandler(mod, handler); {
handler = new ModLoaderGuiHelper(mod);
guiHelpers.put(mod,handler);
NetworkRegistry.instance().registerGuiHandler(mod, handler);
}
handler.associateId(id);
guiIDs.put(id, handler);
} }
public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z) public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z)
{ {
ModLoaderGuiHelper helper = guiHelpers.get(id); ModLoaderGuiHelper helper = guiIDs.get(id);
helper.injectContainer(container); helper.injectContainerAndID(container, id);
player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z); player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z);
} }
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.security.cert.Certificate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -28,7 +29,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import net.minecraft.src.ICommand; import net.minecraft.command.ICommand;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
@@ -48,7 +49,6 @@ import cpw.mods.fml.common.ModClassLoader;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModMetadata; import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ProxyInjector; import cpw.mods.fml.common.ProxyInjector;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ASMDataTable;
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData; import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
@@ -66,6 +66,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.common.versioning.ArtifactVersion; import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion; import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange; import cpw.mods.fml.common.versioning.VersionRange;
import cpw.mods.fml.relauncher.Side;
public class ModLoaderModContainer implements ModContainer public class ModLoaderModContainer implements ModContainer
{ {
@@ -616,4 +617,9 @@ public class ModLoaderModContainer implements ModContainer
{ {
return Loader.instance().getMinecraftModContainer().getStaticVersionRange(); return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
} }
@Override
public Certificate getSigningCertificate()
{
return null;
}
} }
@@ -1,9 +1,8 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.src.EntityPlayerMP; import net.minecraft.network.INetworkManager;
import net.minecraft.src.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.src.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
@@ -1,7 +1,7 @@
package cpw.mods.fml.common.modloader; package cpw.mods.fml.common.modloader;
import net.minecraft.src.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.src.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.IPickupNotifier; import cpw.mods.fml.common.IPickupNotifier;
public class ModLoaderPickupNotifier implements IPickupNotifier public class ModLoaderPickupNotifier implements IPickupNotifier
@@ -17,7 +17,7 @@ public class ModLoaderPickupNotifier implements IPickupNotifier
@Override @Override
public void notifyPickup(EntityItem item, EntityPlayer player) public void notifyPickup(EntityItem item, EntityPlayer player)
{ {
mod.onItemPickup(player, item.field_70294_a); mod.onItemPickup(player, item.func_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
{ {
Loaded 100 of 258 files, more files were not shown because too many files have changed in this diff. Show more