Compare commits

..
133 Commits
Author SHA1 Message Date
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 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
Christian e6f57e5d94 Update for MCP release 2012-10-20 18:02:26 -04:00
Christian b1de0fc17c Remove fuzz from patches for INetworkManager change 2012-10-20 17:16:50 -04:00
Christian ad4461932f Fix for new names INetworkManager and ITexturePack. I also provide refactoring scripts for both, for your use... 2012-10-20 17:07:59 -04:00
Christian 3a94211377 Add a script to ignore git complaining about the eclipse workspace changing - run when you first open the eclipse workspace 2012-10-20 15:24:05 -04:00
Christian 9386e23b1f Update gitignore - ignore the files that will change or be deleted 2012-10-20 15:14:06 -04:00
Christian 10b318c71d Add in "starter" image for eclipse workspace 2012-10-20 15:02:37 -04:00
Christian 995d5b7b3a Eclipse workspace fixup 2? 2012-10-20 14:42:25 -04:00
Christian bbb12c84fd Clean up eclipse workspace- part 1 2012-10-20 14:09:44 -04:00
Christian b50058ee47 Clean up a bit of patch fuzz 2012-10-20 12:39:40 -04:00
Christian 4a0bfa937a Fix CommonHandler for rename of the server thread class 2012-10-20 12:31:35 -04:00
Christian 4d1ec666dd Update with RC2 MCP. Use the joined.exc file directly since MCP now provides it. 2012-10-20 12:27:30 -04:00
Christian b52e3d0e7d Fix exception for CodecMus 2012-10-20 12:12:43 -04:00
Christian a1011c99a9 Fix some compilation issues. Requires resolving the worldclient abstract method 2012-10-20 11:30:01 -04:00
LexManos 0ebd4f3d94 Inital patch update to 1.4 2012-10-20 02:43:03 -07:00
LexManos 89c68c46a2 Moved into EntityVillager 2012-10-20 02:42:34 -07:00
LexManos e4702cb09d Fix line ending detection during checkout. 2012-10-20 02:32:29 -07:00
LexManos 6e64fd7a11 We don't need logging here... 2012-10-20 02:27:26 -07:00
LexManos 014b3f4ad5 remove useless -Server projects 2012-10-20 00:43:02 -07:00
LexManos 7628c67883 Updated the AT config and Marker config for 1.4 obf 2012-10-20 00:36:33 -07:00
LexManos 54a322c09f Updae build to copy files that may decompile differently but are actually the same, and updated for 1.4 values. 2012-10-20 00:06:55 -07:00
LexManos aadf396244 Update MCP Merge config. 2012-10-19 23:57:49 -07:00
LexManos 81e18552e3 Pull in MCP's 1.4 conf files. 2012-10-19 23:57:05 -07:00
LexManos 5686fd40a4 Fix error in merging of exec's 2012-10-19 21:14:03 -07:00
Christian 989ab3e96b Update build.xml - add a classpath to the manifest. This means the universal jar is now a server side launcher. 2012-10-18 21:07:33 -04:00
Christian 88f1dc97b6 Typos! 2012-10-18 21:00:58 -04:00
Christian 470a18522c Try and avoid an NPE in crash reports 2012-10-18 14:41:32 -04:00
Christian 002951804a Fix logging problems- log death messages and re-route the server through FML logs properly. 2012-10-17 18:05:23 -04:00
Christian fe7a832fad Fix the test mod 2012-10-16 13:24:29 -04:00
Christian a2bc30b356 Coremods can be specified via the command line: fml.coreMod.load=<listofcommaseparatedclasses> This will help with developing coremods 2012-10-16 13:21:10 -04:00
Christian bae1f74681 Fix classpath for server 2012-10-16 12:40:01 -04:00
Christian 887aa277a4 Add in the ability for a client to throw a custom exception that displays a custom gui instead of the default error message. 2012-10-16 12:39:04 -04:00
Christian e17f2677c7 Update FML internal classpath. Helpful for coremod devs 2012-10-16 09:47:06 -04:00
Christian 3b9972af39 Don't use File to separate the last element of the path. It's a URL, they're always separated by '/' 2012-10-16 09:46:08 -04:00
keepcalm 5c96afec70 Changed RelauchLibraryManager so that files with different paths on the
same baseURL can be implemented in one ILibrarySet.
2012-10-16 09:46:08 -04:00
Christian 1bca393ecb FML as a whole is now subject to transformers. 2012-10-16 09:20:30 -04:00
Christian 27cf731552 Bonus extra character. thanks randomitter! 2012-10-16 09:06:13 -04:00
cpw 94c84cd994 Merge pull request #116 from Vazkii/patch-1
Add Null check to FMLClientHandler.sendPacket
2012-10-07 10:45:22 -07:00
Vazkii c2d3195e76 Add Null check to FMLClientHandler.sendPacket 2012-10-05 17:36:52 +02:00
Christian d0e7c9e2ea Update patches *sigh* 2012-10-02 22:04:25 -04:00
Christian f3e1cac5a1 Add in a savehandler strategy for reading and writing data to the
world save. This service is only available to coremods via the
WorldAccessContainer interface on the mod wrapper. This is deliberate
and will not change.
2012-10-02 21:54:47 -04:00
Christian 51fb513213 Add in some bukkit supporting code. Most of this is unimplemented
until the bukkit coremod is complete.
2012-10-02 20:26:47 -04:00
Christian 65c9fdd8d7 New stuff on the ModLoader! Risu has been busy. Closes #114 2012-10-02 08:29:12 -04:00
Christian c1d4458acc Mods can now declare a range of minecraft versions they will run against 2012-10-02 01:29:46 -04:00
Christian ca1ca4f944 Fix maps supporting greater than byte() dimension sizing 2012-09-29 00:21:42 -04:00
Christian 15ee8bf5a1 Fix language registry additions, closes #113 2012-09-28 22:12:23 -04:00
cpw a08b5b19d5 Merge pull request #112 from pahimar/master
Additonal Language Registry functionality
2012-09-26 21:57:53 -07:00
pahimar 8dac58ffc1 Added ability to query the Language Registry by key and language for specific localized text, as well as loading in localization text from a specific file/URL 2012-09-26 15:41:58 -04:00
Christian f0837070d6 Extreme headless mode is back! 2012-09-25 22:46:47 -04:00
Christian dd7502a051 Fix parent child counts showing properly. Closes #107 thanks scott! 2012-09-25 19:00:36 -04:00
Christian b36d4471e6 It's useMetadata, not usesMetadata. thanks myrathi and psx. closes #110 2012-09-25 18:57:42 -04:00
Christian efb1066a88 Fix random shuffling when manipulating biomes by using a LinkedHashSet to preserve iteration order. Closes #111 2012-09-25 18:54:46 -04:00
Christian dd39ae540b Try and fix the newline capture so consoles show on the server on windows again 2012-09-24 17:22:39 -04:00
Christian b39f808618 Readd ancient searge name so dan200 and computercraft can run again. REMOVE THAT CODE DAN. 2012-09-24 17:22:16 -04:00
Christian a2c059e562 Fix missing import. Thanks ichun :( 2012-09-21 18:17:56 -04:00
Christian 19316a0d38 Version file searching should work for directories too 2012-09-21 17:39:52 -04:00
Christian fbc7a5c063 Fix bug causing NPE if non-whitelisted player joins an FML server without FML installed 2012-09-21 10:12:39 -04:00
cpw e9cfd10e39 Merge pull request #103 from iChun/patch-2
Fixed ModTextureAnimation not updating and not binding to correct image.
2012-09-19 05:12:04 -07:00
iChun 1424883773 Fixed ModTextureAnimation not updating and not binding to correct image. 2012-09-17 23:46:09 +08:00
Christian 6c746ec6d9 Tidy code 2012-09-16 21:44:11 -04:00
Christian aacbfeb66e Change version.properties search slightly, allow access to found file from the preinit event 2012-09-16 21:42:59 -04:00
Christian 1513b369d3 Add in the capability to read an internal version as <modid>.version from a file
in the zip call version.properties. Handy for autobuilding scripts.
2012-09-16 21:05:56 -04:00
Christian 35852a69fb Fix up reversed assignment for version fallback 2012-09-16 21:05:56 -04:00
LexManos 96537dc091 Fixup Item in hand rendering of textures > 16x 2012-09-15 18:24:27 -07:00
LexManos e88ddc56ca Make the exception print for headless servers if the Downloader cant initalize. 2012-09-15 18:06:59 -07:00
LexManos f24ff07b30 Remove a bunch of warning about javadoc, not a real fix, but no more warning. 2012-09-15 18:04:56 -07:00
LexManos 3420ea7a2d Update MCP Mapings 2012-09-15 17:09:45 -07:00
LexManos 87104f0e2d Makes GetModSrc check the common folder when attempting to extract source files 2012-09-15 17:09:34 -07:00
Christian 640446b868 Tie parent/child containers together again. Should close #96 2012-09-15 15:58:20 -04:00
Christian 2cf4917ded Village mating produces added villagers, and the egg should place
added villagers too. Closes #97.
2012-09-15 15:49:08 -04:00
Christian 6394ee8714 Clean up stale references to the Player stored in the NetworkRegistry,
closes #100
2012-09-15 15:36:26 -04:00
cpw 7299e05fe1 Merge pull request #99 from CovertJaguar/patch-1
More readable state event logs
2012-09-15 12:20:26 -07:00
CovertJaguar c4bd0405fd More readable init logs 2012-09-14 00:47:48 -07:00
Christian 89b8236a9c Fix onConnectionClosed not being called on the client side of a connection 2012-09-09 11:29:08 -04:00
221 changed files with 22211 additions and 17455 deletions

No files matched your search

+9 -1
View File
@@ -1 +1,9 @@
* text=auto
* text eol=lf
*.bat text eol=crlf
*.patch text eol=lf
*.png binary
*.exe binary
*.dll binary
*.zip binary
*.cfg text eol=lf
*.py text eol=lf
-2
View File
@@ -4,8 +4,6 @@
/fmlbuild.properties
/fmlversion.properties
/difflist.txt
/.metadata/
/eclipse/.metadata/
/target
fmlbranding.properties
/fernflower.zip
+29 -24
View File
@@ -93,16 +93,16 @@
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/reobfuscate.py" />
</exec>
<fail message="Reobfuscation failed">
<condition>
<not>
<and>
<available file="${mcp.home}/temp/client.md5"/>
<fail message="Reobfuscation failed">
<condition>
<not>
<and>
<available file="${mcp.home}/temp/client.md5"/>
<available file="${mcp.home}/temp/client_reobf.md5"/>
</and>
</not>
</condition>
</fail>
</and>
</not>
</condition>
</fail>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/generatechangedfilelist.py"/>
<arg value="${mcp.home}"/>
@@ -114,13 +114,13 @@
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/recompile.py" />
</exec>
<fail message="Compilation failed">
<condition>
<not>
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
</not>
</condition>
</fail>
<fail message="Compilation failed">
<condition>
<not>
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
</not>
</condition>
</fail>
</target>
<target name="merge-client" depends="buildenvsetup">
@@ -173,10 +173,13 @@
<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="${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="${common.src.dir}" includes="*.cfg" />
<mappedresources>
@@ -200,11 +203,13 @@
<target name="build-source-pack" depends="makeversion">
<property name="srcpack.jarname" value="${modname}-src-${version}" />
<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="${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="${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="${fml.conf.dir}" prefix="fml/conf" />
<mappedresources>
@@ -247,7 +252,7 @@
</condition>
<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>
<antcall target="fmldecompile"/>
<antcall target="fmldecompile"/>
<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">
<fileset dir="${patch.mcp.srcdir}"/>
@@ -329,15 +334,15 @@
<target name="checkpatches" depends="buildenvsetup">
<uptodate property="checkUptodate.uptodate">
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
<present targetdir="${patch.src.dir}">
<globmapper from="*.java" to="*.java.patch"/>
</present>
<present targetdir="${patch.src.dir}">
<globmapper from="*.java" to="*.java.patch"/>
</present>
</srcfiles>
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch"/>
</uptodate>
<fail unless="checkUptodate.uptodate">
A patch is out of date. Update your patches!
</fail>
<fail unless="checkUptodate.uptodate">
A patch is out of date. Update your patches!
</fail>
</target>
<target name="updatepatches" depends="buildenvsetup">
@@ -0,0 +1,43 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.IFMLHandledException;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.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
* the error screen through the methods below. This error will not be cleared, and will
* not allow the game to carry on, but might be useful if your mod wishes to report
* a fatal configuration error in a pretty way.
*
* Throw this through a proxy. It won't work on the dedicated server environment.
* @author cpw
*
*/
@SideOnly(Side.CLIENT)
public abstract class CustomModLoadingErrorDisplayException extends RuntimeException implements IFMLHandledException
{
/**
* Called after the GUI is inited by the parent code. You can do extra stuff here, maybe?
*
* @param errorScreen The error screen we're painting
* @param fontRenderer A font renderer for you
*/
public abstract void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer);
/**
* Draw your error to the screen.
*
* <br/><em>Warning: Minecraft is in a deep error state.</em> <strong>All</strong> it can do is stop.
* Do not try and do anything involving complex user interaction here.
*
* @param errorScreen The error screen to draw to
* @param fontRenderer A font renderer for you
* @param mouseRelX Mouse X
* @param mouseRelY Mouse Y
* @param tickTime tick time
*/
public abstract void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime);
}
@@ -37,12 +37,14 @@ import net.minecraft.src.World;
import net.minecraft.src.WorldClient;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.DuplicateModsFoundException;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.IFMLSidedHandler;
@@ -54,6 +56,7 @@ import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.ModMissingPacket;
@@ -66,8 +69,8 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Handles primary communication from hooked code into the system
*
* The FML entry point is {@link #beginMinecraftLoading(MinecraftServer)} called from
* {@link MinecraftServer}
* The FML entry point is {@link #beginMinecraftLoading(Minecraft)} called from
* {@link Minecraft}
*
* Obfuscated code should focus on this class and other members of the "server"
* (or "client") code
@@ -94,13 +97,6 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
private Minecraft client;
/**
* Called to start the whole game off from
* {@link MinecraftServer#startServer}
*
* @param minecraftServer
*/
private DummyModContainer optifineContainer;
private boolean guiLoaded;
@@ -111,6 +107,17 @@ public class FMLClientHandler implements IFMLSidedHandler
private boolean loading;
private WrongMinecraftVersionException wrongMC;
private CustomModLoadingErrorDisplayException customError;
private DuplicateModsFoundException dupesFound;
/**
* Called to start the whole game off
*
* @param minecraft The minecraft instance being launched
*/
public void beginMinecraftLoading(Minecraft minecraft)
{
if (minecraft.func_71355_q())
@@ -143,10 +150,23 @@ public class FMLClientHandler implements IFMLSidedHandler
{
Loader.instance().loadMods();
}
catch (WrongMinecraftVersionException wrong)
{
wrongMC = wrong;
}
catch (DuplicateModsFoundException dupes)
{
dupesFound = dupes;
}
catch (MissingModsException missing)
{
modsMissing = missing;
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
}
catch (LoaderException le)
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
@@ -168,7 +188,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@SuppressWarnings("deprecation")
public void finishMinecraftLoading()
{
if (modsMissing != null)
if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null)
{
return;
}
@@ -176,6 +196,12 @@ public class FMLClientHandler implements IFMLSidedHandler
{
Loader.instance().initializeMods();
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
return;
}
catch (LoaderException le)
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
@@ -190,10 +216,22 @@ public class FMLClientHandler implements IFMLSidedHandler
public void onInitializationComplete()
{
if (modsMissing != null)
if (wrongMC != null)
{
client.func_71373_a(new GuiWrongMinecraft(wrongMC));
}
else if (modsMissing != null)
{
client.func_71373_a(new GuiModsMissing(modsMissing));
}
else if (dupesFound != null)
{
client.func_71373_a(new GuiDupesFound(dupesFound));
}
else if (customError != null)
{
client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError));
}
else
{
TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
@@ -201,8 +239,6 @@ public class FMLClientHandler implements IFMLSidedHandler
}
/**
* Get the server instance
*
* @return
*/
public Minecraft getClient()
{
@@ -254,7 +290,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return Arrays.asList(String.format("Optifine %s",optifineContainer.getVersion()));
} else {
return Collections.emptyList();
return ImmutableList.<String>of();
}
}
@@ -308,7 +344,7 @@ public class FMLClientHandler implements IFMLSidedHandler
if (entity instanceof IThrowableEntity)
{
Entity thrower = client.field_71439_g.field_70157_k == packet.throwerId ? client.field_71439_g : wc.func_73024_a(packet.throwerId);
Entity thrower = client.field_71439_g.field_70157_k == packet.throwerId ? client.field_71439_g : wc.func_73045_a(packet.throwerId);
((IThrowableEntity)entity).setThrower(thrower);
}
@@ -352,7 +388,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void adjustEntityLocationOnClient(EntitySpawnAdjustmentPacket packet)
{
Entity ent = client.field_71441_e.func_73024_a(packet.entityId);
Entity ent = client.field_71441_e.func_73045_a(packet.entityId);
if (ent != null)
{
ent.field_70118_ct = packet.serverX;
@@ -386,7 +422,10 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void sendPacket(Packet packet)
{
client.field_71439_g.field_71174_a.func_72552_c(packet);
if(client.field_71439_g != null)
{
client.field_71439_g.field_71174_a.func_72552_c(packet);
}
}
@Override
@@ -397,7 +436,6 @@ public class FMLClientHandler implements IFMLSidedHandler
/**
* If the client is in the midst of loading, we disable saving so that custom settings aren't wiped out
* @return
*/
public boolean isLoading()
{
+2 -2
View File
@@ -20,7 +20,7 @@ import java.util.logging.Logger;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TextureFX;
import net.minecraft.src.TexturePackBase;
import net.minecraft.src.ITexturePack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
@@ -41,7 +41,7 @@ public class FMLTextureFX extends TextureFX implements ITextureFX
@Override public void setErrored(boolean err){ errored = err; }
@Override public boolean getErrored(){ return errored; }
@Override
public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions)
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
{
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
}
@@ -0,0 +1,26 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import net.minecraft.src.GuiErrorScreen;
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
{
private CustomModLoadingErrorDisplayException customException;
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException)
{
this.customException = customException;
}
@Override
public void func_73866_w_()
{
super.func_73866_w_();
this.customException.initGui(this, field_73886_k);
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
this.customException.drawScreen(this, field_73886_k, p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -0,0 +1,44 @@
package cpw.mods.fml.client;
import java.io.File;
import java.util.Map.Entry;
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;
import net.minecraft.src.GuiErrorScreen;
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);
}
}
}
+16 -7
View File
@@ -27,6 +27,8 @@ import net.minecraft.src.Tessellator;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Strings;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
@@ -44,7 +46,7 @@ public class GuiModList extends GuiScreen
private ArrayList<ModContainer> mods;
/**
* @param guiMainMenu
* @param mainMenu
*/
public GuiModList(GuiScreen mainMenu)
{
@@ -52,8 +54,19 @@ public class GuiModList extends GuiScreen
this.mods=new ArrayList<ModContainer>();
FMLClientHandler.instance().addSpecialModEntries(mods);
for (ModContainer mod : Loader.instance().getModList()) {
if (mod.getMetadata()!=null && mod.getMetadata().parentMod != null) {
continue;
if (mod.getMetadata()!=null && mod.getMetadata().parentMod==null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
String parentMod = mod.getMetadata().parent;
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
if (parentContainer != null)
{
mod.getMetadata().parentMod = parentContainer;
parentContainer.getMetadata().childMods.add(mod);
continue;
}
}
else if (mod.getMetadata()!=null && mod.getMetadata().parentMod!=null)
{
continue;
}
mods.add(mod);
}
@@ -166,10 +179,6 @@ public class GuiModList extends GuiScreen
}
}
/**
* @param var1
* @return
*/
public boolean modIndexSelected(int var1)
{
return var1==selected;
@@ -23,7 +23,7 @@ public class GuiModsMissing extends GuiErrorScreen
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
int offset = 85 - modsMissing.missingMods.size() * 10;
int offset = Math.max(85 - modsMissing.missingMods.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, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
@@ -35,7 +35,7 @@ public class GuiModsMissingForServer extends GuiScreen
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
int offset = 85 - modsMissing.getModList().size() * 10;
int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader could not connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
offset += 10;
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
@@ -0,0 +1,35 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import net.minecraft.src.GuiErrorScreen;
import net.minecraft.src.GuiScreen;
public class GuiWrongMinecraft extends GuiErrorScreen
{
private WrongMinecraftVersionException wrongMC;
public GuiWrongMinecraft(WrongMinecraftVersionException wrongMC)
{
this.wrongMC = wrongMC;
}
@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 = 75;
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, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=5;
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_73880_f / 2, offset, 0xEEEEEE);
offset+=20;
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
}
}
+2 -2
View File
@@ -17,11 +17,11 @@ package cpw.mods.fml.client;
import java.awt.Dimension;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TexturePackBase;
import net.minecraft.src.ITexturePack;
public interface ITextureFX
{
public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions);
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions);
public void onTextureDimensionsUpdate(int width, int height);
+14 -18
View File
@@ -34,7 +34,7 @@ public class SpriteHelper
SpriteHelper.toBitSet(
"0000000000000000" +
"0000000000110000" +
"0000000001100000" +
"0000000000100000" +
"0000000001100000" +
"0000000000000000" +
"0000000000000000" +
@@ -43,10 +43,10 @@ public class SpriteHelper
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000011111111" +
"0000000011111000" +
"0000000111111100" +
"0000000111111000" +
"0000000000011111" +
"0000000000000000" +
"0000000001111100" +
"0000000001111000" +
"0000000000000000");
spriteInfo.put("/terrain.png", slots);
@@ -57,15 +57,15 @@ public class SpriteHelper
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000001000000000" +
"0000001110000000" +
"0000001000000000" +
"1111101010000000" +
"1111101010000000" +
"1111101110000000" +
"1111111111110000" +
"1111111111111111" +
"1111111111111111" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0111100000000000" +
"1111100010000000" +
"0000101110000000" +
"0111000000000000" +
"1100001100001111" +
"0000000000001111" +
"0000000000000000");
spriteInfo.put("/gui/items.png", slots);
}
@@ -130,10 +130,6 @@ public class SpriteHelper
return next;
}
/**
* @param textureToOverride
* @return
*/
public static int freeSlotCount(String textureToOverride)
{
return spriteInfo.get(textureToOverride).cardinality();
@@ -22,7 +22,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.src.ModTextureStatic;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TextureFX;
import net.minecraft.src.TexturePackBase;
import net.minecraft.src.ITexturePack;
import org.lwjgl.opengl.GL11;
@@ -159,19 +159,15 @@ public class TextureFXManager
}
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
effect.func_76845_a(client.field_71446_o);
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
GL11.glBindTexture(GL_TEXTURE_2D, old);
effectTextures.put(effect, id);
effect.field_76848_d = id;
return id;
}
public void onTexturePackChange(RenderEngine engine, TexturePackBase texturepack, List<TextureFX> effects)
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
{
pruneOldTextureFX(texturepack, effects);
@@ -188,7 +184,7 @@ public class TextureFXManager
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
private TexturePackBase earlyTexturePack;
private ITexturePack earlyTexturePack;
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
{
Dimension dim = new Dimension(width, height);
@@ -213,9 +209,6 @@ public class TextureFXManager
return textureDims.get(id);
}
/**
* @param anim
*/
public void addAnimation(TextureFX anim)
{
OverrideInfo info=new OverrideInfo();
@@ -229,10 +222,7 @@ public class TextureFXManager
}
/**
* @param p_6531_1_
*/
public void loadTextures(TexturePackBase texturePack)
public void loadTextures(ITexturePack texturePack)
{
registerTextureOverrides(client.field_71446_o);
}
@@ -263,17 +253,11 @@ public class TextureFXManager
}
}
/**
* @param mod
*/
protected void registerAnimatedTexturesFor(ModContainer mod)
{
}
/**
* @param field_6539_c
*/
public void onEarlyTexturePackLoad(TexturePackBase fallback)
public void onEarlyTexturePackLoad(ITexturePack fallback)
{
if (client==null) {
// We're far too early- let's wait
@@ -284,7 +268,7 @@ public class TextureFXManager
}
public void pruneOldTextureFX(TexturePackBase var1, List<TextureFX> effects)
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
{
ListIterator<TextureFX> li = addedTextureFX.listIterator();
while (li.hasNext())
@@ -313,11 +297,6 @@ public class TextureFXManager
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
}
/**
* @param renderEngine
* @param path
* @return
*/
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
{
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
@@ -12,6 +12,9 @@ import net.minecraft.src.Entity;
import net.minecraft.src.EntityClientPlayerMP;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.KeyBinding;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetHandler;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.Render;
import net.minecraft.src.RenderManager;
@@ -23,6 +26,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
@@ -41,12 +45,6 @@ import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
public class ModLoaderClientHelper implements IModLoaderSidedHelper
{
/**
* @param mod
* @param inventoryRenderer
* @return
*/
public static int obtainBlockModelIdFor(BaseMod mod, boolean inventoryRenderer)
{
int renderId=RenderingRegistry.getNextAvailableRenderId();
@@ -156,4 +154,24 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
{
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
}
private Map<INetworkManager,NetHandler> managerLookups = new MapMaker().weakKeys().weakValues().makeMap();
@Override
public void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod)
{
managerLookups.put(manager, netClientHandler);
((BaseMod)mod).clientConnect((NetClientHandler)netClientHandler);
}
@Override
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
{
if (managerLookups.containsKey(manager))
{
((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
return true;
}
return false;
}
}
@@ -40,9 +40,6 @@ public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
private boolean[] mlRepeats = new boolean[0];
private boolean[] armed = new boolean[0];
/**
* @param keyHandler
*/
public ModLoaderKeyBindingHandler()
{
super(new KeyBinding[0], new boolean[0]);
@@ -129,7 +129,7 @@ public class KeyBindingRegistry
* Called when the key is first in the down position on any tick from the {@link #ticks()}
* set. Will be called subsequently with isRepeat set to true
*
* @see #keyUp(EnumSet, boolean)
* @see #keyUp(EnumSet, KeyBinding, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
@@ -139,7 +139,7 @@ public class KeyBindingRegistry
/**
* Fired once when the key changes state from down to up
*
* @see #keyDown(EnumSet, boolean, boolean)
* @see #keyDown(EnumSet, KeyBinding, boolean, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
@@ -7,6 +7,7 @@ import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.Render;
import net.minecraft.src.RenderBiped;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderManager;
import net.minecraft.src.RenderPlayer;
@@ -26,7 +27,7 @@ public class RenderingRegistry
{
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private int nextRenderId = 32;
private int nextRenderId = 36;
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
@@ -36,11 +37,11 @@ public class RenderingRegistry
* Add a new armour prefix to the RenderPlayer
*
* @param armor
* @return
*/
public static int addNewArmourRendererPrefix(String 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;
}
@@ -80,8 +81,6 @@ public class RenderingRegistry
}
/**
* Get the next available renderId from the block render ID list
*
* @return
*/
public static int getNextAvailableRenderId()
{
@@ -93,7 +92,6 @@ public class RenderingRegistry
*
* @param fileToOverride
* @param fileToAdd
* @return
*/
public static int addTextureOverride(String fileToOverride, String fileToAdd)
{
@@ -118,7 +116,6 @@ public class RenderingRegistry
* Get and reserve a unique texture index for the supplied path
*
* @param path
* @return
*/
public static int getUniqueTextureIndex(String path)
{
@@ -141,16 +138,6 @@ public class RenderingRegistry
private Render renderer;
}
/**
* @param renderer
* @param world
* @param x
* @param y
* @param z
* @param block
* @param modelId
* @return
*/
public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
{
if (!blockRenderers.containsKey(modelId)) { return false; }
@@ -158,12 +145,6 @@ public class RenderingRegistry
return bri.renderWorldBlock(world, x, y, z, block, modelId, renderer);
}
/**
* @param renderer
* @param block
* @param metadata
* @param modelID
*/
public void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
{
if (!blockRenderers.containsKey(modelID)) { return; }
@@ -171,10 +152,6 @@ public class RenderingRegistry
bri.renderInventoryBlock(block, metadata, modelID, renderer);
}
/**
* @param p_1219_0_
* @return
*/
public boolean renderItemAsFull3DBlock(int modelId)
{
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelId);
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

+24 -59
View File
@@ -51,23 +51,12 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
return true;
}
/**
* @param minecraftInstance
* @return
*//*
*//**
* @param renderers
*//*
/*
public final void onRenderHarvest(Map renderers)
{
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
}
*//**
*
*//*
public final void onRegisterAnimations()
{
registerAnimation(FMLClientHandler.instance().getClient());
@@ -156,22 +145,19 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
}
}
*//**
* NO-OP on client side
*//*
@Override
public final boolean handleCommand(String command, Object... data)
{
return false;
}
*/ // BASEMOD API
*/
// BASEMOD API
/**
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
*
* @param id
* @param metadata
* @return
*/
public int addFuel(int id, int metadata)
{
@@ -183,24 +169,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
* @return
*/
@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
*
@@ -232,7 +200,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
* @param x
* @param y
* @param z
* @return
*/
@SideOnly(CLIENT)
public GuiContainer getContainerGUI(EntityClientPlayerMP player, int containerID, int x, int y, int z)
@@ -242,8 +209,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Return the name of your mod. Defaults to the class name
*
* @return
*/
public String getName()
{
@@ -252,8 +217,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Get your mod priorities
*
* @return
*/
public String getPriorities()
{
@@ -262,8 +225,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Return the version of your mod
*
* @return
*/
public abstract String getVersion();
@@ -321,16 +282,34 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Only implemented on the client side
* {@link #serverChat(EntityPlayer, Packet3Chat)}
* {@link #serverChat(NetServerHandler, String)}
*
* @param text
*/
@Override
public void clientChat(String text)
{
// TODO
}
/**
* Called when a client connects
* @param handler
*/
@SideOnly(CLIENT)
public void clientConnect(NetClientHandler handler)
{
}
/**
* Called when the client disconnects
* @param handler
*/
@SideOnly(CLIENT)
public void clientDisconnect(NetClientHandler handler)
{
}
/**
* Called client side to receive a custom payload for this mod
*
@@ -339,7 +318,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
@Override
public void receiveCustomPacket(Packet250CustomPayload packet)
{
// TODO
}
@SideOnly(CLIENT)
@@ -408,10 +386,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Called when a chat message is received. Return true to stop further processing
*
* @param source
* @param chat
* @return true if you want to consume the message so it is not available for further processing
*/
@Override
public void serverChat(NetServerHandler source, String message)
@@ -429,24 +403,15 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Called when a client logs out of the server.
*
* @param player
*/
@Override
public void onClientLogout(NetworkManager mgr)
public void onClientLogout(INetworkManager mgr)
{
}
/**
*
* Spawn the entity of the supplied type, if it is your mod's
* @param entityId
* @param world
* @param scaledX
* @param scaledY
* @param scaledZ
* @return
*/
@SideOnly(CLIENT)
public Entity spawnEntity(int entityId, World world, double scaledX, double scaledY, double scaledZ)
@@ -67,7 +67,7 @@ public class FMLRenderAccessLibrary
return TextureFXManager.instance().getTextureDimensions(textureFX);
}
public static void onTexturePackChange(RenderEngine engine, TexturePackBase texturePack, List<TextureFX> textureFXList)
public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
{
TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
}
+69 -52
View File
@@ -45,22 +45,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.server.FMLServerHandler;
/**
* @author cpw
*
*/
public class ModLoader
{
public static final String fmlMarker = "This is an FML marker";
// TODO dirty workaround for millinaire
@Deprecated
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
/**
* Not used on the server.
* Adds localization info for an achievement, Not used on the server.
*
* @param achievement
* @param name
* @param description
* @param achievement The achievement to name
* @param name The name
* @param description The description
*/
public static void addAchievementDesc(Achievement achievement, String name, String description)
{
@@ -72,11 +69,11 @@ public class ModLoader
/**
* This method is a call in hook from modified external code. Implemented elsewhere.
*
* {@link FMLCommonHandler#fuelLookup(int, int)}
* {@link GameRegistry#getFuelValue(ItemStack)}
*
* @param id
* @param metadata
* @return
* @param id The Item ID
* @param metadata The Item Metadata
* @return The fuel strength, in ticks, 0 if unhandled
*/
@Deprecated
public static int addAllFuel(int id, int metadata)
@@ -97,9 +94,12 @@ public class ModLoader
}
/**
* Adds a new prefix to the armor texture list
*
* @param armor
* @return
* {@link RenderingRegistry#addNewArmourRendererPrefix(String)}
*
* @param armor The new armor prefix
* @return The new armor index
*/
@SideOnly(CLIENT)
public static int addArmor(String armor)
@@ -110,7 +110,7 @@ public class ModLoader
/**
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
*
* @param biome
* @param biome The biome to add
*/
public static void addBiome(BiomeGenBase biome)
{
@@ -126,11 +126,22 @@ public class ModLoader
{
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
*
* @param key
* @param value
* @param key Key
* @param value Value
*/
public static void addLocalization(String key, String value)
{
@@ -140,9 +151,9 @@ public class ModLoader
/**
* Add localization for the specified string
*
* @param key
* @param lang
* @param value
* @param key Key
* @param lang Language identifier
* @param value Value
*/
public static void addLocalization(String key, String lang, String value)
{
@@ -152,8 +163,8 @@ public class ModLoader
/**
* Name the specified minecraft object with the supplied name
*
* @param instance
* @param name
* @param instance Item to name
* @param name The name to give it
*/
public static void addName(Object instance, String name)
{
@@ -163,9 +174,9 @@ public class ModLoader
/**
* Unimplemented on the server as it does not generate names
*
* @param instance
* @param lang
* @param name
* @param instance Item to name
* @param lang Languge identifier
* @param name Name to give it
*/
public static void addName(Object instance, String lang, String name)
{
@@ -173,11 +184,18 @@ public class ModLoader
}
/**
* Attempts to register a small image to be applied to a larger texture image,
* typically how old ModLoader mods add custom Item/Block textures.
*
* Forge mods should use setTextureFile in Item/Block
*
* Will return the icon index it was applied to.
*
* Unimplemented on the server as it does not render textures
*
* @param fileToOverride
* @param fileToAdd
* @return
* @param fileToOverride The texture to apply the new image to
* @param fileToAdd The new image
* @return The 'icon index' in the main image that the new image will be applied to
*/
@SideOnly(CLIENT)
public static int addOverride(String fileToOverride, String fileToAdd)
@@ -186,11 +204,16 @@ public class ModLoader
}
/**
* Attempts to register a small image to be applied to a larger texture image,
* typically how old ModLoader mods add custom Item/Block textures.
*
* Forge mods should use setTextureFile in Item/Block
*
* Unimplemented on the server as it does not render textures
*
* @param path
* @param overlayPath
* @param index
* @param path The texture to apply the new image to
* @param overlayPath The new image
* @param index Where on the texture to apply it
*/
@SideOnly(CLIENT)
public static void addOverride(String path, String overlayPath, int index)
@@ -201,8 +224,8 @@ public class ModLoader
/**
* Add a Shaped Recipe
*
* @param output
* @param params
* @param output The result
* @param params The input
*/
public static void addRecipe(ItemStack output, Object... params)
{
@@ -212,8 +235,8 @@ public class ModLoader
/**
* Add a shapeless recipe
*
* @param output
* @param params
* @param output The result
* @param params The input
*/
public static void addShapelessRecipe(ItemStack output, Object... params)
{
@@ -322,7 +345,7 @@ public class ModLoader
* @param xVel
* @param zVel
* @param item
* @return
* @return Always false, not implemented here
*/
@Deprecated
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
@@ -392,7 +415,7 @@ public class ModLoader
* Get a list of all BaseMod loaded into the system
* {@link ModLoaderModContainer#findAll}
*
* @return
* @return A list containing all loaded ModLoader mods
*/
public static List<BaseMod> getLoadedMods()
{
@@ -402,7 +425,7 @@ public class ModLoader
/**
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
*
* @return
* @return The current logger
*/
public static Logger getLogger()
{
@@ -415,10 +438,6 @@ public class ModLoader
return FMLClientHandler.instance().getClient();
}
/**
*
* @return
*/
public static MinecraftServer getMinecraftServerInstance()
{
return FMLCommonHandler.instance().getMinecraftServerInstance();
@@ -431,7 +450,7 @@ public class ModLoader
* @param instanceclass
* @param instance
* @param fieldindex
* @return
* @return The value in the specified field.
*/
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
{
@@ -440,12 +459,12 @@ public class ModLoader
/**
* Get a value from a field using reflection
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String)}
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String[])}
*
* @param instanceclass
* @param instance
* @param field
* @return
* @return The value in the specified field.
*/
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
{
@@ -464,9 +483,9 @@ public class ModLoader
/**
* Get a new unique entity id
* {@link Entity#getNextId()}
* {@link EntityRegistry#findGlobalUniqueEntityId()}
*
* @return
* @return A unique entity ID
*/
public static int getUniqueEntityId()
{
@@ -485,7 +504,7 @@ public class ModLoader
*
* @param player
* @param channel
* @return
* @return If the channel is registered to the current connection.
*/
public static boolean isChannelActive(EntityPlayer player, String channel)
{
@@ -503,7 +522,7 @@ public class ModLoader
* {@link Loader#isModLoaded(String)}
*
* @param modname
* @return
* @return If the specified mod is loaded
*/
public static boolean isModLoaded(String modname)
{
@@ -555,7 +574,6 @@ public class ModLoader
/**
* This method is a call in hook from modified external code. Implemented elsewhere.
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
*
* @param packet
*/
@@ -636,7 +654,7 @@ public class ModLoader
/**
* Register the mod for packets on this channel.
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
* {@link NetworkRegistry#registerChannel(IPacketHandler, String)}
*
* @param mod
* @param channel
@@ -759,7 +777,6 @@ public class ModLoader
}
/**
* Send a chat message to the server
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
*
* @param text
*/
@@ -18,11 +18,13 @@ import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.FMLTextureFX;
/**
* A texture override for animations, it takes a vertical image of
* A texture override for animations, it takes a vertical image of
* texture frames and constantly rotates them in the texture.
*/
public class ModTextureAnimation extends FMLTextureFX
@@ -31,45 +33,45 @@ public class ModTextureAnimation extends FMLTextureFX
private byte[][] images;
private int index = 0;
private int ticks = 0;
private String targetTex = null;
private BufferedImage imgData = null;
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
{
this(icon, 1, target, image, tickCount);
}
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
{
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
}
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
{
super(icon);
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
targetTex = target;
field_76849_e = size;
field_76847_f = re.func_78341_b(target);
tickRate = tickCount;
ticks = tickCount;
imgData = image;
}
@Override
public void setup()
{
super.setup();
int sWidth = imgData.getWidth();
int sHeight = imgData.getHeight();
int tWidth = tileSizeBase;
int tHeight = tileSizeBase;
int frames = (int)Math.floor((double)(sHeight / sWidth));
if (frames < 1)
@@ -80,7 +82,7 @@ public class ModTextureAnimation extends FMLTextureFX
{
images = new byte[frames][];
BufferedImage image = imgData;
if (sWidth != tWidth)
{
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
@@ -107,8 +109,8 @@ public class ModTextureAnimation extends FMLTextureFX
}
}
}
public void func_783_a()
public void func_76846_a()
{
if (++ticks >= tickRate)
{
@@ -121,4 +123,17 @@ public class ModTextureAnimation extends FMLTextureFX
ticks = 0;
}
}
public void func_76845_a(RenderEngine renderEngine)
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
}
// TODO: REMOVE THIS - just for you dan200
@Deprecated
public void func_783_a()
{
func_76846_a();
}
}
@@ -32,7 +32,7 @@ public class ModTextureStatic extends FMLTextureFX
private String targetTex = null;
private int storedSize;
private BufferedImage overrideData = null;
private int needApply = 2;
private int needApply = 10;
public ModTextureStatic(int icon, int target, BufferedImage image)
@@ -106,7 +106,7 @@ public class ModTextureStatic extends FMLTextureFX
public void update()
{
needApply = 2;
needApply = 10;
for (int idx = 0; idx < pixels.length; idx++)
{
int i = idx * 4;
+43 -17
View File
@@ -19,7 +19,7 @@
def creatergcfg(self, reobf=False, keep_lvt=False, keep_generics=False, rg_update=False):
"""Create the files necessary for RetroGuard"""
@@ -781,7 +786,8 @@
@@ -781,13 +786,16 @@
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
@@ -29,7 +29,15 @@
return True
def checkbins(self, side):
@@ -1029,6 +1035,10 @@
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
+ if side == SERVER:
+ return self.checkbins(CLIENT)
if not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
return False
return True
@@ -1029,6 +1037,10 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
@@ -40,7 +48,7 @@
if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side])
@@ -1041,6 +1051,7 @@
@@ -1041,6 +1053,7 @@
all_files = True
append_pattern = False
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
@@ -48,16 +56,16 @@
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 @@
@@ -1062,7 +1075,7 @@
raise
def startserver(self):
- classpath = [self.binserver] + self.cpathserver
+ classpath = [self.binserver, self.srcshared] + self.cpathserver
+ classpath = [self.binclient, self.srcshared] + self.cpathserver
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars)
@@ -1070,7 +1081,7 @@
@@ -1070,7 +1083,7 @@
self.runmc(forkcmd)
def startclient(self):
@@ -66,7 +74,7 @@
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
natives = os.path.join('..', self.dirnatives)
@@ -1197,20 +1208,20 @@
@@ -1197,20 +1210,20 @@
with open(self.csvmethods, 'rb') as fh:
methodsreader = csv.DictReader(fh)
for row in methodsreader:
@@ -90,7 +98,7 @@
names['params'][row['param']] = row['name']
regexps = {
@@ -1240,6 +1251,11 @@
@@ -1240,6 +1253,11 @@
# HINT: We pathwalk the sources
for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
@@ -102,7 +110,7 @@
for cur_file in fnmatch.filter(filelist, '*.java'):
updatefile(os.path.normpath(os.path.join(path, cur_file)))
return True
@@ -1322,12 +1338,14 @@
@@ -1322,12 +1340,14 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
strip_comments(pathsrclk[side])
@@ -117,7 +125,7 @@
def process_javadoc(self, side):
"""Add CSV descriptions to methods and fields as javadoc"""
@@ -1336,6 +1354,21 @@
@@ -1336,6 +1356,21 @@
if not self.has_doc_csv:
self.logger.warning('!! javadoc disabled due to no csvs !!')
return False
@@ -139,7 +147,7 @@
#HINT: We read the relevant CSVs
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
@@ -1344,13 +1377,13 @@
@@ -1344,13 +1379,13 @@
methods = {}
for row in methodsreader:
#HINT: Only include methods that have a non-empty description
@@ -155,7 +163,7 @@
fields[row['searge']] = row['desc'].replace('*/', '* /')
regexps = {
@@ -1422,12 +1455,13 @@
@@ -1422,12 +1457,13 @@
# HINT: We create the list of source directories based on the list of packages
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=True)
@@ -170,7 +178,7 @@
if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else:
@@ -1442,6 +1476,9 @@
@@ -1442,6 +1478,9 @@
class_path = ''
else:
class_path += '/'
@@ -180,7 +188,7 @@
for class_file in fnmatch.filter(filelist, '*.class'):
class_name = class_path + os.path.splitext(class_file)[0]
bin_file = os.path.normpath(os.path.join(path, class_file))
@@ -1594,6 +1631,9 @@
@@ -1594,6 +1633,9 @@
sys.exit(1)
for entry in newfiles:
@@ -190,7 +198,7 @@
if entry[3] == 'U':
self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0])
@@ -1614,6 +1654,9 @@
@@ -1614,6 +1656,9 @@
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
@@ -200,10 +208,28 @@
# HINT: We need a table for the old md5 and the new ones
md5table = {}
@@ -1656,3 +1699,6 @@
@@ -1646,6 +1691,7 @@
# HINT: We extract the source files for the modified class files
for in_class in trgclasses:
src_file = os.path.normpath(os.path.join(src[side], in_class + '.java'))
+ cmn_file = os.path.normpath(os.path.join(self.srcshared, in_class + '.java'))
dest_file = os.path.normpath(os.path.join(outpathlk[side], in_class + '.java'))
if os.path.isfile(src_file):
if not os.path.exists(os.path.dirname(dest_file)):
@@ -1655,4 +1701,15 @@
self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
except IOError:
self.logger.error('* File %s copy failed', in_class)
-
+ elif os.path.isfile(cmn_file):
+ if not os.path.exists(os.path.dirname(dest_file)):
+ os.makedirs(os.path.dirname(dest_file))
+ try:
+ shutil.copyfile(cmn_file, dest_file)
+ self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
+ except IOError:
+ self.logger.error('* File %s copy failed', in_class)
+
+def commands_sanity_check():
+ print 'Commands patch applied successfully'
+
@@ -0,0 +1,29 @@
package cpw.mods.fml.common;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Declare a variable to be populated by a Bukkit Plugin proxy instance if the bukkit coremod
* is available. It can only be applied to field typed as {@link BukkitProxy}
* Generally it should be used in conjunction with {@link Mod#bukkitPlugin()} specifying the
* plugin to load.
*
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface BukkitPluginRef
{
/**
* A reference (possibly version specific) to a Bukkit Plugin by name, using the name@versionbound
* 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
* reflectively calling the "getModProxy" method on the bukkit plugin instance.
* @return The name of the plugin which we will inject into this field
*/
String value();
}
@@ -0,0 +1,12 @@
package cpw.mods.fml.common;
/**
* A marker interface for retrieving a proxy to a bukkit plugin.
* Fields associated with {@link BukkitPluginRef} annotations should be should probably
* declare this type and cast down if the target is available (not null)
* @author cpw
*
*/
public interface BukkitProxy
{
}
@@ -9,6 +9,7 @@ import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
public class DummyModContainer implements ModContainer
{
@@ -132,4 +133,9 @@ public class DummyModContainer implements ModContainer
{
return md.version;
}
@Override
public VersionRange acceptableMinecraftVersionRange()
{
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
}
}
@@ -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;
}
}
@@ -15,28 +15,36 @@ package cpw.mods.fml.common;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.Set;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.CrashReport;
import net.minecraft.src.CrashReportCategory;
import net.minecraft.src.DedicatedServer;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.NBTBase;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet131MapData;
import net.minecraft.src.SaveHandler;
import net.minecraft.src.ServerListenThread;
import net.minecraft.src.ThreadServerApplication;
import net.minecraft.src.ThreadMinecraftServer;
import net.minecraft.src.World;
import net.minecraft.src.WorldInfo;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
@@ -75,6 +83,8 @@ public class FMLCommonHandler
private boolean noForge;
private List<String> brandings;
private List<ICrashCallable> crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation());
private Set<SaveHandler> handlerSet = Sets.newSetFromMap(new MapMaker().weakKeys().<SaveHandler,Boolean>makeMap());
public void beginLoading(IFMLSidedHandler handler)
@@ -138,7 +148,6 @@ public class FMLCommonHandler
/**
* Find the container that associates with the supplied mod object
* @param mod
* @return
*/
public ModContainer findContainerFor(Object mod)
{
@@ -146,23 +155,13 @@ public class FMLCommonHandler
}
/**
* 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()
{
return FMLLog.getLogger();
}
/**
* @param key
* @param lang
* @param value
*/
/**
* @param languagePack
* @param lang
*/
public Side getSide()
{
return sidedDelegate.getSide();
@@ -172,13 +171,11 @@ public class FMLCommonHandler
* Return the effective side for the context in the game. This is dependent
* on thread analysis to try and determine whether the code is running in the
* server or not. Use at your own risk
*
* @return
*/
public Side getEffectiveSide()
{
Thread thr = Thread.currentThread();
if ((thr instanceof ThreadServerApplication) || (thr instanceof ServerListenThread))
if ((thr instanceof ThreadMinecraftServer) || (thr instanceof ServerListenThread))
{
return Side.SERVER;
}
@@ -187,10 +184,6 @@ public class FMLCommonHandler
}
/**
* Raise an exception
*
* @param exception
* @param message
* @param stopGame
*/
public void raiseException(Throwable exception, String message, boolean stopGame)
{
@@ -229,23 +222,24 @@ public class FMLCommonHandler
return null;
}
}
/**
* @param string
* @return
*/
public void computeBranding()
{
if (brandings == null)
{
Builder brd = ImmutableList.<String>builder();
brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getMCPVersionString());
brd.add("FML v"+Loader.instance().getFMLVersionString());
String forgeBranding = (String) callForgeMethod("getBrandingVersion");
if (!Strings.isNullOrEmpty(forgeBranding))
{
brd.add(forgeBranding);
}
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
if (sidedDelegate!=null)
{
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
}
try {
Properties props=new Properties();
props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
@@ -268,9 +262,6 @@ public class FMLCommonHandler
return ImmutableList.copyOf(brandings);
}
/**
* @return
*/
public IFMLSidedHandler getSidedDelegate()
{
return sidedDelegate;
@@ -396,11 +387,11 @@ public class FMLCommonHandler
crashCallables.add(callable);
}
public void enhanceCrashReport(CrashReport crashReport)
public void enhanceCrashReport(CrashReport crashReport, CrashReportCategory category)
{
for (ICrashCallable call: crashCallables)
{
crashReport.func_71500_a(call.getLabel(), call);
category.func_71500_a(call.getLabel(), call);
}
}
@@ -408,4 +399,46 @@ public class FMLCommonHandler
{
sidedDelegate.handleTinyPacket(handler, mapData);
}
public void handleWorldDataSave(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)
{
for (ModContainer mc : Loader.instance().getModList())
{
if (mc instanceof InjectedModContainer)
{
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
if (wac != null)
{
NBTTagCompound dataForWriting = wac.getDataForWriting(handler, worldInfo);
tagCompound.func_74766_a(mc.getModId(), dataForWriting);
}
}
}
}
public void handleWorldDataLoad(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)
{
if (getEffectiveSide()!=Side.SERVER)
{
return;
}
if (handlerSet.contains(handler))
{
return;
}
handlerSet.add(handler);
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
worldInfo.setAdditionalProperties(additionalProperties);
for (ModContainer mc : Loader.instance().getModList())
{
if (mc instanceof InjectedModContainer)
{
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
if (wac != null)
{
wac.readData(handler, worldInfo, additionalProperties, tagCompound.func_74775_l(mc.getModId()));
}
}
}
}
}
@@ -15,14 +15,26 @@
package cpw.mods.fml.common;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import net.minecraft.src.NBTBase;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
import net.minecraft.src.NBTTagString;
import net.minecraft.src.SaveHandler;
import net.minecraft.src.WorldInfo;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus;
/**
* @author cpw
*
*/
public class FMLDummyContainer extends DummyModContainer
public class FMLDummyContainer extends DummyModContainer implements WorldAccessContainer
{
public FMLDummyContainer()
{
@@ -49,4 +61,45 @@ public class FMLDummyContainer extends DummyModContainer
{
return true;
}
@Override
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
{
NBTTagCompound fmlData = new NBTTagCompound();
NBTTagList list = new NBTTagList();
for (ModContainer mc : Loader.instance().getActiveModList())
{
NBTTagCompound mod = new NBTTagCompound();
mod.func_74778_a("ModId", mc.getModId());
mod.func_74778_a("ModVersion", mc.getVersion());
list.func_74742_a(mod);
}
fmlData.func_74782_a("ModList", list);
return fmlData;
}
@Override
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
{
if (tag.func_74764_b("ModList"))
{
NBTTagList modList = tag.func_74761_m("ModList");
for (int i = 0; i < modList.func_74745_c(); i++)
{
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
String modId = mod.func_74779_i("ModId");
String modVersion = mod.func_74779_i("ModVersion");
ModContainer container = Loader.instance().getIndexedModList().get(modId);
if (container == null)
{
FMLLog.severe("This world was saved with mod %s which appears to be missing, things may not work well", modId);
continue;
}
if (!modVersion.equals(container.getVersion()))
{
FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
}
}
}
}
}
@@ -13,6 +13,7 @@
package cpw.mods.fml.common;
import java.io.File;
import java.io.FileInputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -20,8 +21,12 @@ import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import com.google.common.base.Function;
import com.google.common.base.Strings;
@@ -41,7 +46,9 @@ import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.discovery.ASMDataTable;
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
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.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
@@ -51,6 +58,8 @@ import cpw.mods.fml.common.event.FMLStateEvent;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
import cpw.mods.fml.common.versioning.VersionRange;
public class FMLModContainer implements ModContainer
{
@@ -69,16 +78,18 @@ public class FMLModContainer implements ModContainer
private DefaultArtifactVersion processedVersion;
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(FMLInitializationEvent.class, Mod.Init.class)
.put(FMLPostInitializationEvent.class, Mod.PostInit.class)
.put(FMLServerStartingEvent.class, Mod.ServerStarting.class)
.put(FMLServerStartedEvent.class, Mod.ServerStarted.class)
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
.put(IMCEvent.class,Mod.IMCCallback.class)
.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 VersionRange minecraftAccepted;
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
@@ -123,9 +134,9 @@ public class FMLModContainer implements ModContainer
{
modMetadata = mc.getMetadataForId(getModId(), descriptor);
if (descriptor.containsKey("usesMetadata"))
if (descriptor.containsKey("useMetadata"))
{
overridesMetadata = !((Boolean)descriptor.get("usesMetadata")).booleanValue();
overridesMetadata = !((Boolean)descriptor.get("useMetadata")).booleanValue();
}
if (overridesMetadata || !modMetadata.useDependencyInformation)
@@ -150,16 +161,74 @@ public class FMLModContainer implements ModContainer
modMetadata.name = getModId();
}
internalVersion = (String) descriptor.get("version");
if (Strings.isNullOrEmpty(internalVersion))
{
Properties versionProps = searchForVersionProperties();
if (versionProps != null)
{
internalVersion = versionProps.getProperty(getModId()+".version");
FMLLog.fine("Found version %s for mod %s in version.properties, using", internalVersion, getModId());
}
}
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
{
FMLLog.warning("Mod %s is missing the required element 'version'. Falling back to metadata version %s", getModId(), modMetadata.version);
modMetadata.version = internalVersion;
FMLLog.warning("Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
internalVersion = modMetadata.version;
}
if (Strings.isNullOrEmpty(internalVersion))
{
FMLLog.warning("Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0";
}
String mcVersionString = (String) descriptor.get("acceptedMinecraftVersions");
if (!Strings.isNullOrEmpty(mcVersionString))
{
minecraftAccepted = VersionParser.parseRange(mcVersionString);
}
else
{
minecraftAccepted = Loader.instance().getMinecraftModContainer().getStaticVersionRange();
}
}
public Properties searchForVersionProperties()
{
try
{
FMLLog.fine("Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
Properties version = null;
if (getSource().isFile())
{
ZipFile source = new ZipFile(getSource());
ZipEntry versionFile = source.getEntry("version.properties");
if (versionFile!=null)
{
version = new Properties();
version.load(source.getInputStream(versionFile));
}
source.close();
}
else if (getSource().isDirectory())
{
File propsFile = new File(getSource(),"version.properties");
if (propsFile.exists() && propsFile.isFile())
{
version = new Properties();
FileInputStream fis = new FileInputStream(propsFile);
version.load(fis);
fis.close();
}
}
return version;
}
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.fine("Failed to find a usable version.properties file");
return null;
}
}
@Override
@@ -356,7 +425,7 @@ public class FMLModContainer implements ModContainer
}
@Subscribe
public void handleModStateEvent(FMLStateEvent event)
public void handleModStateEvent(FMLEvent event)
{
Class<? extends Annotation> annotation = modAnnotationTypes.get(event.getClass());
if (annotation == null)
@@ -404,4 +473,10 @@ public class FMLModContainer implements ModContainer
{
return modMetadata.version;
}
@Override
public VersionRange acceptableMinecraftVersionRange()
{
return minecraftAccepted;
}
}
@@ -29,15 +29,15 @@ public interface ICraftingHandler
* The object array contains these three arguments
*
* @param player
* @param craftedItem
* @param craftingGrid
* @param item
* @param craftMatrix
*/
void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
/**
* The object array contains these two arguments
* @param player
* @param smeltedItem
* @param item
*/
void onSmelting(EntityPlayer player, ItemStack item);
}
@@ -35,7 +35,6 @@ public interface IDispenseHandler
* @param entX
* @param entY
* @param entZ
* @return
*/
@Deprecated
int dispense(double x, double y, double z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
@@ -24,7 +24,6 @@ public interface IDispenserHandler
* @param entX
* @param entY
* @param entZ
* @return
*/
int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
}
@@ -0,0 +1,6 @@
package cpw.mods.fml.common;
public interface IFMLHandledException
{
}
@@ -6,8 +6,7 @@ public interface IScheduledTickHandler extends ITickHandler
* Return the number of actual ticks that will pass
* before your next tick will fire. This will be called
* just after your last tick fired to compute the next delay.
* @param tick
* @return
* @return Time until next tick
*/
public int nextTickSpacing();
}
@@ -51,14 +51,11 @@ public interface ITickHandler
/**
* Returns the list of ticks this tick handler is interested in receiving at the minute
*
* @return
*/
public EnumSet<TickType> ticks();
/**
* A profiling label for this tick handler
* @return
*/
public String getLabel();
}
@@ -19,8 +19,7 @@ import net.minecraft.src.IChunkProvider;
import net.minecraft.src.World;
/**
* This is called back during world generation. The {@link #generate(Random, int, int, Object...)} method passes in some additional data that
* can be cast into minecraft objects.
* This is called back during world generation.
*
* @author cpw
*
@@ -34,7 +33,7 @@ public interface IWorldGenerator
* @param chunkX the chunk X coordinate of this chunk.
* @param chunkZ the chunk Z coordinate of this chunk.
* @param world : additionalData[0] The minecraft {@link World} we're generating for.
* @param generator : additionalData[1] The {@link IChunkProvider} that is generating.
* @param chunkGenerator : additionalData[1] The {@link IChunkProvider} that is generating.
* @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation.
*
*/
@@ -7,6 +7,7 @@ import java.util.Set;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
public class InjectedModContainer implements ModContainer
{
@@ -110,4 +111,22 @@ public class InjectedModContainer implements ModContainer
{
return wrappedContainer.getDisplayVersion();
}
@Override
public VersionRange acceptableMinecraftVersionRange()
{
return wrappedContainer.acceptableMinecraftVersionRange();
}
public WorldAccessContainer getWrappedWorldAccessContainer()
{
if (wrappedContainer instanceof WorldAccessContainer)
{
return (WorldAccessContainer) wrappedContainer;
}
else
{
return null;
}
}
}
+43 -13
View File
@@ -1,5 +1,6 @@
package cpw.mods.fml.common;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -18,6 +19,7 @@ import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
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.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLStateEvent;
@@ -88,6 +90,7 @@ public class LoadController
state = state.transition(!errors.isEmpty());
if (state != desiredState)
{
Throwable toThrow = null;
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
StringBuilder sb = new StringBuilder();
printModStates(sb);
@@ -96,10 +99,23 @@ public class LoadController
for (Entry<String, Throwable> error : errors.entries())
{
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
if (error.getValue() instanceof IFMLHandledException)
{
toThrow = error.getValue();
}
else if (toThrow == null)
{
toThrow = error.getValue();
}
}
if (toThrow != null && toThrow instanceof RuntimeException)
{
throw (RuntimeException)toThrow;
}
else
{
throw new LoaderException(toThrow);
}
// Throw embedding the first error (usually the only one)
throw new LoaderException(errors.values().iterator().next());
}
}
@@ -109,7 +125,7 @@ public class LoadController
}
@Subscribe
public void propogateStateMessage(FMLStateEvent stateEvent)
public void propogateStateMessage(FMLEvent stateEvent)
{
if (stateEvent instanceof FMLPreInitializationEvent)
{
@@ -120,17 +136,20 @@ public class LoadController
activeContainer = mc;
String modId = mc.getModId();
stateEvent.applyModContainer(activeContainer());
FMLLog.finer("Posting state event %s to mod %s", stateEvent, modId);
FMLLog.finer("Sending event %s to mod %s", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent);
FMLLog.finer("State event %s delivered to mod %s", stateEvent, modId);
FMLLog.finer("Sent event %s to mod %s", stateEvent.getEventType(), modId);
activeContainer = null;
if (!errors.containsKey(modId))
if (stateEvent instanceof FMLStateEvent)
{
modStates.put(modId, stateEvent.getModState());
}
else
{
modStates.put(modId, ModState.ERRORED);
if (!errors.containsKey(modId))
{
modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
}
else
{
modStates.put(modId, ModState.ERRORED);
}
}
}
}
@@ -158,7 +177,14 @@ public class LoadController
public void errorOccurred(ModContainer modContainer, Throwable exception)
{
errors.put(modContainer.getModId(), exception);
if (exception instanceof InvocationTargetException)
{
errors.put(modContainer.getModId(), ((InvocationTargetException)exception).getCause());
}
else
{
errors.put(modContainer.getModId(), exception);
}
}
public void printModStates(StringBuilder ret)
@@ -207,4 +233,8 @@ public class LoadController
{
return this.state == state;
}
boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
}
}
+45 -20
View File
@@ -18,6 +18,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -31,14 +32,17 @@ import com.google.common.base.CharMatcher;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.common.collect.Multiset.Entry;
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.discovery.ModDiscoverer;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadEvent;
import cpw.mods.fml.common.functions.ModIdFunction;
import cpw.mods.fml.common.modloader.BaseModProxy;
@@ -104,7 +109,7 @@ public class Loader
private static String rev;
private static String build;
private static String mccversion;
private static String mcsversion;
private static String mcpversion;
/**
* The class loader we load the mods into.
@@ -132,6 +137,8 @@ public class Loader
private Exception capturedError;
private File canonicalModsDir;
private LoadController modController;
private MinecraftDummyContainer minecraft;
private MCPDummyContainer mcp;
private static File minecraftDir;
private static List<String> injectedContainers;
@@ -153,7 +160,7 @@ public class Loader
rev = (String) data[2];
build = (String) data[3];
mccversion = (String) data[4];
mcsversion = (String) data[5];
mcpversion = (String) data[5];
minecraftDir = (File) data[6];
injectedContainers = (List<String>)data[7];
}
@@ -167,6 +174,9 @@ public class Loader
FMLLog.severe("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, actualMCVersion);
throw new LoaderException();
}
minecraft = new MinecraftDummyContainer(actualMCVersion);
mcp = new MCPDummyContainer(MetadataCollection.from(getClass().getResourceAsStream("/mcpmod.info"), "MCP").getMetadataForId("mcp", null));
}
/**
@@ -187,6 +197,11 @@ public class Loader
for (ModContainer mod : getActiveModList())
{
if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion()))
{
FMLLog.severe("The mod %s does not wish to run in Minecraft version %s. You will have to remove it to play.", mod.getModId(), getMCVersionString());
throw new WrongMinecraftVersionException(mod);
}
Map<String,ArtifactVersion> names = Maps.uniqueIndex(mod.getRequirements(), new Function<ArtifactVersion, String>()
{
public String apply(ArtifactVersion v)
@@ -194,8 +209,8 @@ public class Loader
return v.getLabel();
}
});
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
Set<ArtifactVersion> versionMissingMods = Sets.newHashSet();
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
if (!missingMods.isEmpty())
{
FMLLog.severe("The mod %s (%s) requires mods %s to be available", mod.getModId(), mod.getName(), missingMods);
@@ -291,6 +306,8 @@ public class Loader
private ModDiscoverer identifyMods()
{
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");
for (String cont : injectedContainers)
{
@@ -333,7 +350,6 @@ public class Loader
private void identifyDuplicates(List<ModContainer> mods)
{
boolean foundDupe = false;
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods)
{
@@ -344,15 +360,19 @@ public class Loader
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
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);
}
}
/**
@@ -419,12 +439,12 @@ public class Loader
public List<ModContainer> getModList()
{
return ImmutableList.copyOf(instance().mods);
return instance().mods != null ? ImmutableList.copyOf(instance().mods) : ImmutableList.<ModContainer>of();
}
/**
* Called from the hook to start mod loading. We trigger the
* {@link #identifyMods()} and {@link #preModInit()} phases here. Finally,
* {@link #identifyMods()} and Constructing, Preinitalization, and Initalization phases here. Finally,
* the mod list is frozen completely and is consider immutable from then on.
*/
public void loadMods()
@@ -443,7 +463,7 @@ public class Loader
{
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
{
modClassLoader.addFile(nonMod);
@@ -512,16 +532,13 @@ public class Loader
* Query if we know of a mod named modname
*
* @param modname
* @return
* @return If the mod is loaded
*/
public static boolean isModLoaded(String modname)
{
return instance().namedMods.containsKey(modname) && instance().modController.getModState(instance.namedMods.get(modname))!=ModState.DISABLED;
}
/**
* @return
*/
public File getConfigDir()
{
return canonicalConfigDir;
@@ -540,17 +557,11 @@ public class Loader
return ret.toString();
}
/**
* @return
*/
public String getFMLVersionString()
{
return String.format("%s.%s.%s.%s", major, minor, rev, build);
}
/**
* @return
*/
public ClassLoader getModClassLoader()
{
return modClassLoader;
@@ -639,6 +650,7 @@ public class Loader
// Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION);
modController.transition(LoaderState.POSTINITIALIZATION);
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
modController.transition(LoaderState.AVAILABLE);
modController.distributeStateMessage(LoaderState.AVAILABLE);
@@ -664,7 +676,7 @@ public class Loader
public List<ModContainer> getActiveModList()
{
return modController.getActiveModList();
return modController != null ? modController.getActiveModList() : ImmutableList.<ModContainer>of();
}
public ModState getModState(ModContainer selectedMod)
@@ -716,4 +728,17 @@ public class Loader
{
return modController.isInState(state);
}
public MinecraftDummyContainer getMinecraftModContainer()
{
return minecraft;
}
public boolean hasReachedState(LoaderState state) {
return modController.hasReachedState(state);
}
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 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.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -59,7 +60,7 @@ public enum LoaderState
{
return eventClass != null;
}
public FMLStateEvent getEvent(Object... eventData)
{
try
@@ -87,7 +88,7 @@ public enum LoaderState
AVAILABLE("Available"),
DISABLED("Disabled"),
ERRORED("Errored");
private 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;
}
}
@@ -0,0 +1,26 @@
package cpw.mods.fml.common;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
import cpw.mods.fml.common.versioning.VersionRange;
public class MinecraftDummyContainer extends DummyModContainer
{
private VersionRange staticRange;
public MinecraftDummyContainer(String actualMCVersion)
{
super(new ModMetadata());
getMetadata().modId = "Minecraft";
getMetadata().name = "Minecraft";
getMetadata().version = actualMCVersion;
staticRange = VersionParser.parseRange("["+actualMCVersion+"]");
}
public VersionRange getStaticVersionRange()
{
return staticRange;
}
}
+59 -13
View File
@@ -18,6 +18,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraft.src.ItemBlock;
/**
@@ -32,31 +35,71 @@ public @interface Mod
{
/**
* The unique mod identifier for this mod
* @return
*/
String modid();
/**
* A user friendly name for the mod
* @return
*/
String name() default "";
/**
* A version string for this mod
* @return
*/
String version() default "";
/**
* A simple dependency string for this mod (see modloader's "priorities" string specification)
* @return
*/
String dependencies() default "";
/**
* Whether to use the mcmod.info metadata by default for this mod.
* If true, settings in the mcmod.info file will override settings in these annotations.
* @return
*/
boolean useMetadata() default false;
/**
* The acceptable range of minecraft versions that this mod will load and run in
* The default ("empty string") indicates that only the current minecraft version is acceptable.
* FML will refuse to run with an error if the minecraft version is not in this range across all mods.
* @return A version range as specified by the maven version range specification or the empty string
*/
String acceptedMinecraftVersions() default "";
/**
* 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.
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
* @return The name of the plugin to load for this mod
*/
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 "";
/**
* Mark the designated method as being called at the "pre-initialization" phase
* @author cpw
@@ -90,7 +133,7 @@ public @interface Mod
@Target(ElementType.METHOD)
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
*
*/
@@ -98,13 +141,22 @@ public @interface Mod
@Target(ElementType.METHOD)
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
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
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.
* @author cpw
@@ -115,7 +167,6 @@ public @interface Mod
public @interface Instance {
/**
* The mod object to inject into this field
* @return
*/
String value() default "";
}
@@ -129,7 +180,6 @@ public @interface Mod
public @interface Metadata {
/**
* The mod id specifying the metadata to load here
* @return
*/
String value() default "";
}
@@ -143,12 +193,10 @@ public @interface Mod
public @interface Block {
/**
* The block's name
* @return
*/
String name();
/**
* The associated ItemBlock subtype for the item (can be null for an ItemBlock)
* @return
*/
Class<?> itemTypeClass() default ItemBlock.class;
}
@@ -162,12 +210,10 @@ public @interface Mod
public @interface Item {
/**
* The name of the item
* @return
*/
String name();
/**
* The type of the item
* @return
*/
String typeClass();
}
+3 -26
View File
@@ -20,6 +20,7 @@ import java.util.Set;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
/**
* The container that wraps around mods in the system.
@@ -38,66 +39,48 @@ public interface ModContainer
{
/**
* The globally unique modid for this mod
*
* @return
*/
String getModId();
/**
* A human readable name
*
* @return
*/
String getName();
/**
* A human readable version identifier
*
* @return
*/
String getVersion();
/**
* The location on the file system which this mod came from
*
* @return
*/
File getSource();
/**
* The metadata for this mod
*
* @return
*/
ModMetadata getMetadata();
/**
* Attach this mod to it's metadata from the supplied metadata collection
*
* @param mc
*/
void bindMetadata(MetadataCollection mc);
/**
* Set the enabled/disabled state of this mod
*
* @param enabled
*/
void setEnabledState(boolean enabled);
/**
* A list of the modids that this mod requires loaded prior to loading
*
* @return
*/
Set<ArtifactVersion> getRequirements();
/**
* A list of modids that should be loaded prior to this one. The special
* value <strong>*</strong> indicates to load <em>before</em> any other mod.
*
* @return
*/
List<ArtifactVersion> getDependencies();
@@ -105,16 +88,12 @@ public interface ModContainer
* A list of modids that should be loaded <em>after</em> this one. The
* special value <strong>*</strong> indicates to load <em>after</em> any
* other mod.
*
* @return
*/
List<ArtifactVersion> getDependants();
/**
* A representative string encapsulating the sorting preferences for this
* mod
*
* @return
*/
String getSortingRules();
@@ -126,7 +105,6 @@ public interface ModContainer
*
* @param bus
* @param controller
* @return
*/
boolean registerBus(EventBus bus, LoadController controller);
@@ -134,14 +112,11 @@ public interface ModContainer
* Does this mod match the supplied mod
*
* @param mod
* @return
*/
boolean matches(Object mod);
/**
* Get the actual mod object
*
* @return
*/
Object getMod();
@@ -152,4 +127,6 @@ public interface ModContainer
boolean isNetworkMod();
String getDisplayVersion();
VersionRange acceptableMinecraftVersionRange();
}
+1 -10
View File
@@ -91,10 +91,6 @@ public class ModMetadata
public List<ArtifactVersion> dependants;
public boolean autogenerated;
/**
* @param mod2
* @param type2
*/
public ModMetadata(JsonNode node)
{
Map<JsonStringNode, Object> processedFields = Maps.transformValues(node.getFields(), new JsonStringConverter());
@@ -145,9 +141,7 @@ public class ModMetadata
}
return res;
}
/**
* @return
*/
public String getChildModCountString()
{
return String.format("%d child mod%s", childMods.size(), childMods.size() != 1 ? "s" : "");
@@ -158,9 +152,6 @@ public class ModMetadata
return Joiner.on(", ").join(authorList);
}
/**
* @return
*/
public String getChildModList()
{
return Joiner.on(", ").join(Lists.transform(childMods, new ModNameFunction()));
+2 -2
View File
@@ -18,7 +18,7 @@ public enum Side {
CLIENT, SERVER, BUKKIT;
/**
* @return
* @return If this is the server environment
*/
public boolean isServer()
{
@@ -26,7 +26,7 @@ public enum Side {
}
/**
* @return
* @return if this is the Client environment
*/
public boolean isClient()
{
@@ -29,13 +29,11 @@ public @interface SidedProxy
{
/**
* The name of the client side class to load and populate
* @return
*/
String clientSide() default "";
/**
* The name of the server side class to load and populate
* @return
*/
String serverSide() default "";
-2
View File
@@ -69,8 +69,6 @@ public enum TickType {
/**
* Partner ticks that are also cancelled by returning false from onTickInGame
*
* @return
*/
public EnumSet<TickType> partnerTicks()
{
@@ -0,0 +1,14 @@
package cpw.mods.fml.common;
import java.util.Map;
import net.minecraft.src.NBTBase;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.SaveHandler;
import net.minecraft.src.WorldInfo;
public interface WorldAccessContainer
{
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info);
public void readData(SaveHandler handler, WorldInfo info, Map<String,NBTBase> propertyMap, NBTTagCompound tag);
}
@@ -0,0 +1,13 @@
package cpw.mods.fml.common;
public class WrongMinecraftVersionException extends RuntimeException
{
public ModContainer mod;
public WrongMinecraftVersionException(ModContainer mod)
{
this.mod = mod;
}
}
@@ -145,6 +145,7 @@ public class AccessTransformer implements IClassTransformer
@Override
public byte[] transform(String name, byte[] bytes)
{
if (bytes == null) { return null; }
if (!modifiers.containsKey(name)) { return bytes; }
ClassNode classNode = new ClassNode();
@@ -45,13 +45,14 @@ public class MCPMerger
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
private static HashSet<String> copyToServer = 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;
public static void main(String[] args)
{
if (args.length != 3)
{
System.out.println("Usage: AccessTransformer <MapFile> <minecraft.jar> <minecraft_server.jar>");
System.out.println("Usage: MCPMerger <MapFile> <minecraft.jar> <minecraft_server.jar>");
System.exit(1);
}
@@ -134,10 +135,16 @@ public class MCPMerger
String line;
while ((line = br.readLine()) != null)
{
boolean toClient = line.charAt(0) == '<';
line = line.substring(1);
if (toClient) copyToClient.add(line);
else copyToServer.add(line);
line = line.split("#")[0];
char cmd = line.charAt(0);
line = line.substring(1).trim();
switch (cmd)
{
case '!': dontAnnotate.add(line); break;
case '<': copyToClient.add(line); break;
case '>': copyToServer.add(line); break;
}
}
in.close();
@@ -224,20 +231,14 @@ public class MCPMerger
cAdded.add(name);
sAdded.add(name);
}
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
{
if (!copyToClient.contains(entry.getKey()))
if (DEBUG)
{
copyClass(sInJar, entry.getValue(), null, sOutJar, false);
}
else
{
if (DEBUG)
{
System.out.println("Copy class s->c : " + entry.getKey());
}
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
System.out.println("Copy class s->c : " + entry.getKey());
}
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
}
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
@@ -288,7 +289,7 @@ public class MCPMerger
reader.accept(classNode, 0);
if (!classNode.name.equals("ayn")) //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>();
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
@@ -89,6 +89,7 @@ public class MarkerTransformer implements IClassTransformer
@Override
public byte[] transform(String name, byte[] bytes)
{
if (bytes == null) { return null; }
if (!markers.containsKey(name)) { return bytes; }
ClassNode classNode = new ClassNode();
@@ -23,6 +23,8 @@ public class SideTransformer implements IClassTransformer
@Override
public byte[] transform(String name, byte[] bytes)
{
if (bytes == null) { return null; }
ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(bytes);
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));
}
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();
@@ -1,9 +1,15 @@
package cpw.mods.fml.common.event;
import cpw.mods.fml.common.ModContainer;
public class FMLEvent
{
public final String getEventType()
{
return getClass().getSimpleName();
}
public void applyModContainer(ModContainer activeContainer) {
// NO OP
}
}
@@ -0,0 +1,92 @@
package cpw.mods.fml.common.event;
import java.util.List;
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.Loader;
import cpw.mods.fml.common.LoaderState;
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 ArrayListMultimap<String, IMCMessage> modMessages = ArrayListMultimap.create();
/**
* Subscribe to this event to receive your messages (they are sent between {@link Init} and {@link PostInit})
*
* @author cpw
*
*/
public static class IMCEvent extends FMLEvent {
@Override
public void applyModContainer(ModContainer activeContainer) {
currentList = ImmutableList.copyOf(modMessages.get(activeContainer.getModId()));
}
private ImmutableList<IMCMessage> currentList;
public ImmutableList<IMCMessage> getMessages()
{
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
*/
public final 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
*/
public final String value;
private IMCMessage(String sender, String key, String value)
{
this.key = key;
this.value = value;
this.sender = sender;
}
@Override
public String toString() {
return sender;
}
}
public static boolean sendMessage(String modId, String key, String value)
{
if (Loader.instance().activeModContainer()==null)
{
return false;
}
modMessages.put(modId, new IMCMessage(Loader.instance().activeModContainer().getModId(), key, value));
return Loader.isModLoaded(modId) && !Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION);
}
}
@@ -1,8 +1,12 @@
package cpw.mods.fml.common.event;
import java.io.File;
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.FMLModContainer;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.discovery.ASMDataTable;
@@ -14,6 +18,7 @@ public class FMLPreInitializationEvent extends FMLStateEvent
private File configurationDir;
private File suggestedConfigFile;
private ASMDataTable asmData;
private ModContainer modContainer;
public FMLPreInitializationEvent(Object... data)
{
@@ -31,6 +36,7 @@ public class FMLPreInitializationEvent extends FMLStateEvent
@Override
public void applyModContainer(ModContainer activeContainer)
{
this.modContainer = activeContainer;
this.modMetadata = activeContainer.getMetadata();
this.sourceFile = activeContainer.getSource();
this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId()+".cfg");
@@ -60,4 +66,26 @@ public class FMLPreInitializationEvent extends FMLStateEvent
{
return asmData;
}
public Properties getVersionProperties()
{
if (this.modContainer instanceof FMLModContainer)
{
return ((FMLModContainer)this.modContainer).searchForVersionProperties();
}
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;
}
}
@@ -2,7 +2,6 @@ package cpw.mods.fml.common.event;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.Side;
public abstract class FMLStateEvent extends FMLEvent
@@ -14,11 +13,6 @@ public abstract class FMLStateEvent extends FMLEvent
public abstract ModState getModState();
public void applyModContainer(ModContainer activeContainer)
{
// NO OP
}
public Side getSide()
{
return FMLCommonHandler.instance().getSide();
@@ -21,9 +21,10 @@ import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetServerHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.World;
import net.minecraft.src.WorldClient;
@@ -40,29 +41,14 @@ import cpw.mods.fml.common.asm.SideOnly;
*/
public interface BaseModProxy
{
/**
*
*/
void modsLoaded();
/**
*
*/
void load();
/**
* @return
*/
String getName();
/**
* @return
*/
String getPriorities();
/**
* @return
*/
String getVersion();
boolean doTickInGUI(TickType type, boolean end, Object... tickData);
@@ -73,7 +59,7 @@ public interface BaseModProxy
void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
void takenFromFurnace(EntityPlayer player, ItemStack item);
public abstract void onClientLogout(NetworkManager manager);
public abstract void onClientLogout(INetworkManager manager);
public abstract void onClientLogin(EntityPlayer player);
@@ -87,9 +73,6 @@ public interface BaseModProxy
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 serverChat(NetServerHandler source, String message);
@@ -122,9 +122,6 @@ public class BaseModTicker implements ITickHandler
return mod.getClass().getSimpleName();
}
/**
* @param mod2
*/
public void setMod(BaseModProxy mod)
{
this.mod = mod;
@@ -4,6 +4,8 @@ import cpw.mods.fml.common.network.EntitySpawnPacket;
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
@@ -17,4 +19,8 @@ public interface IModLoaderSidedHelper
void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet);
void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod);
boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod);
}
@@ -4,7 +4,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet1Login;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
@@ -19,40 +19,43 @@ public class ModLoaderConnectionHandler implements IConnectionHandler
}
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, NetworkManager manager)
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
mod.onClientLogin((EntityPlayer)player);
}
@Override
public String connectionReceived(NetLoginHandler netHandler, NetworkManager manager)
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager manager)
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
// noop
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
}
@Override
public void connectionClosed(NetworkManager manager)
public void connectionClosed(INetworkManager manager)
{
mod.serverDisconnect();
mod.onClientLogout(manager);
if (ModLoaderHelper.sidedHelper==null || !ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
{
mod.serverDisconnect();
mod.onClientLogout(manager);
}
}
@Override
public void clientLoggedIn(NetHandler nh, NetworkManager manager, Packet1Login login)
public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login)
{
mod.serverConnect(nh);
}
@Override
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager manager)
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
{
// noop
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
}
}
@@ -21,8 +21,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,
double entZ)
{
int ret = mod.dispenseEntity(world, item, random, x, y, z, xVelocity, zVelocity, entX, entY, entZ);
return ret == 0 ? -1 : ret;
return -1;
}
}
@@ -32,6 +32,7 @@ import net.minecraft.src.IAnimals;
import net.minecraft.src.ICommand;
import net.minecraft.src.TradeEntry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler;
import cpw.mods.fml.common.IDispenserHandler;
@@ -63,7 +64,16 @@ public class ModLoaderHelper
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();
EnumSet<TickType> ticks = ticker.ticks();
// If we're enabled we get render ticks
@@ -84,7 +94,16 @@ public class ModLoaderHelper
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();
// If we're enabled and we don't want clock ticks we get render ticks
if (enable && !useClock) {
@@ -65,6 +65,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
public class ModLoaderModContainer implements ModContainer
{
@@ -357,7 +358,6 @@ public class ModLoaderModContainer implements ModContainer
/**
* Find all the BaseMods in the system
* @param <A>
* @return
*/
public static <A extends BaseModProxy> List<A> findAll(Class<A> clazz)
{
@@ -426,16 +426,11 @@ public class ModLoaderModContainer implements ModContainer
return mod.getVersion();
}
/**
* @return
*/
public BaseModTicker getGameTickHandler()
{
return this.gameTickHandler;
}
/**
* @return
*/
public BaseModTicker getGUITickHandler()
{
return this.guiTickHandler;
@@ -615,4 +610,10 @@ public class ModLoaderModContainer implements ModContainer
{
serverCommands .add(command);
}
@Override
public VersionRange acceptableMinecraftVersionRange()
{
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
}
}
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.modloader;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
@@ -17,7 +17,7 @@ public class ModLoaderPacketHandler implements IPacketHandler
}
@Override
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player)
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
if (player instanceof EntityPlayerMP)
{
@@ -41,30 +41,22 @@ public class ModProperty
{
this(field, (String)annotationInfo.get("info"), (Double)annotationInfo.get("min"), (Double)annotationInfo.get("max"), (String)annotationInfo.get("name"));
}
/**
* @return
*/
public String name()
{
return name;
}
/**
* @return
*/
public double min()
{
return min;
}
/**
* @return
*/
public double max()
{
return max;
}
/**
* @return
*/
public String info()
{
return info;
@@ -1,7 +1,7 @@
package cpw.mods.fml.common.network;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
@@ -45,7 +45,7 @@ public class EntitySpawnAdjustmentPacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
FMLCommonHandler.instance().adjustEntityLocationOnClient(this);
}
@@ -13,7 +13,7 @@ import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.MathHelper;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
@@ -168,7 +168,7 @@ public class EntitySpawnPacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
ModContainer mc = nmh.getContainer();
@@ -20,7 +20,7 @@ import net.minecraft.src.Item;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetServerHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet131MapData;
import net.minecraft.src.Packet1Login;
@@ -61,7 +61,7 @@ public class FMLNetworkHandler
private Map<Integer, NetworkModHandler> networkIdLookup = Maps.newHashMap();
public static void handlePacket250Packet(Packet250CustomPayload packet, NetworkManager network, NetHandler handler)
public static void handlePacket250Packet(Packet250CustomPayload packet, INetworkManager network, NetHandler handler)
{
String target = packet.field_73630_a;
@@ -79,12 +79,12 @@ public class FMLNetworkHandler
}
}
public static void onConnectionEstablishedToServer(NetHandler clientHandler, NetworkManager manager, Packet1Login login)
public static void onConnectionEstablishedToServer(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
{
NetworkRegistry.instance().clientLoggedIn(clientHandler, manager, login);
}
private void handleFMLPacket(Packet250CustomPayload packet, NetworkManager network, NetHandler netHandler)
private void handleFMLPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler netHandler)
{
FMLPacket pkt = FMLPacket.readPacket(packet.field_73629_c);
String userName = "";
@@ -120,6 +120,12 @@ public class FMLNetworkHandler
netLoginHandler.completeConnection("You don't have FML installed, you cannot connect to this server");
return;
}
else
{
// Vanilla kicked us for some reason - bye now!
FMLLog.fine("Connection from %s was closed by vanilla minecraft", userName);
return;
}
}
switch (loginStates.get(netLoginHandler))
@@ -272,7 +278,7 @@ public class FMLNetworkHandler
return networkModHandlers.keySet();
}
public static void handlePlayerLogin(EntityPlayerMP player, NetServerHandler netHandler, NetworkManager manager)
public static void handlePlayerLogin(EntityPlayerMP player, NetServerHandler netHandler, INetworkManager manager)
{
NetworkRegistry.instance().playerLoggedIn(player, netHandler, manager);
GameRegistry.onPlayerLogin(player);
@@ -294,19 +300,19 @@ public class FMLNetworkHandler
}
}
public static void onClientConnectionToRemoteServer(NetHandler netClientHandler, String server, int port, NetworkManager networkManager)
public static void onClientConnectionToRemoteServer(NetHandler netClientHandler, String server, int port, INetworkManager networkManager)
{
NetworkRegistry.instance().connectionOpened(netClientHandler, server, port, networkManager);
}
public static void onClientConnectionToIntegratedServer(NetHandler netClientHandler, MinecraftServer server, NetworkManager networkManager)
public static void onClientConnectionToIntegratedServer(NetHandler netClientHandler, MinecraftServer server, INetworkManager networkManager)
{
NetworkRegistry.instance().connectionOpened(netClientHandler, server, networkManager);
}
public static void onConnectionClosed(NetworkManager manager)
public static void onConnectionClosed(INetworkManager manager, EntityPlayer player)
{
NetworkRegistry.instance().connectionClosed(manager);
NetworkRegistry.instance().connectionClosed(manager, player);
}
@@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.logging.Level;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import com.google.common.base.Throwables;
import com.google.common.primitives.Bytes;
@@ -91,7 +91,7 @@ public abstract class FMLPacket
public abstract FMLPacket consumePacket(byte[] data);
public abstract void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
public abstract void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
{
// TODO Auto-generated method stub
@@ -18,7 +18,6 @@ public interface IChatListener
*
* @param handler
* @param message
* @return
*/
public Packet3Chat clientChat(NetHandler handler, Packet3Chat message);
}
@@ -3,7 +3,7 @@ package cpw.mods.fml.common.network;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet1Login;
public interface IConnectionHandler
@@ -16,7 +16,7 @@ public interface IConnectionHandler
* @param netHandler
* @param manager
*/
void playerLoggedIn(Player player, NetHandler netHandler, NetworkManager manager);
void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager);
/**
* If you don't want the connection to continue, return a non-empty string here
@@ -27,9 +27,8 @@ public interface IConnectionHandler
*
* @param netHandler
* @param manager
* @return
*/
String connectionReceived(NetLoginHandler netHandler, NetworkManager manager);
String connectionReceived(NetLoginHandler netHandler, INetworkManager manager);
/**
* Fired when a remote connection is opened
@@ -39,7 +38,7 @@ public interface IConnectionHandler
* @param server
* @param port
*/
void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager manager);
void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager);
/**
*
* Fired when a local connection is opened
@@ -49,7 +48,7 @@ public interface IConnectionHandler
* @param netClientHandler
* @param server
*/
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager manager);
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager);
/**
* Fired when a connection closes
@@ -58,7 +57,7 @@ public interface IConnectionHandler
*
* @param manager
*/
void connectionClosed(NetworkManager manager);
void connectionClosed(INetworkManager manager);
/**
* Fired when the client established the connection to the server
@@ -68,6 +67,6 @@ public interface IConnectionHandler
* @param manager
* @param login
*/
void clientLoggedIn(NetHandler clientHandler, NetworkManager manager, Packet1Login login);
void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login);
}
@@ -1,6 +1,6 @@
package cpw.mods.fml.common.network;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
public interface IPacketHandler
@@ -11,5 +11,5 @@ public interface IPacketHandler
* @param packet The packet itself
* @param player A dummy interface representing the player - it can be cast into a real player instance if needed
*/
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player);
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player);
}
@@ -7,7 +7,7 @@ import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import com.google.common.collect.Maps;
import com.google.common.io.ByteArrayDataInput;
@@ -56,7 +56,7 @@ public class ModIdentifiersPacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
for (Entry<String,Integer> idEntry : modIds.entrySet())
{
@@ -9,7 +9,7 @@ import java.util.Map.Entry;
import java.util.Set;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import com.google.common.collect.Lists;
@@ -73,10 +73,10 @@ public class ModListRequestPacket extends FMLPacket
* This packet is executed on the client to evaluate the server's mod list against
* the client
*
* @see cpw.mods.fml.common.network.FMLPacket#execute()
* @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
*/
@Override
public void execute(NetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
List<String> missingMods = Lists.newArrayList();
Map<String,String> modVersions = Maps.newHashMap();
@@ -11,7 +11,7 @@ import java.util.logging.Logger;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet250CustomPayload;
import com.google.common.collect.Lists;
@@ -78,7 +78,7 @@ public class ModListResponsePacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
Map<String, ModContainer> indexedModList = Maps.newHashMap(Loader.instance().getIndexedModList());
List<String> missingClientMods = Lists.newArrayList();
@@ -17,7 +17,7 @@ import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.common.versioning.VersionRange;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
public class ModMissingPacket extends FMLPacket
{
@@ -86,7 +86,7 @@ public class ModMissingPacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
FMLCommonHandler.instance().getSidedDelegate().displayMissingMods(this);
}
@@ -13,25 +13,19 @@ public @interface NetworkMod
{
/**
* Does this mod require the client side to be present when installed on a server?
*
* @return
*/
boolean clientSideRequired() default false;
/**
* Does this mod require the server side to be present when installed on a client?
* @return
*/
boolean serverSideRequired() default false;
/**
* A list of Packet250 network channels to register for this mod - these channels
* will be universal and will require a universal packethandler to handle them
*
* @return
*/
String[] channels() default {};
/**
* An optional range check for client to server communication version compatibility
* @return
*/
String versionBounds() default "";
@@ -39,34 +33,25 @@ public @interface NetworkMod
* A packet handler implementation for channels registered through this annotation
* - this packet handler will be universal and handle both client and server
* requests.
*
* @return
*/
Class<? extends IPacketHandler> packetHandler() default NULL.class;
/**
* A tiny packet handler implementation based on {@link Packet131MapData} for "small"
* data packet loads.
*
* @return
*/
Class<? extends ITinyPacketHandler> tinyPacketHandler() default NULL.class;
/**
* A connection handler implementation for this network mod
*
* @return
*/
Class<? extends IConnectionHandler> connectionHandler() default NULL.class;
/**
* A packet handler and channels to register for the client side
*
* @return
*/
SidedPacketHandler clientPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
/**
* A packet handler and channels to register for the server side
* @return
*/
SidedPacketHandler serverPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
@@ -100,15 +100,15 @@ public class NetworkModHandler
}
}
FMLLog.finest("Testing mod %s to very it can accept it's own version in a remote connection", container.getModId());
FMLLog.finest("Testing mod %s to verify it accepts its own version in a remote connection", container.getModId());
boolean acceptsSelf = acceptVersion(container.getVersion());
if (!acceptsSelf)
{
FMLLog.severe("The mod %s appears to reject it's own version number (%s) in it's version handling. This is likely a severe bug in the mod!", container.getModId(), container.getVersion());
FMLLog.severe("The mod %s appears to reject its own version number (%s) in its version handling. This is likely a severe bug in the mod!", container.getModId(), container.getVersion());
}
else
{
FMLLog.finest("The mod %s accepts it's own version (%s)", container.getModId(), container.getVersion());
FMLLog.finest("The mod %s accepts its own version (%s)", container.getModId(), container.getVersion());
}
tryCreatingPacketHandler(container, mod.packetHandler(), mod.channels(), null);
@@ -13,7 +13,7 @@ import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetLoginHandler;
import net.minecraft.src.NetServerHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.Packet131MapData;
import net.minecraft.src.Packet1Login;
import net.minecraft.src.Packet250CustomPayload;
@@ -80,7 +80,6 @@ public class NetworkRegistry
* Is the specified channel active for the player?
* @param channel
* @param player
* @return
*/
public boolean isChannelActive(String channel, Player player)
{
@@ -160,7 +159,7 @@ public class NetworkRegistry
chatListeners.add(listener);
}
void playerLoggedIn(EntityPlayerMP player, NetServerHandler netHandler, NetworkManager manager)
void playerLoggedIn(EntityPlayerMP player, NetServerHandler netHandler, INetworkManager manager)
{
generateChannelRegistration(player, netHandler, manager);
for (IConnectionHandler handler : connectionHandlers)
@@ -169,7 +168,7 @@ public class NetworkRegistry
}
}
String connectionReceived(NetLoginHandler netHandler, NetworkManager manager)
String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
for (IConnectionHandler handler : connectionHandlers)
{
@@ -182,7 +181,7 @@ public class NetworkRegistry
return null;
}
void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager networkManager)
void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager networkManager)
{
for (IConnectionHandler handler : connectionHandlers)
{
@@ -190,7 +189,7 @@ public class NetworkRegistry
}
}
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager networkManager)
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager networkManager)
{
for (IConnectionHandler handler : connectionHandlers)
{
@@ -198,7 +197,7 @@ public class NetworkRegistry
}
}
void clientLoggedIn(NetHandler clientHandler, NetworkManager manager, Packet1Login login)
void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
{
generateChannelRegistration(clientHandler.getPlayer(), clientHandler, manager);
for (IConnectionHandler handler : connectionHandlers)
@@ -207,15 +206,16 @@ public class NetworkRegistry
}
}
void connectionClosed(NetworkManager manager)
void connectionClosed(INetworkManager manager, EntityPlayer player)
{
for (IConnectionHandler handler : connectionHandlers)
{
handler.connectionClosed(manager);
}
activeChannels.removeAll(player);
}
void generateChannelRegistration(EntityPlayer player, NetHandler netHandler, NetworkManager manager)
void generateChannelRegistration(EntityPlayer player, NetHandler netHandler, INetworkManager manager)
{
Packet250CustomPayload pkt = new Packet250CustomPayload();
pkt.field_73630_a = "REGISTER";
@@ -224,7 +224,7 @@ public class NetworkRegistry
manager.func_74429_a(pkt);
}
void handleCustomPacket(Packet250CustomPayload packet, NetworkManager network, NetHandler handler)
void handleCustomPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler handler)
{
if ("REGISTER".equals(packet.field_73630_a))
{
@@ -241,7 +241,7 @@ public class NetworkRegistry
}
private void handlePacket(Packet250CustomPayload packet, NetworkManager network, Player player)
private void handlePacket(Packet250CustomPayload packet, INetworkManager network, Player player)
{
String channel = packet.field_73630_a;
for (IPacketHandler handler : Iterables.concat(universalPacketHandlers.get(channel), player instanceof EntityPlayerMP ? serverPacketHandlers.get(channel) : clientPacketHandlers.get(channel)))
@@ -266,10 +266,7 @@ public class NetworkRegistry
deactivateChannel(player, channel);
}
}
/**
* @param packet
* @return
*/
private List<String> extractChannelList(Packet250CustomPayload packet)
{
String request = new String(packet.field_73629_c, Charsets.UTF_8);
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.network;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NetHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.INetworkManager;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
@@ -49,7 +49,7 @@ public class OpenGuiPacket extends FMLPacket
}
@Override
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
EntityPlayer player = netHandler.getPlayer();
player.openGui(networkId, modGuiId, player.field_70170_p, x, y, z);
@@ -363,7 +363,6 @@ public class EntityRegistry
* @param updateRange
* @param updateInterval
* @param sendVelocityInfo
* @return
*/
@Deprecated
public static EntityRegistration registerModLoaderEntity(Object mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval,
@@ -118,7 +118,6 @@ public class GameRegistry
* @param xVelocity
* @param zVelocity
* @param item
* @return
*/
public static int tryDispense(World world, int x, int y, int z, int xVelocity, int zVelocity, ItemStack item, Random random, double entX, double entY, double entZ)
{
@@ -137,7 +136,6 @@ public class GameRegistry
* @param container
* @param type
* @param annotation
* @return
* @throws Exception
*/
public static Object buildBlock(ModContainer container, Class<?> type, Block annotation) throws Exception
@@ -1,5 +1,8 @@
package cpw.mods.fml.common.registry;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -20,6 +23,25 @@ public class LanguageRegistry
return INSTANCE;
}
public String getStringLocalization(String key)
{
return getStringLocalization(key, StringTranslate.func_74808_a().func_74811_c());
}
public String getStringLocalization(String key, String lang)
{
String localizedString = "";
Properties langPack = modLanguageData.get(lang);
if (langPack != null) {
if (langPack.getProperty(key) != null) {
localizedString = langPack.getProperty(key);
}
}
return localizedString;
}
public void addStringLocalization(String key, String value)
{
addStringLocalization(key, "en_US", value);
@@ -34,6 +56,21 @@ public class LanguageRegistry
langPack.put(key,value);
}
public void addStringLocalization(Properties langPackAdditions) {
addStringLocalization(langPackAdditions, "en_US");
}
public void addStringLocalization(Properties langPackAdditions, String lang) {
Properties langPack = modLanguageData.get(lang);
if (langPack == null) {
langPack = new Properties();
modLanguageData.put(lang, langPack);
}
if (langPackAdditions != null) {
langPack.putAll(langPackAdditions);
}
}
public static void reloadLanguageTable()
{
// reload language table by forcing lang to null and reloading the properties file
@@ -58,7 +95,7 @@ public class LanguageRegistry
objectName+=".name";
addStringLocalization(objectName, lang, name);
}
public static void addName(Object objectToName, String name)
{
instance().addNameForObject(objectToName, "en_US", name);
@@ -76,4 +113,41 @@ public class LanguageRegistry
}
languagePack.putAll(langPack);
}
public void loadLocalization(String localizationFile, String lang, boolean isXML)
{
loadLocalization(this.getClass().getResource(localizationFile), lang, isXML);
}
public void loadLocalization(URL localizationFile, String lang, boolean isXML)
{
InputStream langStream = null;
Properties langPack = new Properties();
try {
langStream = localizationFile.openStream();
if (isXML) {
langPack.loadFromXML(langStream);
}
else {
langPack.load(langStream);
}
addStringLocalization(langPack, lang);
}
catch (IOException e) {
e.printStackTrace();
}
finally {
try {
if (langStream != null) {
langStream.close();
}
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
@@ -15,6 +15,7 @@ import net.minecraft.src.StructureVillagePieces;
import net.minecraft.src.Tuple;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
@@ -33,6 +34,7 @@ public class VillagerRegistry
private Multimap<Integer, IVillageTradeHandler> tradeHandlers = ArrayListMultimap.create();
private Map<Class<?>, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap();
private Map<Integer, String> newVillagers = Maps.newHashMap();
private List<Integer> newVillagerIds = Lists.newArrayList();
/**
* Allow access to the {@link StructureVillagePieces} array controlling new village
@@ -48,13 +50,11 @@ public class VillagerRegistry
*
* @param random
* @param i
* @return
*/
StructureVillagePieceWeight getVillagePieceWeight(Random random, int i);
/**
* The class of the root structure component to add to the village
* @return
*/
Class<?> getComponentClass();
@@ -70,7 +70,6 @@ public class VillagerRegistry
* @param p3
* @param p4
* @param p5
* @return
*/
Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, List pieces, Random random, int p1,
int p2, int p3, int p4, int p5);
@@ -90,7 +89,6 @@ public class VillagerRegistry
*
* @param villager
* @param recipeList
* @param random
*/
void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random);
}
@@ -114,6 +112,7 @@ public class VillagerRegistry
throw new RuntimeException();
}
newVillagers.put(villagerId, villagerSkin);
newVillagerIds.add(villagerId);
}
/**
@@ -142,7 +141,6 @@ public class VillagerRegistry
*
* @param villagerType
* @param defaultSkin
* @return
*/
public static String getVillagerSkin(int villagerType, String defaultSkin)
{
@@ -202,4 +200,11 @@ public class VillagerRegistry
}
villager.func_70949_b(list, item.func_77612_l(), random, chance);
}
public static void applyRandomTrade(EntityVillager villager, Random rand)
{
int extra = instance().newVillagerIds.size();
int trade = rand.nextInt(5 + extra);
villager.func_70938_b(trade < 5 ? trade : instance().newVillagerIds.get(trade - 5));
}
}
@@ -125,7 +125,7 @@ public class TopologicalSort
*
* Uses the reverse depth first search as outlined in ...
* @param graph
* @return
* @return The sorted mods list.
*/
public static <T> List<T> topologicalSort(DirectedGraph<T> graph)
{
+18 -6
View File
@@ -16,7 +16,7 @@ import javax.swing.JProgressBar;
import cpw.mods.fml.common.FMLLog;
public class Downloader extends JOptionPane
public class Downloader extends JOptionPane implements IDownloadDisplay
{
private JDialog container;
private JLabel currentActivity;
@@ -45,7 +45,7 @@ public class Downloader extends JOptionPane
return box;
}
JDialog makeDialog()
public JDialog makeDialog()
{
setMessageType(JOptionPane.INFORMATION_MESSAGE);
setMessage(makeProgressPanel());
@@ -94,7 +94,7 @@ public class Downloader extends JOptionPane
}
}
void updateProgressString(String progressUpdate, Object... data)
public void updateProgressString(String progressUpdate, Object... data)
{
FMLLog.finest(progressUpdate, data);
if (currentActivity!=null)
@@ -103,7 +103,7 @@ public class Downloader extends JOptionPane
}
}
void resetProgress(int sizeGuess)
public void resetProgress(int sizeGuess)
{
if (progress!=null)
{
@@ -111,7 +111,7 @@ public class Downloader extends JOptionPane
}
}
void updateProgress(int fullLength)
public void updateProgress(int fullLength)
{
if (progress!=null)
{
@@ -119,10 +119,22 @@ public class Downloader extends JOptionPane
}
}
void makeHeadless()
public void makeHeadless()
{
container = null;
progress = null;
currentActivity = null;
}
@Override
public void setPokeThread(Thread currentThread)
{
this.pokeThread = currentThread;
}
@Override
public boolean shouldStopIt()
{
return stopIt;
}
}
@@ -0,0 +1,55 @@
package cpw.mods.fml.relauncher;
public class DummyDownloader implements IDownloadDisplay
{
@Override
public void resetProgress(int sizeGuess)
{
// TODO Auto-generated method stub
}
@Override
public void setPokeThread(Thread currentThread)
{
// TODO Auto-generated method stub
}
@Override
public void updateProgress(int fullLength)
{
// TODO Auto-generated method stub
}
@Override
public boolean shouldStopIt()
{
// TODO Auto-generated method stub
return false;
}
@Override
public void updateProgressString(String string, Object... data)
{
// TODO Auto-generated method stub
}
@Override
public Object makeDialog()
{
// TODO Auto-generated method stub
return null;
}
@Override
public void makeHeadless()
{
// TODO Auto-generated method stub
}
}
@@ -16,7 +16,7 @@ public class FMLInjectionData
static String rev;
static String build;
static String mccversion;
static String mcsversion;
static String mcpversion;
public static List<String> containers = new ArrayList<String>();
static void build(File mcHome, RelaunchClassLoader classLoader)
@@ -41,14 +41,14 @@ public class FMLInjectionData
minor = properties.getProperty("fmlbuild.minor.number", "missing");
rev = properties.getProperty("fmlbuild.revision.number", "missing");
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcclientversion", "missing");
mcsversion = properties.getProperty("fmlbuild.mcserverversion", "missing");
mccversion = properties.getProperty("fmlbuild.mcversion", "missing");
mcpversion = properties.getProperty("fmlbuild.mcpversion", "missing");
}
public static Object[] data()
{
return new Object[] { major, minor, rev, build, mccversion, mcsversion, minecraftHome, containers };
return new Object[] { major, minor, rev, build, mccversion, mcpversion, minecraftHome, containers };
}
}
@@ -22,13 +22,18 @@ public class FMLRelaunchLog
@Override
public void publish(LogRecord record)
{
boolean currInt = Thread.interrupted();
try
{
ConsoleLogThread.recordQueue.put(record);
}
catch (InterruptedException e)
{
Thread.interrupted();
e.printStackTrace(errCache);
}
if (currInt)
{
Thread.currentThread().interrupt();
}
}
@@ -61,6 +66,7 @@ public class FMLRelaunchLog
}
catch (InterruptedException e)
{
e.printStackTrace(errCache);
Thread.interrupted();
// Stupid
}
@@ -89,14 +95,14 @@ public class FMLRelaunchLog
record = this.toString();
super.reset();
currentMessage.append(record);
if (currentMessage.lastIndexOf(FMLLogFormatter.LINE_SEPARATOR)>=0)
currentMessage.append(record.replace(FMLLogFormatter.LINE_SEPARATOR, "\n"));
if (currentMessage.lastIndexOf("\n")>=0)
{
// Are we longer than just the line separator?
if (currentMessage.length()>FMLLogFormatter.LINE_SEPARATOR.length())
if (currentMessage.length()>1)
{
// Trim the line separator
currentMessage.setLength(currentMessage.length()-FMLLogFormatter.LINE_SEPARATOR.length());
currentMessage.setLength(currentMessage.length()-1);
log.log(Level.INFO, currentMessage.toString());
}
currentMessage.setLength(0);
@@ -114,6 +120,8 @@ public class FMLRelaunchLog
private static boolean configured;
private static Thread consoleLogThread;
private static PrintStream errCache;
private Logger myLog;
private FMLRelaunchLog()
@@ -157,6 +165,8 @@ public class FMLRelaunchLog
}
// Set system out to a log stream
errCache = System.err;
System.setOut(new PrintStream(new LoggingOutStream(stdOut), true));
System.setErr(new PrintStream(new LoggingOutStream(stdErr), true));
@@ -56,16 +56,28 @@ public class FMLRelauncher
if (RelaunchLibraryManager.downloadMonitor != null) { return; }
try
{
RelaunchLibraryManager.downloadMonitor = new Downloader();
if (showIt)
{
popupWindow = RelaunchLibraryManager.downloadMonitor.makeDialog();
RelaunchLibraryManager.downloadMonitor = new Downloader();
popupWindow = (JDialog) RelaunchLibraryManager.downloadMonitor.makeDialog();
}
else
{
RelaunchLibraryManager.downloadMonitor = new DummyDownloader();
}
}
catch (Exception e)
catch (Throwable e)
{
if (RelaunchLibraryManager.downloadMonitor == null)
{
RelaunchLibraryManager.downloadMonitor = new DummyDownloader();
e.printStackTrace();
}
else
{
RelaunchLibraryManager.downloadMonitor.makeHeadless();
}
popupWindow = null;
RelaunchLibraryManager.downloadMonitor.makeHeadless();
}
}
@@ -90,7 +102,7 @@ public class FMLRelauncher
}
}
if (RelaunchLibraryManager.downloadMonitor.stopIt)
if (RelaunchLibraryManager.downloadMonitor.shouldStopIt())
{
System.exit(1);
}
@@ -108,7 +120,7 @@ public class FMLRelauncher
private Class<? super Object> setupNewClientHome(File minecraftHome)
{
Class<? super Object> client = ReflectionHelper.getClass(classLoader, "net.minecraft.client.Minecraft");
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_71463_am", "am", "minecraftDir");
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_71463_am", "an", "minecraftDir");
return client;
}
@@ -135,8 +147,8 @@ public class FMLRelauncher
{
FMLInjectionData.build(minecraftHome, classLoader);
FMLRelaunchLog.minecraftHome = minecraftHome;
FMLRelaunchLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft client:%s, server:%s loading", FMLInjectionData.major, FMLInjectionData.minor,
FMLInjectionData.rev, FMLInjectionData.build, FMLInjectionData.mccversion, FMLInjectionData.mcsversion);
FMLRelaunchLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s loading", FMLInjectionData.major, FMLInjectionData.minor,
FMLInjectionData.rev, FMLInjectionData.build, FMLInjectionData.mccversion, FMLInjectionData.mcpversion);
try
{
@@ -176,7 +188,7 @@ public class FMLRelauncher
if (str != null)
{
str = str.replace('/', File.separatorChar);
ReflectionHelper.setPrivateValue(mcMaster, null, new File(str), "minecraftDir", "am", "minecraftDir");
ReflectionHelper.setPrivateValue(mcMaster, null, new File(str), "minecraftDir", "an", "minecraftDir");
}
// We force minecraft to setup it's homedir very early on so we can
// inject stuff into it
@@ -189,7 +201,7 @@ public class FMLRelauncher
{
// Hmmm
}
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_71463_am", "am", "minecraftDir");
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_71463_am", "an", "minecraftDir");
return minecraftHome;
}
@@ -280,7 +292,7 @@ public class FMLRelauncher
popupWindow.setVisible(false);
popupWindow.dispose();
}
if (RelaunchLibraryManager.downloadMonitor.stopIt)
if (RelaunchLibraryManager.downloadMonitor.shouldStopIt())
{
System.exit(1);
}
@@ -0,0 +1,22 @@
package cpw.mods.fml.relauncher;
import javax.swing.JDialog;
public interface IDownloadDisplay
{
void resetProgress(int sizeGuess);
void setPokeThread(Thread currentThread);
void updateProgress(int fullLength);
boolean shouldStopIt();
void updateProgressString(String string, Object ... data);
Object makeDialog();
void makeHeadless();
}
@@ -18,12 +18,12 @@ public interface IFMLLoadingPlugin
/**
* Return a list of classes that implement the ILibrarySet interface
*
* @return
* @return a list of classes that implement the ILibrarySet interface
*/
String[] getLibraryRequestClass();
/**
* Return a list of classes that implements the IClassTransformer interface
* @return
* @return a list of classes that implements the IClassTransformer interface
*/
String[] getASMTransformerClass();
@@ -12,19 +12,19 @@ public interface ILibrarySet
/**
* Return a list of libraries available from a common location
*
* @return
* @return a list of libraries available from a common location
*/
String[] getLibraries();
/**
* Return the string encoded sha1 hash for each library in the returned list
*
* @return
* @return the string encoded sha1 hash for each library in the returned list
*/
String[] getHashes();
/**
* Return the root URL format string from which this library set can be obtained
* There needs to be a single %s string substitution which is the library name
* @return
* @return the root URL format string from which this library set can be obtained
*/
String getRootURL();
}
@@ -27,6 +27,7 @@ public class RelaunchClassLoader extends URLClassLoader
private List<IClassTransformer> transformers;
private Map<String, Class> cachedClasses;
private Set<String> invalidClasses;
private Set<String> classLoaderExceptions = new HashSet<String>();
private Set<String> transformerExceptions = new HashSet<String>();
@@ -37,6 +38,7 @@ public class RelaunchClassLoader extends URLClassLoader
this.sources = new ArrayList<URL>(Arrays.asList(sources));
this.parent = getClass().getClassLoader();
this.cachedClasses = new HashMap<String,Class>(1000);
this.invalidClasses = new HashSet<String>(1000);
this.transformers = new ArrayList<IClassTransformer>(2);
// ReflectionHelper.setPrivateValue(ClassLoader.class, null, this, "scl");
Thread.currentThread().setContextClassLoader(this);
@@ -49,9 +51,10 @@ public class RelaunchClassLoader extends URLClassLoader
// standard transformer exclusions
addTransformerExclusion("javax.");
addTransformerExclusion("cpw.mods.fml.");
addTransformerExclusion("org.objectweb.asm.");
addTransformerExclusion("com.google.common.");
addTransformerExclusion("cpw.mods.fml.common.asm.SideOnly");
addTransformerExclusion("cpw.mods.fml.common.Side");
}
public void registerTransformer(String transformerClassName)
@@ -68,6 +71,10 @@ public class RelaunchClassLoader extends URLClassLoader
@Override
public Class<?> findClass(String name) throws ClassNotFoundException
{
if (invalidClasses.contains(name))
{
throw new ClassNotFoundException(name);
}
// NEI/CCC compatibility code
if (excludedPackages.length != 0)
{
@@ -97,9 +104,17 @@ public class RelaunchClassLoader extends URLClassLoader
{
if (name.startsWith(st))
{
Class<?> cl = super.findClass(name);
cachedClasses.put(name, cl);
return cl;
try
{
Class<?> cl = super.findClass(name);
cachedClasses.put(name, cl);
return cl;
}
catch (ClassNotFoundException e)
{
invalidClasses.add(name);
throw e;
}
}
}
@@ -122,15 +137,11 @@ public class RelaunchClassLoader extends URLClassLoader
}
catch (Throwable e)
{
invalidClasses.add(name);
throw new ClassNotFoundException(name, e);
}
}
/**
* @param name
* @return
* @throws IOException
*/
public byte[] getClassBytes(String name) throws IOException
{
InputStream classStream = null;
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff. Show more