Compare commits

...
275 Commits
Author SHA1 Message Date
Christian 012a755bb9 Fix up patch properly. Also, fix md5s for the jars. 2013-03-22 01:48:21 -04:00
cpw 748eece456 Merge pull request #206 from mDiyo/patch-1
Fix missing block world rendering
2013-03-21 07:41:35 -07:00
mDiyo f709ce7579 Fix missing block world rendering 2013-03-21 07:10:55 -07:00
LexManos 33efc35b60 Merge MC 1.5.1 branch to master. 2013-03-21 04:10:30 -07:00
LexManos 687d3c059d Merge pull request #204 from agaricusb/fix-mcpdir
Fix install.py --mcp-dir option
2013-03-20 10:24:27 -07:00
LexManos aaf02ea2ac Updated for new PR client jar. 2013-03-20 08:59:25 -07:00
Agaricus 625da6492d Fix install.py --mcp-dir option. Fixes #204. 2013-03-19 21:42:04 -07:00
LexManos a573faf92d Someone derped up this function bad, revert name. 2013-03-19 17:54:06 -07:00
LexManos 9565529baf Updated to latest MCP and Minecraft 1.5.1 Pre-release. 2013-03-19 15:48:42 -07:00
LexManos 3c346247e1 Fix NPE with CoreMods who do not have the new MCVersion annotation. 2013-03-19 13:48:18 -07:00
Christian ce949e6099 Support simple mc version test in coremods, only effective through
jar loading.
Also, log some more data about the environment.
2013-03-17 23:40:12 -04:00
Christian 5e3af8ac0e Use the relaunch log, for class circularity safety. 2013-03-17 23:19:39 -04:00
Christian 5cc90f060c Fix the logger to treat newlines better, hopefully. Closes #199 2013-03-17 23:15:18 -04:00
LexManos 577b19c1cf Fix potential NPE in class loading and add extra debug information. 2013-03-17 11:54:26 -07:00
cpw 8905237306 Merge pull request #200 from bspkrs/patch-2
Added comments to note FML-only methods
2013-03-14 18:37:08 -07:00
Christian c5d5f4e516 Fix AllPublic access transformer not affecting methods. Should fix modloader
compatibility
2013-03-14 15:53:19 -04:00
bspkrs 24022ab6ba Added comments to note FML-only methods 2013-03-14 01:29:36 -03:00
LexManos 6370c242f0 OS X's python 2.6.1 has a bug in zipfile.extractall that makes it unzip directories as regular files. So switch to extract 2013-03-13 13:11:43 -07:00
LexManos 4762d4d8ef Allocate more ram {typically 256 is defailt} to fermflower, should fix decomplication issues on OSX 2013-03-13 13:11:10 -07:00
Christian 8f2dbf7046 Fix up stupid derp in IMC code: actually reset the IMC list after
each delivery. Fixes a bunch of mods. Sorry everyone.
2013-03-13 15:09:50 -04:00
Christian 23ea835fa7 Pass obfuscation status to coremods 2013-03-12 21:06:37 -04:00
Christian d88db6c0cf Fix up deep tree deobfuscation 2013-03-12 20:33:19 -04:00
LexManos c6dab815f4 Missed joined.exc, must fix scripts. 2013-03-12 15:12:49 -07:00
LexManos 7b722bfcd6 Update MCP for latest PR silent update. 2013-03-12 15:02:58 -07:00
LexManos a90504315e Readjust size of mods button when Minecraft Realms button is enabled. 2013-03-11 16:20:56 -07:00
Christian 3765ceb02d Update MCP, fixes the "broken texture packs" problem. 2013-03-11 16:31:26 -04:00
Christian dab22f5b74 Fix "0 mods" display when installed in forge. 2013-03-10 12:12:22 -04:00
Christian b301e8e4c1 Change type of connection queue to a concurrent linked queue. Much more efficient, hopefully. Closes #189 2013-03-10 01:25:36 -05:00
Christian f647929993 Merge branch 'master' of github.com:Uristqwerty/FML 2013-03-10 01:22:24 -05:00
Christian 984291cee9 Fix supertype parsing to handle null superclass (Hi Object!). Closes #160 2013-03-10 01:20:08 -05:00
Christian ac16845fc4 Fix demo mode crash. Closes #187 2013-03-10 01:15:16 -05:00
Christian 29edd242cd Fix coremods without a manifest crashing the game. Closes #181 2013-03-10 01:05:31 -05:00
Christian ca2d8bd834 Fix reflection helper: it needs to unmap the classname to find the field maps. 2013-03-09 17:58:18 -05:00
Christian 2a779ec328 Try a different way of remapping the fields. Should work because it's userspace, not relauncher space 2013-03-09 17:36:31 -05:00
Christian 591e65fa1a Revert "Use the reobfuscation maps in the reflection helper for field lookups: should help some reflection cases with the deobf."
This reverts commit 485db6be2e.
2013-03-09 17:32:11 -05:00
Christian 485db6be2e Use the reobfuscation maps in the reflection helper for field lookups: should help some reflection cases with the deobf. 2013-03-09 17:19:48 -05:00
Christian 25f3fcad46 Fix up some relauncher stuff: the vanilla applet works now, as do other applets. Deobf data is resolveable for them too. 2013-03-09 15:25:58 -05:00
LexManos 6bf7c9878c Fixed srg name of minecraftDir for runtime deobf. 2013-03-09 11:52:40 -08:00
Christian 95d0ff18cd Fix runtime deobfuscation for remapped inner classes 2013-03-09 14:06:39 -05:00
LexManos 1642bad402 Fix Multi-part entity children ID issue, mobs with custom spawning must deal with child ids themselves. 2013-03-09 10:07:41 -08:00
Christian 450dd8313c Fix up some small things, merging into mainline 2013-03-09 12:39:36 -05:00
Christian ebdb166ec8 Merge branch 'snapshot15' 2013-03-09 12:26:14 -05:00
Christian 1eba1dfdc0 Fix accidental commands.patch overwrite 2013-03-09 12:25:24 -05:00
Christian 368a2245ef Merge branch 'snapshot15' 2013-03-09 12:19:37 -05:00
Christian 58ee06ea8e Some fixes for the snapshot 2013-03-09 12:10:13 -05:00
Christian 62f5adf8e2 Revert "Fix modlist to use the new texture binding functions, i think"
This reverts commit 48544db690.

Conflicts:
	client/cpw/mods/fml/client/GuiModList.java
2013-03-09 11:12:12 -05:00
cpw fe1623a36a Merge pull request #195 from RainWarrior/snapshot15
Fixes GameRegistry.registerBlock
2013-03-09 07:07:48 -08:00
RainWarrior 889efc1c0a Fixes GameRegistry.registerBlock 2013-03-09 14:06:12 +04:00
Christian 0419b9d975 Update MCP info for latest 2013-03-08 23:14:30 -05:00
Christian f1c6bdd57d Support the MCP format of partial reobfuscation for portability. Ensure modloader-like compatibility 2013-03-08 23:13:39 -05:00
LexManos b3e854a15d Update for new MCP with srg reobf. 2013-03-08 18:11:44 -08:00
Christian 80a40c03e6 Update to MCP 1.5 and minecraft 1.5. 2013-03-08 20:36:05 -05:00
Christian 5bfaf7c170 Global object registry, also, support the new itemblockwithmetadata constructor 2013-03-08 13:17:12 -05:00
Christian 2d98835db8 Scala support!
It's still primitive, I hope that people will like it. I do :)
2013-03-07 20:22:24 -05:00
Christian 81c6421f84 Tweak license text- any osi licensed project can use the asm transformer code 2013-03-07 19:41:52 -05:00
Christian 6eeae8c49f Fix up state transition derp when the server crashes with an error- it shouldn't double-derp 2013-03-07 19:37:52 -05:00
Christian c42a210140 Strip deprecated code 2013-03-07 19:33:34 -05:00
Christian a723aa6860 Refresh copyright notices on everything 2013-03-07 19:25:48 -05:00
Christian e9ff699c2d Refresh the renderengine after modloading is complete. Should fix issues with out-of-place texture registration by mods. 2013-03-07 19:02:26 -05:00
Christian abe4f73a9a FIX massive performance issue with FML. Thanks to @sfPlayer1 for finding
this epic derp on my part!
2013-03-06 14:00:28 -05:00
Christian 74fffc6fdc Update next render to 40 2013-03-04 22:52:24 -05:00
Christian debbdc00be Capture Minecraft logs into FML logging 2013-03-04 22:45:58 -05:00
LexManos aed2cc446a Force file name encoding to UTF-8, caused different zips on different systems. 2013-03-04 18:19:06 -08:00
LexManos e74087ee43 Ignore again, testing submodule. 2013-03-03 11:54:53 -08:00
LexManos f329084f1f Ignore this commit. 2013-03-03 11:52:47 -08:00
Christian 33cd9ad0fe Ignore deobf data 2013-03-03 14:04:41 -05:00
Christian ce819ac143 Force the joined.srg timestamp to zero- avoids annoying sha1 differences 2013-03-02 15:06:13 -05:00
Christian f0495a8abc Don't enforce signatures on minecraft classes 2013-03-02 14:48:08 -05:00
Christian a696db5a21 Update MCP URL for snapshot 2013-03-02 10:56:25 -05:00
Christian fcdbb4f5b3 Fix up runtime deobfuscation. Working well now. 2013-03-02 10:46:32 -05:00
Christian e105337ff4 Build, and use, MC versioned deobfuscation data 2013-03-02 10:30:45 -05:00
Christian f52e2112dd Merge branch 'runtimedeobf' into snapshot15 2013-03-02 10:04:06 -05:00
Christian 945d927fa0 Add in build for deobf data zip file, update for official mcp 7.39 2013-03-02 10:02:02 -05:00
LexManos 2ee6946824 Fix exc for renamed Behavior classes. 2013-03-02 00:48:44 -08:00
LexManos e08c43366a Actually remove classes from the csv when removed, and moved All EntityMinecart entities to net.minecraft.entity.item 2013-03-02 00:12:31 -08:00
LexManos c508004429 Delete unneeded patch 2013-03-02 00:11:48 -08:00
LexManos 21af85323a Readd ignore for argo and bouncycastle, needed for our replacement to work properly. 2013-03-02 00:11:33 -08:00
Christian 3410242f03 Update FML to 1.5 snapshot 13w09c 2013-03-02 02:06:32 -05:00
Christian 9b9c46d93b Tweaks to runtime deobf 2013-03-02 01:49:45 -05:00
LexManos de8e76c7fd Update distribuited eclipse's classpath for updated libraries. 2013-02-28 04:22:34 -08:00
LexManos 47b5e99b6f Fix crash in GuiModList for mod logo files, logo is not rendering for unknow reason. 2013-02-27 22:41:00 -08:00
LexManos 1a465b33f5 Fix bug in rename_vars where certian items would fail to be renamed. 2013-02-27 22:40:15 -08:00
LexManos 8e7956397d Just enable server side compile, and warn not to cmplain to us. 2013-02-26 14:54:18 -08:00
LexManos 86a9c7d359 Fixup reobfusication of server code if present. 2013-02-26 14:34:51 -08:00
Christian 6a581803a9 Tweak IASM hook api. You can return multiple classes now. 2013-02-26 15:04:45 -05:00
Christian b4e0c709c5 Merge branch 'runtimedeobf' into snapshot15 2013-02-26 10:24:03 -05:00
Christian f3458456a2 Change readFully to actually read a bunch of bytes at once now. Thanks to nallar and aartbluestoke for the suggestion to
revisit this..
2013-02-26 01:07:14 -05:00
Christian dcb15a587c Clean up more junk 2013-02-26 00:28:12 -05:00
Christian 937e9a0169 Update libs for 1.5. Lots of new libs. 2013-02-26 00:16:57 -05:00
Christian decd230ac1 Fix renderengine patch *sigh* 2013-02-25 22:06:20 -05:00
Christian 5347caa1c4 Merge branch 'master' into snapshot15
Conflicts:
	patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch
2013-02-25 21:53:56 -05:00
Christian 52f6a674ea Merge branch 'master' into snapshot15
Conflicts:
	client/cpw/mods/fml/client/TextureFXManager.java
2013-02-25 21:18:08 -05:00
cpw a16c61f7ba Merge pull request #188 from immibis/master
Console log thread should be a daemon thread.
2013-02-22 22:35:14 -08:00
immibis 67f12d6dec Console log thread should be a daemon thread. 2013-02-23 19:27:16 +13:00
LexManos bad55cacfa Fix sprite map issue. 2013-02-22 14:45:25 -08:00
Christian a6e979b311 Merge branch 'master' into runtimedeobf 2013-02-17 16:29:13 -05:00
Christian ce68456f97 Fix Language Registry, closes #163 2013-02-17 16:28:54 -05:00
Christian 29e59438c5 Fix Language Registry, closes #163 2013-02-17 16:22:58 -05:00
Christian 10d4acfad2 Merge branch 'master' into runtimedeobf 2013-02-16 14:28:29 -05:00
LexManos 1c3dc132cb Option to disable renaming for srgnames. 2013-02-08 14:50:17 -08:00
Christian cd96718339 Fix HD mob skins, FINALLY!!!
Stupid eyes are stupid.
2013-02-06 01:25:46 -05:00
Christian 22dbe411d9 Fix up mistake that broke all modloading. Nice. 2013-02-04 10:58:48 -05:00
Christian a99d110fff Fix some class naming and packaging issues, pending an MCP update
for the same
2013-02-02 10:54:48 -05:00
Christian f21929b7d1 Update for MCP 7.34 and MC 13w05b 2013-02-01 23:05:23 -05:00
Christian 5d78b310da MCP compilation works 2013-02-01 22:42:28 -05:00
Christian 549b6fd535 IMC tweaks: runtimeMessages now work (thanks for all that testing for this much requested feature!)
and IMCEvent will no longer remove messages if no one gets them, so you can do
just manual runtime polling, if you wish.
2013-01-31 13:39:53 -05:00
Christian 9fafdc1695 More logging tweaks. You can probably configure individual mod log files if you wish now 2013-01-30 20:55:12 -05:00
Christian f169f7c92f A log of logging cleanup. FML will now read logging.properties to configure logging channels a couple of times during startup.
You should be able to filter a lot of messages based on things like modid and certain FML related features that can be noisy
like item tracking.
Should close #175
2013-01-30 18:57:21 -05:00
Christian b9ccadb2f1 Final part of the deobfuscation data setup- fields are now deobfuscated as well.
All that remains, is to figure out what and how to distribute the deobfuscation data itself.
2013-01-28 17:48:44 -05:00
Christian f00650481b Read the joined.srg file directly from lib/deobfuscation_data.zip now. Still debating distribution method. 2013-01-28 17:39:22 -05:00
Christian 5d4c2fed88 Now actually works for mods, somewhat. It currently generates access violations for
ModLoader mods that presume access to fields that are not actually accessible from
a different package.
2013-01-27 22:42:36 -05:00
Christian 66a81e7dbe Method deobfuscation now works 2013-01-27 21:50:08 -05:00
Christian 6b5a433f65 Working to read class names and remap them at runtime. 2013-01-27 17:09:00 -05:00
Christian b5d5c95b33 First draft runtime deobf 2013-01-27 15:55:37 -05:00
Christian 3ac891fa5a Try and handle "death on startup" a bit cleaner 2013-01-27 15:54:36 -05:00
Christian 2dc0189179 Deprecate the old GUI ticktype. They're dead and have been for some time. 2013-01-24 17:29:46 -05:00
Christian dd98784262 Tweak a method signature 2013-01-24 10:23:36 -05:00
LexManos 1c9a51098b Add parameters to FML install to enable/disable certian aspects. Applying patches, running transformer/merger, and decompiling server. 2013-01-24 03:08:19 -08:00
Christian d075daf00e Merge branch 'master' into snapshot15
Fix up compilation and patching errors

Conflicts:
	common/cpw/mods/fml/common/registry/GameRegistry.java
	conf/joined.srg
	conf/params.csv
	conf/version.cfg
	patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch
2013-01-22 15:21:22 -05:00
Christian 1bd6847bc8 Fix up packages.csv ordering for easier diffing 2013-01-22 14:43:27 -05:00
Christian dd832f2a88 Update for MCP7.30c - fixes redstone rendering issues 2013-01-22 14:40:09 -05:00
Christian aebf6eb168 Add in a registry method to allow for alternative TileEntity names- they will be used to support
loading maps containing the older definitions.
2013-01-22 13:11:32 -05:00
Christian 8921cfe061 Remember to add the new patches! 2013-01-22 09:32:53 -05:00
Christian cd67596d57 The "ServerStarting" event should now properly crash the server if it fails,
so the client will properly exit. Also, added in a "pre-server-start" event
that fires before the worlds are loaded for a save, just for you immibis.
2013-01-22 09:17:04 -05:00
Christian e1c6630569 Javadoc cleanup 2013-01-21 21:37:29 -05:00
Christian 5ce4e31855 Fix breaking change 2013-01-20 17:54:56 -05:00
Christian a99c488d49 Merge branch 'patch-1' of https://github.com/bspkrs/FML into gh-updates 2013-01-20 11:31:47 -05:00
Christian 94282c5575 Merge branch 'FMLLogFormatter' of https://github.com/donington/FML into gh-updates 2013-01-20 11:31:24 -05:00
Christian 7ad8529390 Update MCP to MCP7.26a and refresh MCP names 2013-01-20 10:30:36 -05:00
Christian 15534edce4 Update address of the FML repository to the new location in all the files 2013-01-18 21:26:43 -05:00
bspkrs aa822e32af Fix logical error in comment text 2013-01-16 23:49:09 -05:00
Christian a14ab913a9 Update license text to make clear that FML is not a way to sidestep
MCP licensing.
2013-01-15 16:54:26 -05:00
Christian 0165742a30 Fix mcp conf md5 signatures for the snapshot 2013-01-12 14:25:03 -05:00
donington 26a5b316de FMLLogFormatter: dynamic log level name
FMLLogFormatter now uses getLocalizedName or getName for log level name

Changes to be committed:
	modified:   common/cpw/mods/fml/relauncher/FMLLogFormatter.java
2013-01-12 00:42:36 -05:00
Christian 2140cd8cb6 Temporary hosting 2013-01-12 00:38:42 -05:00
Christian 4a6245a215 Another packaging update. I think we're done now. 2013-01-12 00:33:32 -05:00
Christian 48544db690 Fix modlist to use the new texture binding functions, i think 2013-01-12 00:27:11 -05:00
Christian 2c89b3def3 A couple of packaging tweaks, clean up more junk. It may come back but for now it's gone 2013-01-12 00:17:35 -05:00
Christian 5689182088 Delete old patches not needed anymore 2013-01-11 23:53:14 -05:00
Christian 4a1f4b90fd Initial patch update for snapshot 2013-01-11 23:47:05 -05:00
Christian f2d42d1134 Initial setup for snapshot- the client compiles, but patches fail to apply. 2013-01-11 22:49:09 -05:00
LexManos 51e7606e74 Updated patches for new JAD style names. 2013-01-11 13:16:40 -08:00
LexManos 723c2d98eb FML will now rename local variables to have JAD-style names instead of FernFlower var## names. New script to do this, to allow for modders to run it over there own code: python rename_vars.py -mcp [folders to rename]... 2013-01-11 13:16:23 -08:00
Christian 7dee072e1a Fix incorrect end length calculation. Closes #161 Thanks BStramke! 2013-01-11 09:41:47 -05:00
Christian 3e18c4160f Fix LanguageRegistry loading files in UTF-8 format. loadLocalization should work for non-xml in
all languages now (assumes UTF-8)
2013-01-08 08:46:50 -05:00
cpw 513ad19187 Merge pull request #158 from CovertJaguar/patch-2
Added an accessor for villagers
2013-01-08 05:36:45 -08:00
CovertJaguar eabede2203 Added an accessor for villagers 2013-01-07 14:55:17 -08:00
LexManos b22dbc12a2 New python script to update java files for new package names. Usage: paython update_packages.py --mcp-dir <mcp folder> [Folders To Repackage] 2013-01-06 22:10:19 -08:00
LexManos 708e86adfb New python script for signing partial jar files. See comments inside for details. 2013-01-06 22:09:12 -08:00
Christian 6f1b762c9d Move server stopped *after* the server has actually stopped. *sigh* 2012-12-31 01:20:35 -05:00
Christian d9bfb29d6c Add in a "server stopped" event 2012-12-30 23:52:38 -05:00
Christian 6fc7bc4941 Add in some classloader debugging information: use fml.debugClassLoading=true as a system property
to track down problems with classes not being found or loading erratically.
2012-12-30 21:32:37 -05:00
Christian fb701cdc5e Revert MCP name change for canConnectRedstone - it conflicts with a forge method of the same name and breaks 1.4.6 to 1.4.7 compatibility 2012-12-29 00:00:24 -05:00
Christian f7cc50b521 Update for MC 1.4.7 2012-12-28 10:07:53 -05:00
Christian 1a232cf766 Fix multiple GUI containers for ML containers. Sorry ultimatechest that
this fix took so long, a bug report at github.com/cpw/FML would help,
next time ;)
2012-12-27 23:00:52 -05:00
Christian 853f54bcc2 Log if there's a problem reading the class bytes 2012-12-27 23:00:37 -05:00
LexManos 127be2237d Fix NPE in fingerprint loading, and pass expectged fingerprint to FMLFingerprintViolationEvent 2012-12-25 15:59:30 -08:00
Christian 7e6456d7cd Fix a message delivery issue in IMC 2012-12-24 09:41:22 -05:00
Christian 664ebda599 Some tweaks for signing and ID matching 2012-12-23 22:27:26 -05:00
LexManos 9b4a225ad2 Remove unneeded file 2012-12-20 14:30:59 -08:00
LexManos 6c59fa2d2c Fixed placement of onConnectionClosed callback. 2012-12-20 14:30:41 -08:00
LexManos 5736d850f0 MCP will reobf classes with reserved names in windows to a legal file name. And FML will try to read these classes over the default ones. 2012-12-19 19:10:00 -08:00
LexManos 127d6ee8ac Output obfed files with reserved windows names to _NAME.class 2012-12-19 18:12:11 -08:00
LexManos 2055543042 Add quotes around javac command. 2012-12-19 02:58:09 -08:00
Christian 40e57a26a9 Update MCP to newer version
Fix fingerprint fire
2012-12-18 16:43:48 -05:00
Christian d604e44195 InterModComms now supports a runtime polling based model for inter-mod comms at
runtime.
Deprecate method that shouldn't be used. COPY it's content to your mod. Don't CALL it.
2012-12-18 13:58:57 -05:00
Christian 8b7778ccb6 Don't be as alarming about item overwrites. 2012-12-18 08:33:46 -05:00
Christian 7e30814ecb Added configuration file which allows modids to ignore ID validation checking. IT WILL CRASH YOUR GAME in 99.999% of cases.
Immibis is a whingy ass. And TinyTimRob too. Now STFU and GTFO. closes #510 for ever.
2012-12-18 08:15:46 -05:00
LexManos e5b1dfb74c Dixed ev eclipse worksapce, now references BC. 2012-12-18 05:10:32 -08:00
LexManos 27bc77363e Added client src folder to classpath for startclient/startserver. 2012-12-18 05:06:20 -08:00
LexManos 506b73d0a0 Removed hardcoded additions 2012-12-18 05:05:25 -08:00
Christian 20337b6e8a Update to MC 1.4.6 2012-12-17 21:48:29 -05:00
Christian 33ff87d8d9 Fix build script 2012-12-17 17:56:00 -05:00
Christian af06bbd373 more 1.4.6 tweaks 2012-12-17 17:00:54 -05:00
Christian 92a47ace8b More work 2012-12-17 14:30:51 -05:00
Christian f285ac369a Merge branch 'securityupdate' 2012-12-17 11:46:47 -05:00
Christian 68e76c273a Merge branch 'master' into securityupdate 2012-12-17 11:46:27 -05:00
Christian e98c311a2c Fix up handling null names. *sigh* 2012-12-17 10:29:54 -05:00
Christian 293edb316e Some tweaks to item identification. The GameRegistry methods are deprecated
to encourage you to use the new named ones instead. These will force a
name on the item/block, allowing for stronger matching than "sequential guessing"
2012-12-16 22:57:11 -05:00
Christian 2d4465eaf7 More fixes 2012-12-16 21:22:55 -05:00
LexManos 9266ff394a Updated MCP download mirriors upon Searge's request. 2012-12-16 05:35:46 -08:00
Christian bbfd85ed1e Move Side and SideOnly to relauncher package 2012-12-15 23:21:26 -05:00
Christian 6ecc2303f4 Fix newline fun 2012-12-15 22:37:32 -05:00
Christian d35cfda798 More stuff for the thingy 2012-12-15 22:30:16 -05:00
Christian cffa2a92a6 Remove old NEI/CCC compatibility code and other classloading tweaks 2012-12-15 20:40:08 -05:00
Uristqwerty 179c504746 Simplify logic in tick start/end
Change the EnumSet equivalent of "A &= ~ new(~B)" to "A &= B".
This eliminates the need for one temporary object in a frequently called loop, and reduces the number of methods that need to be invoked.
2012-12-14 04:14:17 -05:00
LexManos 31695d5ec1 Fix var name messup 2012-12-13 00:22:30 -08:00
LexManos bfb3020505 Update released eclipse project to link BouncyCastle 2012-12-12 23:44:28 -08:00
Christian 22a88ea2e4 Change ID management slightly. IDs are tracked by block type for itemblock items now. This means servers will need to update.
Also, ordinal rearrangements within a mod will no longer trigger server disconnection, though a warning will still be logged.
2012-12-12 19:31:05 -05:00
Christian 0423fa5885 Fix possible escape leakage.. 2012-12-12 19:31:05 -05:00
LexManos d17fbb527f More robust eclipse workspace replacement 2012-12-12 14:31:07 -08:00
LexManos d40bb0fe32 Kill decompile if astyle is not found and set execution bits on mcp .sh files and astyle-osx 2012-12-11 21:47:45 -08:00
Christian a513060a81 Change to download bouncy castle as well. We also finally properly use the downloaded libs
even in vanilla code!
2012-12-11 22:37:07 -05:00
Christian 8e594a347c Remove extraneous patch file 2012-12-11 20:37:12 -05:00
Christian 9af365edcc Merge branch 'repackage'
Conflicts:
	build.xml
	client/cpw/mods/fml/client/FMLClientHandler.java
	client/cpw/mods/fml/client/GuiIdMismatchScreen.java
	common/cpw/mods/fml/common/FMLCommonHandler.java
	common/cpw/mods/fml/common/IFMLSidedHandler.java
	common/cpw/mods/fml/common/network/ModIdMapPacket.java
	common/cpw/mods/fml/common/network/ModListResponsePacket.java
	common/cpw/mods/fml/common/registry/GameData.java
	common/cpw/mods/fml/common/registry/GameRegistry.java
	common/cpw/mods/fml/common/registry/ItemData.java
	common/cpw/mods/fml/common/registry/LanguageRegistry.java
	common/cpw/mods/fml/server/FMLServerHandler.java
	install/fml.py
	patches/minecraft/net/minecraft/client/Minecraft.java.patch
	patches/minecraft/net/minecraft/server/MinecraftServer.java.patch
	patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch
2012-12-11 14:58:38 -05:00
Christian 70554d6a2b Merge branch 'repackage' of github.com:cpw/FML into repackage
Conflicts:
	common/cpw/mods/fml/common/registry/GameData.java
2012-12-11 14:49:23 -05:00
cpw eb84f52493 Merge pull request #145 from pahimar/master
More logging of loading files in LanguageRegistry
2012-12-11 08:28:39 -08:00
pahimar d074830d95 Update common/cpw/mods/fml/common/registry/LanguageRegistry.java
Add in logging of what file failed to be loaded
2012-12-11 11:27:05 -05:00
LexManos f7fe9ebeb2 Fix patches, rebased with HEAD 2012-12-10 15:37:48 -08:00
LexManos b2c8f37aec Remade python dist as 32-bit. 2012-12-10 15:26:15 -08:00
Christian a5bcccab59 Fixing id map generation - should validate correctly now 2012-12-10 15:26:13 -08:00
LexManos a11f368b62 Reenabled replacement of the eclipse folder. 2012-12-10 14:56:23 -08:00
LexManos 59656b004b Remade python dist as 32-bit. 2012-12-10 14:56:05 -08:00
Christian ff8cb67a99 Fixing id map generation - should validate correctly now 2012-12-09 22:24:16 -05:00
Christian fa5256c8a7 Fix up idmap code 2012-12-09 22:01:13 -05:00
LexManos 4b19987ee6 Some derp protection in the workspace copy. 2012-12-09 02:20:21 -08:00
LexManos 9f43303073 Removed remaining references to src/common
Fixed eclipse workspace replacemnt on source dist
Cleanup some outputs
2012-12-09 02:10:28 -08:00
LexManos a20958fb56 Updated build script to not use the mcp common directory as it doesn't exist anymore. 2012-12-08 21:41:51 -08:00
LexManos 8c71098081 Fished moving out the rest of the default packaged classes to aproperiate packages. Updated patches and code to reflect. 2012-12-08 21:41:16 -08:00
LexManos a3a5b44acb Updated the update_packages script to support different mcp locations 2012-12-08 21:40:39 -08:00
LexManos 0473273709 Update fml_marker.cfg, Minecraft is now runnable! 2012-12-08 20:25:29 -08:00
LexManos bf492f32f9 Update all imports for repackaging. Branch is compileable. 2012-12-08 20:21:03 -08:00
LexManos 4744677646 Some stragler patches 2012-12-08 19:34:35 -08:00
LexManos f0af2e4ef5 Updated patches to new packages. 2012-12-08 19:33:29 -08:00
LexManos c7f763d6f0 Give new classes a distinct package to be moved from. 2012-12-08 17:50:14 -08:00
LexManos 563b8d1215 Fixed 0.tree to actually refresh the workspace. 2012-12-08 17:35:11 -08:00
LexManos 221493453f Remerged branch, and updated dev eclipse workspace. 2012-12-08 17:08:51 -08:00
Christian 86c928430a Add in storage, detection and validation of the ItemID array between client and server
and also for world saves. May help with item configuration issues.
2012-12-08 17:05:18 -08:00
Christian cd0a0e51d5 Add a modid on the mods list, should make it easier to do things like forge chunkloading config 2012-12-08 16:46:47 -08:00
Christian 66ff95f9d7 Fix build eclipse extractor task 2012-12-08 16:46:46 -08:00
Christian 8ad172295f Add in storage, detection and validation of the ItemID array between client and server
and also for world saves. May help with item configuration issues.
2012-12-07 01:52:16 -05:00
Christian 26a2ef5995 Add a modid on the mods list, should make it easier to do things like forge chunkloading config 2012-12-04 18:08:27 -05:00
Christian b4e3490fa1 Fix build eclipse extractor task 2012-12-04 18:04:45 -05:00
Christian 828341f987 Fix typo 2012-12-04 01:30:38 -05:00
Christian bc03fbb3be Merge branch 'master' into repackage
Conflicts:
	eclipse/Clean/.classpath
	eclipse/Clean/.project
	eclipse/FML/.classpath
	eclipse/FML/.project
	install/fml.py
2012-12-04 01:24:50 -05:00
Christian 7a8dae5e35 Try and make branch non-derpy 2012-12-03 23:47:23 -05:00
Christian d3c0e1f589 Try defaulting branch differently 2012-12-03 22:26:12 -05:00
Christian 9c77d3f25b Remove old eclipse workspace and ship/extract as a zip file (use ant setupenvironment)
Fix up install.py for forge multibranch changes
2012-12-03 19:55:37 -05:00
LexManos 6371e9b71e Assume Forge is the parent directory when checking for AT configs. 2012-12-03 16:53:03 -08:00
Christian 578ef5cfeb Merge branch 'master' into repackage
Conflicts:
	patches/minecraft/net/minecraft/client/EntityFX.java.patch
2012-12-03 17:31:29 -05:00
Christian 516954e6f9 Name both zips the same format 2012-12-03 08:38:20 -05:00
Christian 1151d5c3e3 Last part of branch name only please 2012-12-03 08:30:44 -05:00
Christian 25f1ddac30 Try and get a valid branch name on jenkins 2012-12-03 08:23:21 -05:00
Christian 39a146f8e6 Clean up build.xml script- support outputting a branched jar file 2012-12-03 08:13:20 -05:00
LexManos 037dcaefea Small derp in install.py 2012-12-02 20:26:36 -08:00
LexManos 01d6da3a90 Try marking python as binary. 2012-12-02 20:19:55 -08:00
LexManos 8b2665980d FML will now attempt to download MCP as part of the install process
Now shipping a py2exe version of python for windows.
Linux/Macs should come with python pre-installed so they do not have a distrabution here.
2012-12-02 19:59:22 -08:00
LexManos 42b3e6ad56 Windows Python distrabution created using py2exe, thanks Fesh0r for the script. 2012-12-02 19:56:17 -08:00
LexManos e709ab8a70 Marked more spots in gui/items bitmask as being free. 2012-11-21 15:58:04 -08:00
LexManos 501409d1fb Delete duplicate file 2012-11-20 18:07:39 -08:00
LexManos 0fb3a34235 Finished repackaging net.minecraft.* net.minecraft.client is left 2012-11-20 17:58:22 -08:00
LexManos e4ba1f863e More re-packaging, got most classes out of the default package. 2012-11-20 17:22:55 -08:00
Christian 1f5c58b723 Fix up MCP version 2012-11-20 08:47:14 -05:00
Christian 61e4db2c3b Merge joined.exc add update howto 2012-11-20 08:38:33 -05:00
Christian 5efc1eb34c Revert "Fix MC-2497 - derpy torch flames. Moved from forge. Everyone should benefit."
This reverts commit fa567014a5.
2012-11-20 08:27:13 -05:00
LexManos 96c6f91201 Remove common folder from projects 2012-11-20 03:15:45 -08:00
LexManos 62e69a2804 Move IBossDisplayData to shared 2012-11-20 03:15:16 -08:00
LexManos e9352d2675 First half of new patches 2012-11-20 03:15:01 -08:00
LexManos ee6abdf28d Update FML imports 2012-11-20 03:14:36 -08:00
LexManos 968ee7ab09 Inital script side commit for MC source repackaging done. 2012-11-20 01:55:41 -08:00
LexManos 3b3600d44f Modified merger to just consider all server classes as common. And moved the defnition of CodecMus to the config. 2012-11-19 17:45:53 -08:00
LexManos edcc5ca554 Forgot mcp.cfg 2012-11-19 15:47:18 -08:00
LexManos ca79dfe298 Updated to 1.4.5b 2012-11-19 15:35:08 -08:00
LexManos 5945279b8b Fix python error 2012-11-19 15:03:13 -08:00
LexManos 57bf64318b Modified decompile so that we do not have to decompile the server, saves time. 2012-11-19 15:01:04 -08:00
LexManos d9d0a46809 Cleaned up some tabs 2012-11-19 15:00:11 -08:00
LexManos 2fac644914 Change usage of ZipFile, fixes issues with Mac's default instation of python. Also cleaned the python a little bit. 2012-11-19 13:33:22 -08:00
Christian 570592b24b Attempt to fix a possible comodification risk 2012-11-18 20:40:48 -05:00
Christian fde94144ec Change texturebinding to use the textureId directly rather than iconIndex
to determine if it needs to rebind the texture sheet
2012-11-18 08:45:25 -05:00
Christian f348496c10 Fix mod display list. Shouldn't be derpy anymore. 2012-11-17 23:51:14 -05:00
Christian a5c31b5365 Fix World patch- workaround no longer required and leftovers are bad. 2012-11-17 23:44:53 -05:00
LexManos 2dc3f0ddef Cleaned up the AT config updater, should work for any setup of the MCP workspace now. 2012-11-17 19:08:47 -08:00
Christian fa567014a5 Fix MC-2497 - derpy torch flames. Moved from forge. Everyone should benefit. 2012-11-16 22:50:21 -05:00
Christian 96935bb122 Fix an NPE in TileEntity trying to generate a crash report. Make suspicious classes just return the obvious.
Fix NPE for FML crash report on server. Clean up dead patches.
2012-11-16 22:50:00 -05:00
Christian 43d3042dff Clean up a patch 2012-11-16 16:49:44 -05:00
Christian fec221f8a6 Update FML for MC 1.4.5 2012-11-16 16:31:06 -05:00
LexManos b0f0635eb3 Fix for ModLoader static overrides not displaying. 2012-11-15 14:08:41 -08:00
Christian 23a25131b0 Fix up derpy file name handling: closes #127
Fix up duping childmods: closes #126
FMLPreinitializationEvent now offers a getLogger() that'll return your mod a personalized logger instance
2012-11-12 17:54:21 -05:00
LexManos a6eaa2bebc Fix spelling issue. 2012-11-08 21:01:31 -08:00
LexManos c6a0741379 FML setup should now download and verify all the minecraft files needed to run MCP. 2012-11-08 17:54:05 -08:00
Christian 5a1930e2d6 Small fix to some MCP metadata for pre2 2012-11-08 20:34:45 -05:00
Christian 418deba5bf Update to MC 1.4.4 2012-11-08 17:55:20 -05:00
Christian 4ff2cff3c0 Fix bug when a modloader mod is run on a dedicated server and has a
connection handler assigned to it. Hi SmartMoving! Perhaps you should try
@Mod instead of BaseMod?
2012-11-04 10:57:49 -05:00
Christian bd2123cf9d Clean up some patch fuzz 2012-11-02 17:32:39 -04:00
Christian c2a603c910 Update joined.exc file from latest conf 2012-11-02 17:23:54 -04:00
364 changed files with 32326 additions and 22492 deletions

No files matched your search

+5 -2
View File
@@ -1,7 +1,10 @@
* text eol=lf
*.bat text eol=crlf
*.patch text
*.patch text eol=lf
*.png binary
*.exe binary
*.dll binary
*.zip binary
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.py text eol=lf
+4
View File
@@ -8,3 +8,7 @@
fmlbranding.properties
/fernflower.zip
/commands.py.bck
/mcp*.zip
/mcp
/eclipse
/deobfuscation_data*.zip
+13 -3
View File
@@ -1,7 +1,7 @@
This minecraft mod, Forge Mod Loader, including all parts herein, is licensed
under the GNU LGPL v2.1 or later.
This minecraft mod, Forge Mod Loader, including all parts herein except as noted below,
is licensed under the GNU LGPL v2.1 or later.
Homepage: https://github.com/cpw/FML
Homepage: https://github.com/MinecraftForge/FML
This software includes portions from the Apache Maven project at
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
@@ -9,6 +9,16 @@ included based on guidelines at
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
with notices intact. The only change is a non-functional change of package name.
=== MCP Data ===
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
from them. The license to MCP data is not transitive - distribution of this data by
third parties requires independent licensing from the MCP team. This data is not
redistributable without permission from the MCP team.
=== Sharing ===
License is granted to redistribute the ASM transformer code (common/cpw/mods/fml/common/asm/ and subdirectories)
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
========
GNU LESSER GENERAL PUBLIC LICENSE
+95 -96
View File
@@ -9,20 +9,6 @@
====================================================================== -->
<project name="FML" default="jenkinsbuild">
<description>The Forge Mod Loader</description>
<macrodef name="side">
<attribute name="prop" />
<attribute name="src" />
<attribute name="side" />
<sequential>
<property name="@{prop}" value="${@{side}.@{src}}" />
<condition property="is.client">
<equals arg1="@{side}" arg2="client" />
</condition>
<condition property="is.server">
<equals arg1="@{side}" arg2="server" />
</condition>
</sequential>
</macrodef>
<target name="writeversion" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
<arg value="${basedir}/getversion.py" />
@@ -30,6 +16,7 @@
</exec>
<propertyfile file="fmlversion.properties">
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
<entry key="fmlbuild.deobfuscation.hash" type="string" value="${deobf.checksum}"/>
</propertyfile>
</target>
@@ -38,21 +25,23 @@
<format pattern="yyMMddHHmmss" property="timestamp" />
</tstamp>
<property environment="env" />
<property file="fmlbuild.properties" />
<property name="modname" value="fml" />
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
<condition property="mcp.home" value="${env.WORKSPACE}/mcp" else="${basedir}/mcp">
<isset property="env.WORKSPACE" />
</condition>
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
<property name="fml.python.dir" location="${basedir}/python" />
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
<os family="Windows" />
</condition>
<condition property="mcp.exists">
<available file="${mcp.home}/runtime/commands.py"/>
</condition>
<condition property="signature.exists">
<available file="${env.JENKINS_HOME}/fmlsigned.properties"/>
</condition>
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="mcp.srcdir" location="${mcp.home}/src" />
<property name="common.mcp.srcdir" location="${mcp.srcdir}/common" />
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
@@ -65,6 +54,7 @@
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
<isset property="env.BUILD_NUMBER" />
</condition>
<available file="eclipse" property="eclipse.exists"/>
</target>
<target name="makeversion" depends="buildenvsetup">
@@ -74,18 +64,23 @@
<property name="version.major" value="${fmlbuild.major.number}" />
<property name="version.minor" value="${fmlbuild.minor.number}" />
<property name="version.rev" value="${fmlbuild.revision.number}" />
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
<property name="version.branch" value="${fmlbuild.branch}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
</target>
<target name="clean" depends="buildenvsetup">
<target name="makeclean" depends="buildenvsetup" if="mcp.exists">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
</target>
<target name="clean" depends="buildenvsetup,makeclean" if="mcp.exists">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/decompile.py" />
<arg value="-d" />
<arg value="-n" />
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />
<arg value="${basedir}" />
</exec>
</target>
@@ -93,16 +88,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 +109,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">
@@ -130,52 +125,29 @@
</target>
<target name="merge-common">
<copy todir="${common.mcp.srcdir}" overwrite="true" verbose="true">
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
<fileset dir="${common.src.dir}" includes="**/*.java" />
</copy>
</target>
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
<target name="build-client" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion"/>
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<target name="extract-built-jar">
<side prop="output" src="mcp.obfoutput" side="${side}" />
<property name="jarname" value="${modname}-${side}-${version}" />
<mkdir dir="${basedir}/target" />
<zip destfile="${basedir}/target/${jarname}.zip">
<fileset dir="${output}" includes="**/*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="README-fml.txt" />
</mappedresources>
</zip>
</target>
<target name="build-universal" depends="build-client">
<property name="universal.jarname" value="${modname}-universal-${version}" />
<mkdir dir="${basedir}/target" />
<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" />
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class"/>
</jar>
<antcall target="signjar"/>
<zip update="true" destfile="${basedir}/target/${universal.jarname}.zip" >
<fileset dir="${client.mcp.obfoutput}" includes="*.class"/>
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
@@ -197,13 +169,13 @@
</concat>
<mergemapper to="README-fml.txt" />
</mappedresources>
</jar>
</zip>
</target>
<target name="build-source-pack" depends="makeversion">
<property name="srcpack.jarname" value="${modname}-src-${version}" />
<property name="srcpack.jarname" value="${modname}-src-${version.minecraft}-${version}-${version.branch}" />
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
<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" />
@@ -212,6 +184,7 @@
<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" />
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
@@ -231,7 +204,24 @@
</zip>
</target>
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-client,build-universal,build-source-pack" />
<target name="build-deobf-data" depends="makeversion">
<mkdir dir="build-tmp-deobf"/>
<copy todir="build-tmp-deobf">
<mappedresources>
<fileset dir="${mcp.home}/conf" includes="packaged.srg"/>
<globmapper from="packaged.srg" to="joined.srg"/>
</mappedresources>
</copy>
<touch millis="0" file="build-tmp-deobf/joined.srg"/>
<zip file="deobfuscation_data_${version.minecraft}.zip" encoding="UTF-8">
<fileset dir="build-tmp-deobf" includes="joined.srg"/>
</zip>
<checksum algorithm="SHA1" property="deobf.checksum" file="deobfuscation_data_${version.minecraft}.zip"/>
<antcall target="writeversion"/>
<delete dir="build-tmp-deobf" />
</target>
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-deobf-data,build-universal,build-source-pack" />
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
@@ -252,7 +242,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}"/>
@@ -270,14 +260,11 @@
<fileset dir="${mcp.srcdir}"/>
</copy>
<antcall target="writeversion"/>
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects</echo>
<antcall target="makeeclipse"/>
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML project</echo>
</target>
<target name="fmldecompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<target name="fmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />
@@ -285,11 +272,7 @@
</exec>
</target>
<target name="jenkinsfmldecompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<target name="jenkinsfmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />
@@ -329,20 +312,21 @@
<target name="cleanargo" depends="buildenvsetup">
<delete dir="${client.mcp.srcdir}/argo"/>
<delete dir="${client.mcp.srcdir}/org"/>
</target>
<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">
@@ -353,6 +337,13 @@
</exec>
</target>
<target name="makeeclipse" depends="buildenvsetup" unless="eclipse.exists">
<echo>
Extracting fresh eclipse workspace to ${basedir}/eclipse
</echo>
<unzip src="${basedir}/eclipse-workspace-dev.zip" dest="${basedir}"/>
</target>
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
<copy todir="${tmp.mcp.srcdir}">
<fileset dir="${mcp.srcdir}"/>
@@ -368,4 +359,12 @@
<fileset dir="${tmp.mcp.srcdir}"/>
</move>
</target>
<target name="signjar" depends="buildenvsetup,makeversion" if="signature.exists">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<property file="${env.JENKINS_HOME}/fmlsigned.properties" prefix="sign"/>
<echo>${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS}</echo>
<signjar alias="FML" jar="${basedir}/target/${universal.jarname}.zip" keypass="${sign.KEYPASS}" keystore="${env.JENKINS_HOME}/${sign.KEYSTORE}" storepass="${sign.STOREPASS}" verbose="true"/>
</target>
</project>
@@ -1,10 +1,22 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* If a mod throws this exception during loading, it will be called back to render
+101 -31
View File
@@ -17,27 +17,33 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.CrashReport;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet131MapData;
import net.minecraft.src.Render;
import net.minecraft.src.RenderManager;
import net.minecraft.src.World;
import net.minecraft.src.WorldClient;
import net.minecraft.world.World;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
@@ -54,15 +60,18 @@ import cpw.mods.fml.common.MissingModsException;
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;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
/**
@@ -112,6 +121,8 @@ public class FMLClientHandler implements IFMLSidedHandler
private DuplicateModsFoundException dupesFound;
private boolean serverShouldBeKilledQuietly;
/**
* Called to start the whole game off
*
@@ -119,6 +130,7 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
public void beginMinecraftLoading(Minecraft minecraft)
{
client = minecraft;
if (minecraft.func_71355_q())
{
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
@@ -127,9 +139,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
loading = true;
client = minecraft;
ObfuscationReflectionHelper.detectObfuscation(World.class);
TextureFXManager.instance().setClient(client);
// TextureFXManager.instance().setClient(client);
FMLCommonHandler.instance().beginLoading(this);
new ModLoaderClientHelper(client);
try
@@ -233,7 +243,9 @@ public class FMLClientHandler implements IFMLSidedHandler
}
else
{
TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
// Force renderengine to reload and re-initialize all textures
client.field_71446_o.func_78352_b();
// TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
}
}
/**
@@ -289,7 +301,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return Arrays.asList(String.format("Optifine %s",optifineContainer.getVersion()));
} else {
return Collections.emptyList();
return ImmutableList.<String>of();
}
}
@@ -328,6 +340,7 @@ public class FMLClientHandler implements IFMLSidedHandler
else
{
entity = (Entity)(cls.getConstructor(World.class).newInstance(wc));
int offset = packet.entityId - entity.field_70157_k;
entity.field_70157_k = packet.entityId;
entity.func_70012_b(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch);
if (entity instanceof EntityLiving)
@@ -335,6 +348,14 @@ public class FMLClientHandler implements IFMLSidedHandler
((EntityLiving)entity).field_70759_as = packet.scaledHeadYaw;
}
Entity parts[] = entity.func_70021_al();
if (parts != null)
{
for (int j = 0; j < parts.length; j++)
{
parts[j].field_70157_k += offset;
}
}
}
entity.field_70118_ct = packet.rawX;
@@ -347,18 +368,6 @@ public class FMLClientHandler implements IFMLSidedHandler
((IThrowableEntity)entity).setThrower(thrower);
}
Entity parts[] = entity.func_70021_al();
if (parts != null)
{
int i = packet.entityId - entity.field_70157_k;
for (int j = 0; j < parts.length; j++)
{
parts[j].field_70157_k += i;
}
}
if (packet.metadata != null)
{
entity.func_70096_w().func_75687_a((List)packet.metadata);
@@ -403,6 +412,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void beginServerLoading(MinecraftServer server)
{
serverShouldBeKilledQuietly = false;
// NOOP
}
@@ -458,4 +468,64 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return NetClientHandler.getConnectionCompatibilityLevel();
}
public void warnIDMismatch(MapDifference<Integer, ItemData> idDifferences, boolean mayContinue)
{
GuiIdMismatchScreen mismatch = new GuiIdMismatchScreen(idDifferences, mayContinue);
client.func_71373_a(mismatch);
}
public void callbackIdDifferenceResponse(boolean response)
{
if (response)
{
serverShouldBeKilledQuietly = false;
GameData.releaseGate(true);
client.continueWorldLoading();
}
else
{
serverShouldBeKilledQuietly = true;
GameData.releaseGate(false);
// Reset and clear the client state
client.func_71403_a((WorldClient)null);
client.func_71373_a(null);
}
}
@Override
public boolean shouldServerShouldBeKilledQuietly()
{
return serverShouldBeKilledQuietly;
}
@Override
public void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr)
{
boolean criticalMismatch = !s.entriesOnlyOnLeft().isEmpty();
for (Entry<Integer, ValueDifference<ItemData>> mismatch : s.entriesDiffering().entrySet())
{
ValueDifference<ItemData> vd = mismatch.getValue();
if (!vd.leftValue().mayDifferByOrdinal(vd.rightValue()))
{
criticalMismatch = true;
}
}
if (!criticalMismatch)
{
// We'll carry on with this connection, and just log a message instead
return;
}
// Nuke the connection
((NetClientHandler)toKill).func_72553_e();
// Stop GuiConnecting
GuiConnecting.forceTermination((GuiConnecting)client.field_71462_r);
// pulse the network manager queue to clear cruft
mgr.func_74428_b();
// Nuke the world client
client.func_71403_a((WorldClient)null);
// Show error screen
warnIDMismatch(s, false);
}
}
@@ -1,69 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package cpw.mods.fml.client;
import java.awt.Dimension;
import java.util.List;
import java.util.logging.Logger;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TextureFX;
import net.minecraft.src.ITexturePack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
public class FMLTextureFX extends TextureFX implements ITextureFX
{
public int tileSizeBase = 16;
public int tileSizeSquare = 256;
public int tileSizeMask = 15;
public int tileSizeSquareMask = 255;
public boolean errored = false;
protected Logger log = FMLLog.getLogger();
public FMLTextureFX(int icon)
{
super(icon);
}
@Override public void setErrored(boolean err){ errored = err; }
@Override public boolean getErrored(){ return errored; }
@Override
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
{
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
}
@Override
public void onTextureDimensionsUpdate(int width, int height)
{
tileSizeBase = width >> 4;
tileSizeSquare = tileSizeBase * tileSizeBase;
tileSizeMask = tileSizeBase - 1;
tileSizeSquareMask = tileSizeSquare - 1;
setErrored(false);
setup();
}
protected void setup()
{
field_76852_a = new byte[tileSizeSquare << 2];
}
public boolean unregister(RenderEngine engine, List<TextureFX> effects)
{
effects.remove(this);
return true;
}
}
@@ -1,8 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import net.minecraft.src.GuiErrorScreen;
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
{
+14 -1
View File
@@ -1,13 +1,26 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.io.File;
import java.util.Map.Entry;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.common.DuplicateModsFoundException;
import cpw.mods.fml.common.MissingModsException;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import net.minecraft.src.GuiErrorScreen;
public class GuiDupesFound extends GuiErrorScreen
{
@@ -0,0 +1,100 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.util.StringTranslate;
import com.google.common.collect.Lists;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.versioning.ArtifactVersion;
public class GuiIdMismatchScreen extends GuiYesNo {
private List<String> missingIds = Lists.newArrayList();
private List<String> mismatchedIds = Lists.newArrayList();
private boolean allowContinue;
public GuiIdMismatchScreen(MapDifference<Integer, ItemData> idDifferences, boolean allowContinue)
{
super(null,"ID mismatch", "Should I continue?", 1);
field_73942_a = this;
for (Entry<Integer, ItemData> entry : idDifferences.entriesOnlyOnLeft().entrySet())
{
missingIds.add(String.format("ID %d (ModID: %s, type %s) is missing", entry.getValue().getItemId(), entry.getValue().getModId(), entry.getValue().getItemType()));
}
for (Entry<Integer, ValueDifference<ItemData>> entry : idDifferences.entriesDiffering().entrySet())
{
ItemData world = entry.getValue().leftValue();
ItemData game = entry.getValue().rightValue();
mismatchedIds.add(String.format("ID %d is mismatched. World: (ModID: %s, type %s, ordinal %d) Game (ModID: %s, type %s, ordinal %d)", world.getItemId(), world.getModId(), world.getItemType(), world.getOrdinal(), game.getModId(), game.getItemType(), game.getOrdinal()));
}
this.allowContinue = allowContinue;
}
@Override
public void func_73878_a(boolean choice, int p_73878_2_)
{
FMLClientHandler.instance().callbackIdDifferenceResponse(choice);
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
if (!allowContinue && field_73887_h.size() == 2)
{
field_73887_h.remove(0);
}
int offset = Math.max(85 - missingIds.size() * 10 + mismatchedIds.size() * 30, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found world ID mismatches", this.field_73880_f / 2, offset, 0xFFFFFF);
offset += 10;
for (String s: missingIds) {
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
offset += 10;
}
for (String s: mismatchedIds) {
this.func_73732_a(this.field_73886_k, s, this.field_73880_f / 2, offset, 0xEEEEEE);
offset += 10;
}
offset += 10;
if (allowContinue)
{
this.func_73732_a(this.field_73886_k, "Do you wish to continue loading?", this.field_73880_f / 2, offset, 0xFFFFFF);
offset += 10;
}
else
{
this.func_73732_a(this.field_73886_k, "You cannot connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
offset += 10;
}
// super.super. Grrr
for (int var4 = 0; var4 < this.field_73887_h.size(); ++var4)
{
GuiButton var5 = (GuiButton)this.field_73887_h.get(var4);
var5.field_73743_d = Math.min(offset + 10, this.field_73881_g - 20);
if (!allowContinue)
{
var5.field_73746_c = this.field_73880_f / 2 - 75;
var5.field_73744_e = StringTranslate.func_74808_a().func_74805_b("gui.done");
}
var5.func_73737_a(this.field_73882_e, p_73863_1_, p_73863_2_);
}
}
}
+31 -14
View File
@@ -18,12 +18,12 @@ import java.awt.Dimension;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.GuiSmallButton;
import net.minecraft.src.StringTranslate;
import net.minecraft.src.Tessellator;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSmallButton;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.StringTranslate;
import org.lwjgl.opengl.GL11;
@@ -54,7 +54,7 @@ public class GuiModList extends GuiScreen
this.mods=new ArrayList<ModContainer>();
FMLClientHandler.instance().addSpecialModEntries(mods);
for (ModContainer mod : Loader.instance().getModList()) {
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
if (mod.getMetadata()!=null && mod.getMetadata().parentMod==null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
String parentMod = mod.getMetadata().parent;
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
if (parentContainer != null)
@@ -64,6 +64,10 @@ public class GuiModList extends GuiScreen
continue;
}
}
else if (mod.getMetadata()!=null && mod.getMetadata().parentMod!=null)
{
continue;
}
mods.add(mod);
}
}
@@ -98,7 +102,7 @@ public class GuiModList extends GuiScreen
public int drawLine(String line, int offset, int shifty)
{
this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
int r = this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
return shifty + 10;
}
@@ -112,12 +116,21 @@ public class GuiModList extends GuiScreen
GL11.glEnable(GL11.GL_BLEND);
if (!selectedMod.getMetadata().autogenerated) {
int shifty = 35;
if (!selectedMod.getMetadata().logoFile.isEmpty())
String logoFile = selectedMod.getMetadata().logoFile;
if (!logoFile.isEmpty())
{
int texture = this.field_73882_e.field_71446_o.func_78341_b(selectedMod.getMetadata().logoFile);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_73882_e.field_71446_o.func_78342_b(texture);
Dimension dim = TextureFXManager.instance().getTextureDimensions(texture);
this.field_73882_e.field_71446_o.func_98187_b(logoFile);
Dimension dim = TextureFXManager.instance().getTextureDimensions(logoFile);
double scaleX = dim.width / 200.0;
double scaleY = dim.height / 65.0;
double scale = 1.0;
if (scaleX > 1 || scaleY > 1)
{
scale = 1.0 / Math.max(scaleX, scaleY);
}
dim.width *= scale;
dim.height *= scale;
int top = 32;
Tessellator tess = Tessellator.field_78398_a;
tess.func_78382_b();
@@ -133,14 +146,18 @@ public class GuiModList extends GuiScreen
shifty += 12;
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
shifty = drawLine(String.format("Mod State: %s", Loader.instance().getModState(selectedMod)), offset, shifty);
shifty = drawLine(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)), offset, shifty);
if (!selectedMod.getMetadata().credits.isEmpty()) {
shifty = drawLine(String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty);
}
shifty = drawLine(String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty);
shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
shifty = drawLine(selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty);
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, this.field_73880_f - offset - 20, 0xDDDDDD);
int rightSide = this.field_73880_f - offset - 20;
if (rightSide > 20)
{
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
}
} else {
offset = ( this.listWidth + this.field_73880_f ) / 2;
this.func_73732_a(this.field_73886_k, selectedMod.getName(), offset, 35, 0xFFFFFF);
+13 -1
View File
@@ -1,8 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.common.MissingModsException;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import net.minecraft.src.GuiErrorScreen;
public class GuiModsMissing extends GuiErrorScreen
{
@@ -1,9 +1,21 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.GuiSmallButton;
import net.minecraft.src.StringTranslate;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSmallButton;
import net.minecraft.util.StringTranslate;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.versioning.ArtifactVersion;
@@ -1,10 +1,22 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.src.GuiButton;
import net.minecraft.src.Tessellator;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -252,7 +264,7 @@ public abstract class GuiScrollingList
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator var18 = Tessellator.field_78398_a;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.client.field_71446_o.func_78341_b("/gui/background.png"));
this.client.field_71446_o.func_98187_b("/gui/background.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var17 = 32.0F;
var18.func_78382_b();
@@ -385,7 +397,7 @@ public abstract class GuiScrollingList
private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_)
{
Tessellator var5 = Tessellator.field_78398_a;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.client.field_71446_o.func_78341_b("/gui/background.png"));
this.client.field_71446_o.func_98187_b("/gui/background.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var6 = 32.0F;
var5.func_78382_b();
+11 -12
View File
@@ -1,22 +1,21 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.util.ArrayList;
import net.minecraft.src.Tessellator;
import net.minecraft.client.renderer.Tessellator;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.ModContainer;
@@ -1,10 +1,21 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiErrorScreen;
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
{
+11 -13
View File
@@ -1,23 +1,21 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client;
import java.awt.Dimension;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.ITexturePack;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.texturepacks.ITexturePack;
public interface ITextureFX
{
@@ -1,44 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package cpw.mods.fml.client;
import net.minecraft.src.TextureFX;
class OverrideInfo
{
public String texture;
public String override;
public int index;
public int imageIndex;
public TextureFX textureFX;
public boolean added;
@Override
public boolean equals(Object obj)
{
try {
OverrideInfo inf=(OverrideInfo) obj;
return index==inf.index && imageIndex==inf.imageIndex;
} catch (Exception e) {
return false;
}
}
@Override
public int hashCode()
{
return index+imageIndex;
}
}
@@ -1,138 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package cpw.mods.fml.client;
import java.util.BitSet;
import java.util.HashMap;
import java.util.logging.Level;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
/**
* @author cpw
*
*/
public class SpriteHelper
{
private static HashMap<String, BitSet> spriteInfo = new HashMap<String, BitSet>();
private static void initMCSpriteMaps() {
BitSet slots =
SpriteHelper.toBitSet(
"0000000000000000" +
"0000000000110000" +
"0000000000100000" +
"0000000001100000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000011111" +
"0000000000000000" +
"0000000001111100" +
"0000000001111000" +
"0000000000000000");
spriteInfo.put("/terrain.png", slots);
slots = SpriteHelper.toBitSet(
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0000000000000000" +
"0111100000000000" +
"1111100010000000" +
"0000101110000000" +
"0111000000000000" +
"1100001100001111" +
"0000000000001111" +
"0000000000000000");
spriteInfo.put("/gui/items.png", slots);
}
/**
* Register a sprite map for ModTextureStatic, to allow for other mods to override
* your sprite page.
*
*
*/
public static void registerSpriteMapForFile(String file, String spriteMap) {
if (spriteInfo.size() == 0) {
initMCSpriteMaps();
}
if (spriteInfo.containsKey(file)) {
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Duplicate attempt to register a sprite file %s for overriding -- ignoring",file));
return;
}
spriteInfo.put(file, toBitSet(spriteMap));
}
public static int getUniqueSpriteIndex(String path)
{
if (!spriteInfo.containsKey("/terrain.png"))
{
initMCSpriteMaps();
}
BitSet slots = spriteInfo.get(path);
if (slots == null)
{
Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path));
FMLLog.log(Level.SEVERE, ex, "A critical error has been detected with sprite overrides");
FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true);
}
int ret = getFreeSlot(slots);
if (ret == -1)
{
Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path));
FMLLog.log(Level.SEVERE, ex, "There are no sprite indicies left for %s", path);
FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true);
}
return ret;
}
public static BitSet toBitSet(String data)
{
BitSet ret = new BitSet(data.length());
for (int x = 0; x < data.length(); x++)
{
ret.set(x, data.charAt(x) == '1');
}
return ret;
}
public static int getFreeSlot(BitSet slots)
{
int next=slots.nextSetBit(0);
slots.clear(next);
return next;
}
public static int freeSlotCount(String textureToOverride)
{
return spriteInfo.get(textureToOverride).cardinality();
}
}
+62 -280
View File
@@ -1,306 +1,43 @@
package cpw.mods.fml.client;
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_BINDING_2D;
package cpw.mods.fml.client;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.src.ModTextureStatic;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.TextureFX;
import net.minecraft.src.ITexturePack;
import org.lwjgl.opengl.GL11;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ModContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderEngine;
public class TextureFXManager
{
private static final TextureFXManager INSTANCE = new TextureFXManager();
private class TextureProperties
{
private int textureId;
private Dimension dim;
}
private Map<Integer,TextureProperties> textureProperties = Maps.newHashMap();
private Multimap<String, OverrideInfo> overrideInfo = ArrayListMultimap.create();
private HashSet<OverrideInfo> animationSet = new HashSet<OverrideInfo>();
private List<TextureFX> addedTextureFX = new ArrayList<TextureFX>();
private Minecraft client;
private Map<Integer,TextureHolder> texturesById = Maps.newHashMap();
private Map<String, TextureHolder> texturesByName = Maps.newHashMap();
void setClient(Minecraft client)
{
this.client = client;
}
public boolean onUpdateTextureEffect(TextureFX effect)
{
ITextureFX ifx = (effect instanceof ITextureFX ? ((ITextureFX)effect) : null);
if (ifx != null && ifx.getErrored())
{
return false;
}
String name = effect.getClass().getSimpleName();
client.field_71424_I.func_76320_a(name);
try
{
if (!FMLClientHandler.instance().hasOptifine())
{
effect.func_76846_a();
}
}
catch (Exception e)
{
FMLLog.warning("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name);
if (ifx != null)
{
ifx.setErrored(true);
}
client.field_71424_I.func_76319_b();
return false;
}
client.field_71424_I.func_76319_b();
if (ifx != null)
{
Dimension dim = getTextureDimensions(effect);
int target = ((dim.width >> 4) * (dim.height >> 4)) << 2;
if (effect.field_76852_a.length != target)
{
FMLLog.warning("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target);
ifx.setErrored(true);
return false;
}
}
return true;
}
//Quick and dirty image scaling, no smoothing or fanciness, meant for speed as it will be called every tick.
public void scaleTextureFXData(byte[] data, ByteBuffer buf, int target, int length)
{
int sWidth = (int)Math.sqrt(data.length / 4);
int factor = target / sWidth;
byte[] tmp = new byte[4];
buf.clear();
if (factor > 1)
{
for (int y = 0; y < sWidth; y++)
{
int sRowOff = sWidth * y;
int tRowOff = target * y * factor;
for (int x = 0; x < sWidth; x++)
{
int sPos = (x + sRowOff) * 4;
tmp[0] = data[sPos + 0];
tmp[1] = data[sPos + 1];
tmp[2] = data[sPos + 2];
tmp[3] = data[sPos + 3];
int tPosTop = (x * factor) + tRowOff;
for (int y2 = 0; y2 < factor; y2++)
{
buf.position((tPosTop + (y2 * target)) * 4);
for (int x2 = 0; x2 < factor; x2++)
{
buf.put(tmp);
}
}
}
}
}
buf.position(0).limit(length);
}
public void onPreRegisterEffect(TextureFX effect)
{
Dimension dim = getTextureDimensions(effect);
if (effect instanceof ITextureFX)
{
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
}
}
public int getEffectTexture(TextureFX effect)
{
Integer id = effectTextures.get(effect);
if (id != null)
{
return id;
}
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
effect.func_76845_a(client.field_71446_o);
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
GL11.glBindTexture(GL_TEXTURE_2D, old);
effectTextures.put(effect, id);
return id;
}
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
{
pruneOldTextureFX(texturepack, effects);
for (TextureFX tex : effects)
{
if (tex instanceof ITextureFX)
{
((ITextureFX)tex).onTexturePackChanged(engine, texturepack, getTextureDimensions(tex));
}
}
loadTextures(texturepack);
}
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
private ITexturePack earlyTexturePack;
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
{
Dimension dim = new Dimension(width, height);
textureDims.put(id, dim);
for (TextureFX tex : effects)
{
if (getEffectTexture(tex) == id && tex instanceof ITextureFX)
{
((ITextureFX)tex).onTextureDimensionsUpdate(width, height);
}
}
}
public Dimension getTextureDimensions(TextureFX effect)
{
return getTextureDimensions(getEffectTexture(effect));
}
public Dimension getTextureDimensions(int id)
{
return textureDims.get(id);
}
public void addAnimation(TextureFX anim)
{
OverrideInfo info=new OverrideInfo();
info.index=anim.field_76850_b;
info.imageIndex=anim.field_76847_f;
info.textureFX=anim;
if (animationSet.contains(info)) {
animationSet.remove(info);
}
animationSet.add(info);
}
public void loadTextures(ITexturePack texturePack)
{
registerTextureOverrides(client.field_71446_o);
}
public void registerTextureOverrides(RenderEngine renderer) {
for (OverrideInfo animationOverride : animationSet) {
renderer.func_78355_a(animationOverride.textureFX);
addedTextureFX.add(animationOverride.textureFX);
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f));
}
for (String fileToOverride : overrideInfo.keySet()) {
for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
try
{
BufferedImage image=loadImageFromTexturePack(renderer, override.override);
ModTextureStatic mts=new ModTextureStatic(override.index, 1, override.texture, image);
renderer.func_78355_a(mts);
addedTextureFX.add(mts);
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f));
}
catch (IOException e)
{
FMLCommonHandler.instance().getFMLLogger().throwing("FMLClientHandler", "registerTextureOverrides", e);
}
}
}
}
protected void registerAnimatedTexturesFor(ModContainer mod)
{
}
public void onEarlyTexturePackLoad(ITexturePack fallback)
{
if (client==null) {
// We're far too early- let's wait
this.earlyTexturePack = fallback;
} else {
loadTextures(fallback);
}
}
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
{
ListIterator<TextureFX> li = addedTextureFX.listIterator();
while (li.hasNext())
{
TextureFX tex = li.next();
if (tex instanceof FMLTextureFX)
{
if (((FMLTextureFX)tex).unregister(client.field_71446_o, effects))
{
li.remove();
}
}
else
{
effects.remove(tex);
li.remove();
}
}
}
public void addNewTextureOverride(String textureToOverride, String overridingTexturePath, int location) {
OverrideInfo info = new OverrideInfo();
info.index = location;
info.override = overridingTexturePath;
info.texture = textureToOverride;
overrideInfo.put(textureToOverride, info);
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
}
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
{
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
@@ -320,4 +57,49 @@ public class TextureFXManager
return INSTANCE;
}
public void fixTransparency(BufferedImage loadedImage, String textureName)
{
if (textureName.matches("^/mob/.*_eyes.*.png$"))
{
for (int x = 0; x < loadedImage.getWidth(); x++) {
for (int y = 0; y < loadedImage.getHeight(); y++) {
int argb = loadedImage.getRGB(x, y);
if ((argb & 0xff000000) == 0 && argb != 0) {
loadedImage.setRGB(x, y, 0);
}
}
}
}
}
public void bindTextureToName(String name, int index)
{
TextureHolder holder = new TextureHolder();
holder.textureId = index;
holder.textureName = name;
texturesById.put(index,holder);
texturesByName.put(name,holder);
}
public void setTextureDimensions(int index, int j, int k)
{
TextureHolder holder = texturesById.get(index);
if (holder == null)
{
return;
}
holder.x = j;
holder.y = k;
}
private class TextureHolder {
private int textureId;
private String textureName;
private int x;
private int y;
}
public Dimension getTextureDimensions(String texture)
{
return texturesByName.containsKey(texture) ? new Dimension(texturesByName.get(texture).x, texturesByName.get(texture).y) : new Dimension(1,1);
}
}
@@ -1,23 +1,21 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.modloader;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.src.BaseMod;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.modloader;
import java.util.Collection;
@@ -7,19 +19,20 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import net.minecraft.client.Minecraft;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.src.BaseMod;
import net.minecraft.src.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;
import net.minecraft.client.*;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import com.google.common.base.Equivalences;
import com.google.common.base.Equivalence;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.Iterables;
@@ -56,38 +69,38 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game)
{
FMLLog.finer("Handling post startup activities for ModLoader mod %s", mc.getModId());
FMLLog.log(mc.getModId(), Level.FINE, "Handling post startup activities for ModLoader mod %s", mc.getModId());
BaseMod mod = (BaseMod) mc.getMod();
Map<Class<? extends Entity>, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o);
try
{
FMLLog.finest("Requesting renderers from basemod %s", mc.getModId());
FMLLog.log(mc.getModId(), Level.FINEST, "Requesting renderers from basemod %s", mc.getModId());
mod.addRenderer(renderers);
FMLLog.finest("Received %d renderers from basemod %s", renderers.size(), mc.getModId());
FMLLog.log(mc.getModId(), Level.FINEST, "Received %d renderers from basemod %s", renderers.size(), mc.getModId());
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
}
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalences.identity());
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalence.identity());
for ( Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnLeft().entrySet())
{
FMLLog.warning("The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
FMLLog.log(mc.getModId(), Level.WARNING, "The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
}
for (Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnRight().entrySet())
{
FMLLog.finest("Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue());
}
for (Entry<Class<? extends Entity>, ValueDifference<Render>> e : difference.entriesDiffering().entrySet())
{
FMLLog.finest("Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
FMLLog.log(mc.getModId(), Level.FINEST, "Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue());
}
@@ -97,7 +110,7 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
FMLLog.log(mc.getModId(), Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
}
}
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.modloader;
@@ -23,7 +21,7 @@ import org.lwjgl.input.Mouse;
import com.google.common.collect.ObjectArrays;
import com.google.common.primitives.Booleans;
import net.minecraft.src.KeyBinding;
import net.minecraft.client.settings.KeyBinding;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
@@ -1,9 +1,21 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.registry;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntityRenderer;
import net.minecraft.src.TileEntitySpecialRenderer;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class ClientRegistry
{
@@ -1,8 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.registry;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
public interface ISimpleBlockRenderingHandler
{
@@ -1,11 +1,23 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.registry;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.src.GameSettings;
import net.minecraft.src.KeyBinding;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -14,9 +26,9 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
public class KeyBindingRegistry
{
@@ -1,22 +1,30 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.registry;
import java.util.List;
import java.util.Map;
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;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.world.IBlockAccess;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.ObjectArrays;
import cpw.mods.fml.client.SpriteHelper;
import cpw.mods.fml.client.TextureFXManager;
/**
@@ -27,7 +35,7 @@ public class RenderingRegistry
{
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private int nextRenderId = 36;
private int nextRenderId = 40;
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
@@ -93,11 +101,10 @@ public class RenderingRegistry
* @param fileToOverride
* @param fileToAdd
*/
@Deprecated
public static int addTextureOverride(String fileToOverride, String fileToAdd)
{
int idx = SpriteHelper.getUniqueSpriteIndex(fileToOverride);
addTextureOverride(fileToOverride, fileToAdd, idx);
return idx;
return -1;
}
/**
@@ -109,7 +116,7 @@ public class RenderingRegistry
*/
public static void addTextureOverride(String path, String overlayPath, int index)
{
TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
// TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
}
/**
@@ -117,9 +124,10 @@ public class RenderingRegistry
*
* @param path
*/
@Deprecated
public static int getUniqueTextureIndex(String path)
{
return SpriteHelper.getUniqueSpriteIndex(path);
return -1;
}
@Deprecated public static RenderingRegistry instance()
+33 -4
View File
@@ -12,17 +12,35 @@
*/
package net.minecraft.src;
import static cpw.mods.fml.common.Side.CLIENT;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import java.util.Map;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.block.Block;
import net.minecraft.client.*;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetServerHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
{
@@ -312,6 +330,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
}
/**
* Called client side to receive a custom payload for this mod
*
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
*
* @param packet
*/
@@ -338,7 +358,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
return false;
}
/*
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
*/
@Override
public void serverConnect(NetHandler handler) {
@@ -350,6 +372,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
}
/*
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
*/
@Override
public void serverDisconnect() {
@@ -393,6 +418,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
}
/**
* Called when a new client logs in.
*
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
*
* @param player
*/
@@ -403,6 +430,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
/**
* Called when a client logs out of the server.
*
* NOTE: this method is not provided in Risugami's implementation of BaseMod!
*/
@Override
public void onClientLogout(INetworkManager mgr)
@@ -1,20 +1,19 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
public class EntityRendererProxy extends EntityRenderer
{
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package net.minecraft.src;
@@ -19,6 +17,12 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.texturepacks.ITexturePack;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.TextureFXManager;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLLog;
@@ -34,12 +38,14 @@ public class FMLRenderAccessLibrary
{
public static Logger getLogger()
{
return FMLLog.getLogger();
Logger l = Logger.getLogger("FMLRenderAccessLibrary");
l.setParent(FMLLog.getLogger());
return l;
}
public static void log(Level level, String message)
{
FMLLog.log(level, message);
FMLLog.log("FMLRenderAccessLibrary", level, message);
}
public static void log(Level level, String message, Throwable throwable)
@@ -47,31 +53,6 @@ public class FMLRenderAccessLibrary
FMLLog.log(level, throwable, message);
}
public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
{
TextureFXManager.instance().setTextureDimensions(textureId, width, height, textureFXList);
}
public static void preRegisterEffect(TextureFX textureFX)
{
TextureFXManager.instance().onPreRegisterEffect(textureFX);
}
public static boolean onUpdateTextureEffect(TextureFX textureFX)
{
return TextureFXManager.instance().onUpdateTextureEffect(textureFX);
}
public static Dimension getTextureDimensions(TextureFX textureFX)
{
return TextureFXManager.instance().getTextureDimensions(textureFX);
}
public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
{
TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
}
@SuppressWarnings("deprecation")
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
{
+39 -12
View File
@@ -12,7 +12,7 @@
*/
package net.minecraft.src;
import static cpw.mods.fml.common.Side.CLIENT;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import java.awt.image.BufferedImage;
import java.util.Collections;
@@ -20,10 +20,41 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.client.*;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.command.ICommand;
import net.minecraft.dispenser.IBehaviorDispenseItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetServerHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.*;
import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.SpriteHelper;
import cpw.mods.fml.client.TextureFXManager;
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
@@ -34,7 +65,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.modloader.ModLoaderHelper;
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
import cpw.mods.fml.common.network.NetworkRegistry;
@@ -43,6 +73,7 @@ import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.server.FMLServerHandler;
public class ModLoader
@@ -87,12 +118,6 @@ public class ModLoader
{
}
@SideOnly(CLIENT)
public static void addAnimation(TextureFX anim)
{
TextureFXManager.instance().addAnimation(anim);
}
/**
* Adds a new prefix to the armor texture list
*
@@ -197,6 +222,7 @@ public class ModLoader
* @param fileToAdd The new image
* @return The 'icon index' in the main image that the new image will be applied to
*/
@Deprecated
@SideOnly(CLIENT)
public static int addOverride(String fileToOverride, String fileToAdd)
{
@@ -492,10 +518,11 @@ public class ModLoader
return EntityRegistry.findGlobalUniqueEntityId();
}
@Deprecated
@SideOnly(CLIENT)
public static int getUniqueSpriteIndex(String path)
{
return SpriteHelper.getUniqueSpriteIndex(path);
return -1;
}
/**
@@ -1,139 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraft.src;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.FMLTextureFX;
/**
* A texture override for animations, it takes a vertical image of
* texture frames and constantly rotates them in the texture.
*/
public class ModTextureAnimation extends FMLTextureFX
{
private final int tickRate;
private byte[][] images;
private int index = 0;
private int ticks = 0;
private String targetTex = null;
private BufferedImage imgData = null;
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
{
this(icon, 1, target, image, tickCount);
}
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
{
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
}
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
{
super(icon);
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
targetTex = target;
field_76849_e = size;
field_76847_f = re.func_78341_b(target);
tickRate = tickCount;
ticks = tickCount;
imgData = image;
}
@Override
public void setup()
{
super.setup();
int sWidth = imgData.getWidth();
int sHeight = imgData.getHeight();
int tWidth = tileSizeBase;
int tHeight = tileSizeBase;
int frames = (int)Math.floor((double)(sHeight / sWidth));
if (frames < 1)
{
throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight));
}
else
{
images = new byte[frames][];
BufferedImage image = imgData;
if (sWidth != tWidth)
{
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
Graphics2D g = b.createGraphics();
g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null);
g.dispose();
image = b;
}
for (int frame = 0; frame < frames; frame++)
{
int[] pixels = new int[tileSizeSquare];
image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth);
images[frame] = new byte[tileSizeSquare << 2];
for (int i = 0; i < pixels.length; i++)
{
int i4 = i * 4;
images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255);
images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255);
images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255);
images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255);
}
}
}
}
public void func_76846_a()
{
if (++ticks >= tickRate)
{
if (++index >= images.length)
{
index = 0;
}
field_76852_a = images[index];
ticks = 0;
}
}
public void func_76845_a(RenderEngine renderEngine)
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
}
// TODO: REMOVE THIS - just for you dan200
@Deprecated
public void func_783_a()
{
func_76846_a();
}
}
@@ -1,181 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraft.src;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.FMLTextureFX;
public class ModTextureStatic extends FMLTextureFX
{
private boolean oldanaglyph = false;
private int[] pixels = null;
private String targetTex = null;
private int storedSize;
private BufferedImage overrideData = null;
private int needApply = 2;
public ModTextureStatic(int icon, int target, BufferedImage image)
{
this(icon, 1, target, image);
}
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
{
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
}
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
{
super(icon);
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
targetTex = target;
storedSize = size;
field_76849_e = size;
field_76847_f = re.func_78341_b(target);
overrideData = image;
}
@Override
public void setup()
{
super.setup();
int sWidth = overrideData.getWidth();
int sHeight = overrideData.getHeight();
pixels = new int[tileSizeSquare];
if (tileSizeBase == sWidth && tileSizeBase == sHeight)
{
overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth);
}
else
{
BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6);
Graphics2D gfx = tmp.createGraphics();
gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null);
tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase);
gfx.dispose();
}
update();
}
@Override
public void func_76846_a()
{
if (oldanaglyph != field_76851_c)
{
update();
}
// This makes it so we only apply the texture to the target texture when we need to,
//due to the fact that update is called when the Effect is first registered, we actually
//need to wait for the next one.
field_76849_e = (needApply == 0 ? 0 : storedSize);
if (needApply > 0)
{
needApply--;
}
}
@Override
public void func_76845_a(RenderEngine p_76845_1_)
{
GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex));
}
public void update()
{
needApply = 2;
for (int idx = 0; idx < pixels.length; idx++)
{
int i = idx * 4;
int a = pixels[idx] >> 24 & 255;
int r = pixels[idx] >> 16 & 255;
int g = pixels[idx] >> 8 & 255;
int b = pixels[idx] >> 0 & 255;
if (field_76851_c)
{
r = g = b = (r + g + b) / 3;
}
field_76852_a[i + 0] = (byte)r;
field_76852_a[i + 1] = (byte)g;
field_76852_a[i + 2] = (byte)b;
field_76852_a[i + 3] = (byte)a;
}
oldanaglyph = field_76851_c;
}
//Implementation of http://scale2x.sourceforge.net/algorithm.html
public static BufferedImage scale2x(BufferedImage image)
{
int w = image.getWidth();
int h = image.getHeight();
BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2);
for (int x = 0; x < h; ++x)
{
int x2 = x * 2;
for (int y = 0; y < w; ++y)
{
int y2 = y * 2;
int E = image.getRGB(y, x);
int D = (x == 0 ? E : image.getRGB(y, x - 1));
int B = (y == 0 ? E : image.getRGB(y - 1, x ));
int H = (y >= w - 1 ? E : image.getRGB(y + 1, x ));
int F = (x >= h - 1 ? E : image.getRGB(y, x + 1));
int e0, e1, e2, e3;
if (B != H && D != F)
{
e0 = D == B ? D : E;
e1 = B == F ? F : E;
e2 = D == H ? D : E;
e3 = H == F ? F : E;
}
else
{
e0 = e1 = e2 = e3 = E;
}
tmp.setRGB(y2, x2, e0);
tmp.setRGB(y2 + 1, x2, e1);
tmp.setRGB(y2, x2 + 1, e2);
tmp.setRGB(y2 + 1, x2 + 1, e3);
}
}
return tmp;
}
@Override
public String toString()
{
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
}
}
+12
View File
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package net.minecraft.src;
/**
+56 -122
View File
@@ -4,77 +4,58 @@
def reallyrmtree(path):
+ if os.path.isfile(os.path.join(path, 'asm-all-4.0.jar')): #Check if asm exists, indicating the libs folder, if so, don't delete it
+ if os.path.isfile(os.path.join(path, 'asm-4.1.tar.gz')): #Check if asm exists, indicating the libs folder, if so, don't delete it
+ return
if not sys.platform.startswith('win'):
if os.path.exists(path):
shutil.rmtree(path)
@@ -584,6 +586,9 @@
self.has_astyle_cfg = False
if os.path.isfile(self.astyleconf):
self.has_astyle_cfg = True
+
+ #FML Entries
+ self.srcshared = os.path.normpath(os.path.join(self.dirsrc, 'common'))
@@ -139,6 +141,8 @@
fieldnames = csvreader.fieldnames
return set(fieldnames)
def creatergcfg(self, reobf=False, keep_lvt=False, keep_generics=False, rg_update=False):
"""Create the files necessary for RetroGuard"""
@@ -781,13 +786,16 @@
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
+def commands_sanity_check():
+ print 'Commands patch applied successfully'
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
- return False
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))):
+ return False
return True
def checkbins(self, side):
class Commands(object):
"""Contains the commands and initialisation for a full mcp run"""
@@ -796,6 +800,8 @@
binlk = {CLIENT: self.binclient, SERVER: self.binserver}
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
+ if side == SERVER:
+ if side == SERVER and not os.path.exists(os.path.join(binlk[side], os.path.normpath(testlk[side] + '.class'))):
+ 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 @@
@@ -1037,6 +1043,9 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
+ if side == SERVER: #Disable server because FML recombines it into client
+ self.logger.info('Server side recompiling skipped, this is normal')
+ return
+ if side == SERVER: #Warn about server because FML recombines it into client
+ self.logger.info('Server side recompiling might be skipped, this is normal, do not complain to FML/Forge team about server side.')
+
if not os.path.exists(pathbinlk[side]):
os.makedirs(pathbinlk[side])
@@ -1041,6 +1053,7 @@
all_files = True
append_pattern = False
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=append_pattern, all_files=all_files) #FML, Add Common folder
dirs = ' '.join(pkglist)
classpath = os.pathsep.join(cplk[side])
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
@@ -1062,7 +1075,7 @@
@@ -1070,7 +1079,7 @@
raise
def startserver(self):
- classpath = [self.binserver] + self.cpathserver
+ classpath = [self.binclient, self.srcshared] + self.cpathserver
+ classpath = [self.binclient, self.srcclient] + self.cpathserver
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
os.chdir(self.dirjars)
@@ -1070,7 +1083,7 @@
@@ -1078,7 +1087,7 @@
self.runmc(forkcmd)
def startclient(self):
- classpath = [self.binclient] + self.cpathclient
+ classpath = [self.binclient, self.srcshared] + self.cpathclient
+ classpath = [self.binclient, self.srcclient] + self.cpathclient
classpath = [os.path.join('..', p) for p in classpath]
classpath = os.pathsep.join(classpath)
natives = os.path.join('..', self.dirnatives)
@@ -1197,20 +1210,20 @@
@@ -1205,20 +1214,20 @@
with open(self.csvmethods, 'rb') as fh:
methodsreader = csv.DictReader(fh)
for row in methodsreader:
@@ -98,56 +79,7 @@
names['params'][row['param']] = row['name']
regexps = {
@@ -1240,6 +1253,11 @@
# HINT: We pathwalk the sources
for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
+ for cur_file in fnmatch.filter(filelist, '*.java'):
+ updatefile(os.path.normpath(os.path.join(path, cur_file)))
+
+ # FML, copy of the above, for the common folder
+ for path, _, filelist in os.walk(self.srcshared, followlinks=True):
for cur_file in fnmatch.filter(filelist, '*.java'):
updatefile(os.path.normpath(os.path.join(path, cur_file)))
return True
@@ -1322,12 +1340,14 @@
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
strip_comments(pathsrclk[side])
+ strip_comments(self.srcshared)
def process_cleanup(self, side):
"""Do lots of random cleanups including stripping comments, trailing whitespace and extra blank lines"""
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
src_cleanup(pathsrclk[side], fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
+ src_cleanup(self.srcshared, fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
def process_javadoc(self, side):
"""Add CSV descriptions to methods and fields as javadoc"""
@@ -1336,6 +1356,21 @@
if not self.has_doc_csv:
self.logger.warning('!! javadoc disabled due to no csvs !!')
return False
+
+ #FML Recall this function on the common folder
+ #Potential bug: If this is called without a subsiquent rename call, will cause double comments
+ if pathsrclk[side] != self.srcshared:
+ if side == CLIENT:
+ tmp = self.srcclient
+ self.srcclient = self.srcshared
+ self.process_javadoc(side)
+ self.srcclient = tmp
+ else:
+ tmp = self.srcserver
+ self.srcserver = self.srcshared
+ self.process_javadoc(side)
+ self.srcserver = tmp
+
#HINT: We read the relevant CSVs
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
@@ -1344,13 +1379,13 @@
@@ -1352,13 +1361,13 @@
methods = {}
for row in methodsreader:
#HINT: Only include methods that have a non-empty description
@@ -163,13 +95,7 @@
fields[row['searge']] = row['desc'].replace('*/', '* /')
regexps = {
@@ -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)
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=True) #FML, Add Common folder
dirs = ' '.join(pkglist)
forkcmd = self.cmdastyle.format(classes=dirs, conffile=self.astyleconf)
@@ -1435,7 +1444,7 @@
self.runcmd(forkcmd)
return True
@@ -178,7 +104,7 @@
if not reobf:
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
else:
@@ -1442,6 +1478,9 @@
@@ -1450,6 +1459,9 @@
class_path = ''
else:
class_path += '/'
@@ -188,7 +114,40 @@
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 +1633,9 @@
@@ -1546,6 +1558,8 @@
if not os.path.exists(outpathlk[side]):
os.makedirs(outpathlk[side])
+ reserved = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9']
+
# HINT: We extract the modified class files
with closing(zipfile.ZipFile(jarlk[side])) as zipjar:
for in_class in trgclasses:
@@ -1559,6 +1573,23 @@
out_class = out_class.replace(self.nullpkg, '')
if out_class[0] == '/':
out_class = out_class[1:]
+
+ rename = False
+ for res in reserved:
+ if out_class.upper().startswith(res):
+ rename = True
+ break
+
+ if rename:
+ try:
+ f = open(os.path.join(outpathlk[side], '_' + out_class), 'wb')
+ f.write(zipjar.read(out_class))
+ f.close()
+ self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], '_' + out_class)
+ except IOError:
+ self.logger.error('* File %s failed extracting for %s', out_class, in_class)
+ continue
+
try:
zipjar.extract(out_class, outpathlk[side])
self.logger.info('> Outputted %s to %s as %s', in_class.ljust(35), outpathlk[side], out_class)
@@ -1605,6 +1636,9 @@
sys.exit(1)
for entry in newfiles:
@@ -198,7 +157,7 @@
if entry[3] == 'U':
self.logger.info('Retrieving file from server : %s', entry[0])
cur_file = os.path.normpath(entry[0])
@@ -1614,6 +1656,9 @@
@@ -1625,6 +1659,9 @@
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
@@ -208,28 +167,3 @@
# HINT: We need a table for the old md5 and the new ones
md5table = {}
@@ -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'
+
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.lang.annotation.ElementType;
+13 -1
View File
@@ -1,8 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
/**
* A marker interface for retrieving a proxy to a bukkit plugin.
* Fields associated with {@link BukkitPluginRef} annotations should be should probably
* Fields associated with {@link BukkitPluginRef} annotations should
* declare this type and cast down if the target is available (not null)
* @author cpw
*
@@ -0,0 +1,68 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.security.cert.Certificate;
public class CertificateHelper {
private static final String HEXES = "0123456789abcdef";
public static String getFingerprint(Certificate certificate)
{
if (certificate == null)
{
return "NO VALID CERTIFICATE FOUND";
}
try
{
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] der = certificate.getEncoded();
md.update(der);
byte[] digest = md.digest();
return hexify(digest);
}
catch (Exception e)
{
return null;
}
}
public static String getFingerprint(ByteBuffer buffer)
{
try
{
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(buffer);
byte[] chksum = digest.digest();
return hexify(chksum);
}
catch (Exception e)
{
return null;
}
}
private static String hexify(byte[] chksum)
{
final StringBuilder hex = new StringBuilder( 2 * chksum.length );
for ( final byte b : chksum ) {
hex.append(HEXES.charAt((b & 0xF0) >> 4))
.append(HEXES.charAt((b & 0x0F)));
}
return hex.toString();
}
}
@@ -1,6 +1,19 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
import java.security.cert.Certificate;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -138,4 +151,10 @@ public class DummyModContainer implements ModContainer
{
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
}
@Override
public Certificate getSigningCertificate()
{
return null;
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
@@ -1,16 +1,15 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.EnumSet;
@@ -18,30 +17,33 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.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.ThreadMinecraftServer;
import net.minecraft.src.World;
import net.minecraft.src.WorldInfo;
import net.minecraft.server.ServerListenThread;
import net.minecraft.server.ThreadMinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Lists;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -49,7 +51,9 @@ import com.google.common.collect.Sets;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.server.FMLServerHandler;
@@ -90,10 +94,10 @@ public class FMLCommonHandler
public void beginLoading(IFMLSidedHandler handler)
{
sidedDelegate = handler;
FMLLog.info("Attempting early MinecraftForge initialization");
FMLLog.log("MinecraftForge", Level.INFO, "Attempting early MinecraftForge initialization");
callForgeMethod("initialize");
callForgeMethod("registerCrashCallable");
FMLLog.info("Completed early MinecraftForge initialization");
FMLLog.log("MinecraftForge", Level.INFO, "Completed early MinecraftForge initialization");
}
public void rescheduleTicks(Side side)
@@ -111,7 +115,7 @@ public class FMLCommonHandler
for (IScheduledTickHandler ticker : scheduledTicks)
{
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
ticksToRun.removeAll(EnumSet.complementOf(ticks));
ticksToRun.retainAll(ticks);
if (!ticksToRun.isEmpty())
{
ticker.tickStart(ticksToRun, data);
@@ -130,7 +134,7 @@ public class FMLCommonHandler
for (IScheduledTickHandler ticker : scheduledTicks)
{
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
ticksToRun.removeAll(EnumSet.complementOf(ticks));
ticksToRun.retainAll(ticks);
if (!ticksToRun.isEmpty())
{
ticker.tickEnd(ticksToRun, data);
@@ -187,7 +191,7 @@ public class FMLCommonHandler
*/
public void raiseException(Throwable exception, String message, boolean stopGame)
{
FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception);
FMLLog.log(Level.SEVERE, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
if (stopGame)
{
getSidedDelegate().haltGame(message,exception);
@@ -302,9 +306,14 @@ public class FMLCommonHandler
}
}
public void handleServerStarting(MinecraftServer server)
public boolean handleServerAboutToStart(MinecraftServer server)
{
Loader.instance().serverStarting(server);
return Loader.instance().serverAboutToStart(server);
}
public boolean handleServerStarting(MinecraftServer server)
{
return Loader.instance().serverStarting(server);
}
public void handleServerStarted()
@@ -441,4 +450,23 @@ public class FMLCommonHandler
}
}
}
public boolean shouldServerBeKilledQuietly()
{
if (sidedDelegate == null)
{
return false;
}
return sidedDelegate.shouldServerShouldBeKilledQuietly();
}
public void disconnectIDMismatch(MapDifference<Integer, ItemData> serverDifference, NetHandler toKill, INetworkManager network)
{
sidedDelegate.disconnectIDMismatch(serverDifference, toKill, network);
}
public void handleServerStopped()
{
Loader.instance().serverStopped();
}
}
@@ -1,35 +1,35 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
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 net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.ItemData;
/**
* @author cpw
*
@@ -50,8 +50,8 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
"to cooperate and provide a good modding environment. " +
"The mod loading system is compatible with ModLoader, all your ModLoader " +
"mods should work.";
meta.url="https://github.com/cpw/FML/wiki";
meta.updateUrl="https://github.com/cpw/FML/wiki";
meta.url="https://github.com/MinecraftForge/FML/wiki";
meta.updateUrl="https://github.com/MinecraftForge/FML/wiki";
meta.screenshots=new String[0];
meta.logoFile="";
}
@@ -75,6 +75,9 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
list.func_74742_a(mod);
}
fmlData.func_74782_a("ModList", list);
NBTTagList itemList = new NBTTagList();
GameData.writeItemData(itemList);
fmlData.func_74782_a("ModItemData", itemList);
return fmlData;
}
@@ -92,14 +95,32 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
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);
FMLLog.log("fml.ModTracker", Level.SEVERE, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
continue;
}
if (!modVersion.equals(container.getVersion()))
{
FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
FMLLog.log("fml.ModTracker", Level.INFO, "This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
}
}
}
if (tag.func_74764_b("ModItemData"))
{
NBTTagList modList = tag.func_74761_m("ModItemData");
Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
GameData.validateWorldSave(worldSaveItems);
}
else
{
GameData.validateWorldSave(null);
}
}
@Override
public Certificate getSigningCertificate()
{
Certificate[] certificates = getClass().getProtectionDomain().getCodeSource().getCertificates();
return certificates != null ? certificates[0] : null;
}
}
+27
View File
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.logging.Level;
@@ -7,11 +19,21 @@ public class FMLLog
{
private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;
public static void log(String logChannel, Level level, String format, Object... data)
{
coreLog.log(logChannel, level, format, data);
}
public static void log(Level level, String format, Object... data)
{
coreLog.log(level, format, data);
}
public static void log(String logChannel, Level level, Throwable ex, String format, Object... data)
{
coreLog.log(logChannel, level, ex, format, data);
}
public static void log(Level level, Throwable ex, String format, Object... data)
{
coreLog.log(level, ex, format, data);
@@ -50,4 +72,9 @@ public class FMLLog
{
return coreLog.getLogger();
}
public static void makeLog(String logChannel)
{
coreLog.makeLog(logChannel);
}
}
+104 -23
View File
@@ -18,6 +18,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -29,11 +30,16 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
@@ -49,10 +55,13 @@ 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.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.event.FMLStateEvent;
import cpw.mods.fml.common.network.FMLNetworkHandler;
@@ -82,23 +91,57 @@ public class FMLModContainer implements ModContainer
.put(FMLPreInitializationEvent.class, Mod.PreInit.class)
.put(FMLInitializationEvent.class, Mod.Init.class)
.put(FMLPostInitializationEvent.class, Mod.PostInit.class)
.put(FMLServerAboutToStartEvent.class, Mod.ServerAboutToStart.class)
.put(FMLServerStartingEvent.class, Mod.ServerStarting.class)
.put(FMLServerStartedEvent.class, Mod.ServerStarted.class)
.put(FMLServerStoppingEvent.class, Mod.ServerStopping.class)
.put(FMLServerStoppedEvent.class, Mod.ServerStopped.class)
.put(IMCEvent.class,Mod.IMCCallback.class)
.put(FMLFingerprintViolationEvent.class, Mod.FingerprintWarning.class)
.build();
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
private String annotationDependencies;
private VersionRange minecraftAccepted;
private boolean fingerprintNotPresent;
private Set<String> sourceFingerprints;
private Certificate certificate;
private String modLanguage;
private ILanguageAdapter languageAdapter;
public static interface ILanguageAdapter {
public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader) throws Exception;
}
public static class ScalaAdapter implements ILanguageAdapter {
@Override
public Object getNewInstance(FMLModContainer container, Class<?> scalaObjectClass, ClassLoader classLoader) throws Exception
{
System.out.println("Scala class : "+ scalaObjectClass);
Class<?> sObjectClass = Class.forName(scalaObjectClass.getName()+"$",true,classLoader);
return sObjectClass.getField("MODULE$").get(null);
}
}
public static class JavaAdapter implements ILanguageAdapter {
@Override
public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader) throws Exception
{
return objectClass.newInstance();
}
}
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
{
this.className = className;
this.source = modSource;
this.descriptor = modDescriptor;
this.modLanguage = (String) modDescriptor.get("modLanguage");
this.languageAdapter = "scala".equals(modLanguage) ? new ScalaAdapter() : new JavaAdapter();
}
private ILanguageAdapter getLanguageAdapter()
{
return languageAdapter;
}
@Override
public String getModId()
{
@@ -149,15 +192,15 @@ public class FMLModContainer implements ModContainer
modMetadata.requiredMods = requirements;
modMetadata.dependencies = dependencies;
modMetadata.dependants = dependants;
FMLLog.finest("Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
FMLLog.log(getModId(), Level.FINEST, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
}
else
{
FMLLog.finest("Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
FMLLog.log(getModId(), Level.FINEST, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
}
if (Strings.isNullOrEmpty(modMetadata.name))
{
FMLLog.info("Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId());
FMLLog.log(getModId(), Level.INFO,"Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId());
modMetadata.name = getModId();
}
internalVersion = (String) descriptor.get("version");
@@ -167,18 +210,18 @@ public class FMLModContainer implements ModContainer
if (versionProps != null)
{
internalVersion = versionProps.getProperty(getModId()+".version");
FMLLog.fine("Found version %s for mod %s in version.properties, using", internalVersion, getModId());
FMLLog.log(getModId(), Level.FINE, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
}
}
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
{
FMLLog.warning("Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
internalVersion = modMetadata.version;
}
if (Strings.isNullOrEmpty(internalVersion))
{
FMLLog.warning("Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
FMLLog.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0";
}
@@ -197,7 +240,7 @@ public class FMLModContainer implements ModContainer
{
try
{
FMLLog.fine("Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
FMLLog.log(getModId(), Level.FINE,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
Properties version = null;
if (getSource().isFile())
{
@@ -226,7 +269,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.fine("Failed to find a usable version.properties file");
FMLLog.log(getModId(), Level.FINEST, "Failed to find a usable version.properties file");
return null;
}
}
@@ -278,7 +321,7 @@ public class FMLModContainer implements ModContainer
{
if (this.enabled)
{
FMLLog.fine("Enabling mod %s", getModId());
FMLLog.log(getModId(), Level.FINE, "Enabling mod %s", getModId());
this.eventBus = bus;
this.controller = controller;
eventBus.register(this);
@@ -309,7 +352,7 @@ public class FMLModContainer implements ModContainer
}
else
{
FMLLog.severe("The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes));
FMLLog.log(getModId(), Level.SEVERE,"The mod %s appears to have an invalid method annotation %s. This annotation can only apply to methods with argument types %s -it will not be called", getModId(), a.annotationType().getSimpleName(), Arrays.toString(paramTypes));
}
}
}
@@ -335,13 +378,6 @@ public class FMLModContainer implements ModContainer
return mc.getMetadata();
}
});
//TODO
// for (Object o : annotations.get(Block.class))
// {
// Field f = (Field) o;
// f.set(modInstance, GameRegistry.buildBlock(this, f.getType(), f.getAnnotation(Block.class)));
// }
}
private void parseSimpleFieldAnnotation(SetMultimap<String, ASMData> annotations, String annotationClassName, Function<ModContainer, Object> retreiver) throws IllegalAccessException
@@ -380,7 +416,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
FMLLog.log(getModId(), Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
}
}
if (f != null)
@@ -391,7 +427,7 @@ public class FMLModContainer implements ModContainer
target = modInstance;
if (!modInstance.getClass().equals(clz))
{
FMLLog.warning("Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
FMLLog.log(getModId(), Level.WARNING, "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance", annotationName, targets.getClassName(), targets.getObjectName(), mc.getModId());
continue;
}
}
@@ -408,12 +444,51 @@ public class FMLModContainer implements ModContainer
ModClassLoader modClassLoader = event.getModClassLoader();
modClassLoader.addFile(source);
Class<?> clazz = Class.forName(className, true, modClassLoader);
ASMDataTable asmHarvestedAnnotations = event.getASMHarvestedData();
// TODO
asmHarvestedAnnotations.getAnnotationsFor(this);
Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
int len = 0;
if (certificates != null)
{
len = certificates.length;
}
Builder<String> certBuilder = ImmutableList.<String>builder();
for (int i = 0; i < len; i++)
{
certBuilder.add(CertificateHelper.getFingerprint(certificates[i]));
}
ImmutableList<String> certList = certBuilder.build();
sourceFingerprints = ImmutableSet.copyOf(certList);
String expectedFingerprint = (String) descriptor.get("certificateFingerprint");
fingerprintNotPresent = true;
if (expectedFingerprint != null && !expectedFingerprint.isEmpty())
{
if (!sourceFingerprints.contains(expectedFingerprint))
{
Level warnLevel = Level.SEVERE;
if (source.isDirectory())
{
warnLevel = Level.FINER;
}
FMLLog.log(getModId(), warnLevel, "The mod %s is expecting signature %s for source %s, however there is no signature matching that description", getModId(), expectedFingerprint, source.getName());
}
else
{
certificate = certificates[certList.indexOf(expectedFingerprint)];
fingerprintNotPresent = false;
}
}
annotations = gatherAnnotations(clazz);
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, clazz, event.getASMHarvestedData());
modInstance = clazz.newInstance();
modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader);
if (fingerprintNotPresent)
{
eventBus.post(new FMLFingerprintViolationEvent(source.isDirectory(), source, ImmutableSet.copyOf(this.sourceFingerprints), expectedFingerprint));
}
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
processFieldAnnotations(event.getASMHarvestedData());
}
@@ -479,4 +554,10 @@ public class FMLModContainer implements ModContainer
{
return minecraftAccepted;
}
@Override
public Certificate getSigningCertificate()
{
return certificate;
}
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import org.objectweb.asm.tree.ClassNode;
public interface IASMHook {
/**
* Inject the {@link Mod} class node into this instance. This allows retrieval from custom
* attributes or other artifacts in your mod class
*
* @param modClassNode The mod class
* @return optionally some code generated classes that will be injected into the classloader
*/
ClassNode[] inject(ClassNode modClassNode);
/**
* Allow mods to manipulate classes loaded from this {@link Mod}'s jar file. The {@link Mod}
* class is always guaranteed to be called first.
* The node state should be changed in place.
*
* @param node The class being loaded
*/
void modifyClass(String className, ClassNode node);
}
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
@@ -1,21 +1,20 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
/**
* Return a crafting handler for the mod container to call
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.concurrent.Callable;
@@ -1,41 +0,0 @@
/*
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package cpw.mods.fml.common;
import java.util.Random;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
public interface IDispenseHandler
{
/**
* Return -1 if you don't want to dispense anything. the other values seem to have specific meanings
* to blockdispenser.
*
* @param x
* @param y
* @param z
* @param xVelocity
* @param zVelocity
* @param world
* @param item
* @param random
* @param entX
* @param entY
* @param entZ
*/
@Deprecated
int dispense(double x, double y, double z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
}
@@ -1,29 +0,0 @@
package cpw.mods.fml.common;
import java.util.Random;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
/**
* @author cpw
*
*/
public interface IDispenserHandler
{
/**
* Called to dispense an entity
* @param x
* @param y
* @param z
* @param xVelocity
* @param zVelocity
* @param world
* @param item
* @param random
* @param entX
* @param entY
* @param entZ
*/
int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
public interface IFMLHandledException
@@ -1,16 +1,33 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.List;
import com.google.common.collect.MapDifference;
import net.minecraft.entity.Entity;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.Entity;
import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet131MapData;
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.network.ModMissingPacket;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side;
public interface IFMLSidedHandler
{
@@ -41,4 +58,8 @@ public interface IFMLSidedHandler
void setClientCompatibilityLevel(byte compatibilityLevel);
byte getClientCompatibilityLevel();
boolean shouldServerShouldBeKilledQuietly();
void disconnectIDMismatch(MapDifference<Integer, ItemData> s, NetHandler toKill, INetworkManager mgr);
}
+14 -2
View File
@@ -1,8 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import net.minecraft.src.ItemStack;
import net.minecraft.item.ItemStack;
public interface IFuelHandler
{
int getBurnTime(ItemStack fuel);
}
}
+12 -13
View File
@@ -1,20 +1,19 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
public interface IPickupNotifier
{
+10 -12
View File
@@ -1,20 +1,18 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import net.minecraft.src.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer;
/**
* @author cpw
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
public interface IScheduledTickHandler extends ITickHandler
+9 -11
View File
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
+13 -13
View File
@@ -1,22 +1,22 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.Random;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.World;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
/**
* This is called back during world generation.
@@ -1,6 +1,19 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
import java.security.cert.Certificate;
import java.util.List;
import java.util.Set;
@@ -129,4 +142,10 @@ public class InjectedModContainer implements ModContainer
return null;
}
}
@Override
public Certificate getSigningCertificate()
{
return wrappedContainer.getSigningCertificate();
}
}
+44 -14
View File
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.lang.reflect.InvocationTargetException;
@@ -5,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.base.Joiner;
import com.google.common.collect.ArrayListMultimap;
@@ -60,14 +73,16 @@ public class LoadController
boolean isActive = mod.registerBus(bus, this);
if (isActive)
{
FMLLog.fine("Activating mod %s", mod.getModId());
Level level = Logger.getLogger(mod.getModId()).getLevel();
FMLLog.log(mod.getModId(), Level.FINE, "Mod Logging channel %s configured at %s level.", mod.getModId(), level == null ? "default" : level);
FMLLog.log(mod.getModId(), Level.INFO, "Activating mod %s", mod.getModId());
activeModList.add(mod);
modStates.put(mod.getModId(), ModState.UNLOADED);
eventBus.put(mod.getModId(), bus);
}
else
{
FMLLog.warning("Mod %s has been disabled through configuration", mod.getModId());
FMLLog.log(mod.getModId(), Level.WARNING, "Mod %s has been disabled through configuration", mod.getModId());
modStates.put(mod.getModId(), ModState.UNLOADED);
modStates.put(mod.getModId(), ModState.DISABLED);
}
@@ -94,20 +109,30 @@ public class LoadController
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
StringBuilder sb = new StringBuilder();
printModStates(sb);
FMLLog.severe(sb.toString());
FMLLog.severe("The following problems were captured during this phase");
for (Entry<String, Throwable> error : errors.entries())
FMLLog.getLogger().severe(sb.toString());
if (errors.size()>0)
{
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
if (error.getValue() instanceof IFMLHandledException)
FMLLog.severe("The following problems were captured during this phase");
for (Entry<String, Throwable> error : errors.entries())
{
toThrow = error.getValue();
}
else if (toThrow == null)
{
toThrow = error.getValue();
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();
}
}
}
else
{
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" +
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
"ForgeModLoader, especially Optifine, to see if there are fixes available.");
throw new RuntimeException("The ForgeModLoader state engine is invalid");
}
if (toThrow != null && toThrow instanceof RuntimeException)
{
throw (RuntimeException)toThrow;
@@ -136,9 +161,9 @@ public class LoadController
activeContainer = mc;
String modId = mc.getModId();
stateEvent.applyModContainer(activeContainer());
FMLLog.finer("Sending event %s to mod %s", stateEvent.getEventType(), modId);
FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
eventChannels.get(modId).post(stateEvent);
FMLLog.finer("Sent event %s to mod %s", stateEvent.getEventType(), modId);
FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
activeContainer = null;
if (stateEvent instanceof FMLStateEvent)
{
@@ -237,4 +262,9 @@ public class LoadController
boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
}
void forceState(LoaderState newState)
{
this.state = newState;
}
}
+99 -30
View File
@@ -1,16 +1,15 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
@@ -26,7 +25,7 @@ import java.util.Set;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import net.minecraft.src.CallableMinecraftVersion;
import net.minecraft.crash.CallableMinecraftVersion;
import com.google.common.base.CharMatcher;
import com.google.common.base.Function;
@@ -56,11 +55,13 @@ 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;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.toposort.ModSorter;
import cpw.mods.fml.common.toposort.ModSortingException;
import cpw.mods.fml.common.toposort.TopologicalSort;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.VersionParser;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
/**
* The loader class performs the actual loading of the mod code from disk.
@@ -142,6 +143,7 @@ public class Loader
private static File minecraftDir;
private static List<String> injectedContainers;
private File loggingProperties;
public static Loader instance()
{
@@ -186,7 +188,7 @@ public class Loader
*/
private void sortModList()
{
FMLLog.fine("Verifying mod requirements are satisfied");
FMLLog.finer("Verifying mod requirements are satisfied");
try
{
BiMap<String, ArtifactVersion> modVersions = HashBiMap.create();
@@ -238,13 +240,13 @@ public class Loader
}
}
FMLLog.fine("All mod requirements are satisfied");
FMLLog.finer("All mod requirements are satisfied");
ModSorter sorter = new ModSorter(getActiveModList(), namedMods);
try
{
FMLLog.fine("Sorting mods into an ordered list");
FMLLog.finer("Sorting mods into an ordered list");
List<ModContainer> sortedMods = sorter.sort();
// Reset active list to the sorted list
modController.getActiveModList().clear();
@@ -253,7 +255,7 @@ public class Loader
mods.removeAll(sortedMods);
sortedMods.addAll(mods);
mods = sortedMods;
FMLLog.fine("Mod sorting completed successfully");
FMLLog.finer("Mod sorting completed successfully");
}
catch (ModSortingException sortException)
{
@@ -266,17 +268,19 @@ public class Loader
}
finally
{
FMLLog.fine("Mod sorting data:");
FMLLog.fine("Mod sorting data");
int unprintedMods = mods.size();
for (ModContainer mod : getActiveModList())
{
if (!mod.isImmutable())
{
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), mod.getSortingRules());
unprintedMods--;
}
}
if (mods.size()==0)
if (unprintedMods == mods.size())
{
FMLLog.fine("No mods found to sort");
FMLLog.fine("No user mods found to sort");
}
}
@@ -335,6 +339,10 @@ public class Loader
identifyDuplicates(mods);
namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
for (String modId: namedMods.keySet())
{
FMLLog.makeLog(modId);
}
return discoverer;
}
@@ -376,7 +384,7 @@ public class Loader
}
/**
* @return
*
*/
private void initializeLoader()
{
@@ -435,6 +443,11 @@ public class Loader
FMLLog.severe("Attempting to load configuration from %s, which is not a directory", canonicalConfigPath);
throw new LoaderException();
}
loggingProperties = new File(canonicalConfigDir, "logging.properties");
FMLLog.info("Reading custom logging properties from %s", loggingProperties.getPath());
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
FMLLog.log(Level.OFF,"Logging level for ForgeModLoader logging is set to %s", FMLRelaunchLog.log.getLogger().getLevel());
}
public List<ModContainer> getModList()
@@ -456,6 +469,9 @@ public class Loader
modController.transition(LoaderState.LOADING);
ModDiscoverer disc = identifyMods();
disableRequestedMods();
FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
FMLRelaunchLog.loadLogConfiguration(loggingProperties);
FMLLog.fine("Reloaded logging properties");
modController.distributeStateMessage(FMLLoadEvent.class);
sortModList();
mods = ImmutableList.copyOf(mods);
@@ -476,6 +492,15 @@ public class Loader
}
modController.transition(LoaderState.CONSTRUCTING);
modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
FMLLog.fine("Mod signature data");
for (ModContainer mod : getActiveModList())
{
FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate()));
}
if (getActiveModList().isEmpty())
{
FMLLog.fine("No user mod signature data found");
}
modController.transition(LoaderState.PREINITIALIZATION);
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
modController.transition(LoaderState.INITIALIZATION);
@@ -484,22 +509,22 @@ public class Loader
private void disableRequestedMods()
{
String forcedModList = System.getProperty("fml.modStates", "");
FMLLog.fine("Received a system property request \'%s\'",forcedModList);
FMLLog.finer("Received a system property request \'%s\'",forcedModList);
Map<String, String> sysPropertyStateList = Splitter.on(CharMatcher.anyOf(";:"))
.omitEmptyStrings().trimResults().withKeyValueSeparator("=")
.split(forcedModList);
FMLLog.fine("System property request managing the state of %d mods", sysPropertyStateList.size());
FMLLog.finer("System property request managing the state of %d mods", sysPropertyStateList.size());
Map<String, String> modStates = Maps.newHashMap();
File forcedModFile = new File(canonicalConfigDir, "fmlModState.properties");
Properties forcedModListProperties = new Properties();
if (forcedModFile.exists() && forcedModFile.isFile())
{
FMLLog.fine("Found a mod state file %s", forcedModFile.getName());
FMLLog.finer("Found a mod state file %s", forcedModFile.getName());
try
{
forcedModListProperties.load(new FileReader(forcedModFile));
FMLLog.fine("Loaded states for %d mods from file", forcedModListProperties.size());
FMLLog.finer("Loaded states for %d mods from file", forcedModListProperties.size());
}
catch (Exception e)
{
@@ -546,6 +571,11 @@ public class Loader
public String getCrashInformation()
{
// Handle being called before we've begun setup
if (modController == null)
{
return "";
}
StringBuilder ret = new StringBuilder();
List<String> branding = FMLCommonHandler.instance().getBrandings();
@@ -650,6 +680,8 @@ public class Loader
// Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION);
modController.transition(LoaderState.POSTINITIALIZATION);
// Construct the "mod object table" so mods can refer to it in IMC and postinit
GameData.buildModObjectTable();
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
modController.transition(LoaderState.AVAILABLE);
@@ -689,10 +721,19 @@ public class Loader
return "Minecraft " + mccversion;
}
public void serverStarting(Object server)
public boolean serverStarting(Object server)
{
modController.distributeStateMessage(LoaderState.SERVER_STARTING, server);
modController.transition(LoaderState.SERVER_STARTING);
try
{
modController.distributeStateMessage(LoaderState.SERVER_STARTING, server);
modController.transition(LoaderState.SERVER_STARTING);
}
catch (Throwable t)
{
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server starting event");
return false;
}
return true;
}
public void serverStarted()
@@ -705,8 +746,6 @@ public class Loader
{
modController.distributeStateMessage(LoaderState.SERVER_STOPPING);
modController.transition(LoaderState.SERVER_STOPPING);
modController.transition(LoaderState.AVAILABLE);
}
public BiMap<ModContainer, Object> getModObjectList()
@@ -721,7 +760,7 @@ public class Loader
public ModContainer activeModContainer()
{
return modController.activeContainer();
return modController != null ? modController.activeContainer() : null;
}
public boolean isInState(LoaderState state)
@@ -735,10 +774,40 @@ public class Loader
}
public boolean hasReachedState(LoaderState state) {
return modController.hasReachedState(state);
return modController != null ? modController.hasReachedState(state) : false;
}
public String getMCPVersionString() {
return String.format("MCP v%s", mcpversion);
}
public void serverStopped()
{
modController.distributeStateMessage(LoaderState.SERVER_STOPPED);
try
{
modController.transition(LoaderState.SERVER_STOPPED);
}
catch (LoaderException e)
{
modController.forceState(LoaderState.SERVER_STOPPED);
// Discard any exceptions here - they mask other, real, exceptions
}
modController.transition(LoaderState.AVAILABLE);
}
public boolean serverAboutToStart(Object server)
{
try
{
modController.distributeStateMessage(LoaderState.SERVER_ABOUT_TO_START, server);
modController.transition(LoaderState.SERVER_ABOUT_TO_START);
}
catch (Throwable t)
{
FMLLog.log(Level.SEVERE, t, "A fatal exception occurred during the server about to start event");
return false;
}
return true;
}
}
+11 -12
View File
@@ -1,16 +1,15 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
public class LoaderException extends RuntimeException
@@ -28,4 +27,4 @@ public class LoaderException extends RuntimeException
public LoaderException()
{
}
}
}
+18 -2
View File
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import com.google.common.base.Throwables;
@@ -8,8 +20,10 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.event.FMLStateEvent;
@@ -27,9 +41,11 @@ public enum LoaderState
INITIALIZATION("Initializing mods", FMLInitializationEvent.class),
POSTINITIALIZATION("Post-initializing mods", FMLPostInitializationEvent.class),
AVAILABLE("Mod loading complete", FMLLoadCompleteEvent.class),
SERVER_ABOUT_TO_START("Server about to start", FMLServerAboutToStartEvent.class),
SERVER_STARTING("Server starting", FMLServerStartingEvent.class),
SERVER_STARTED("Server started", FMLServerStartedEvent.class),
SERVER_STOPPING("Server stopping", FMLServerStoppingEvent.class),
SERVER_STOPPED("Server stopped", FMLServerStoppedEvent.class),
ERRORED("Mod Loading errored",null);
@@ -49,7 +65,7 @@ public enum LoaderState
return ERRORED;
}
// stopping -> available
if (this == SERVER_STOPPING)
if (this == SERVER_STOPPED)
{
return AVAILABLE;
}
@@ -101,4 +117,4 @@ public enum LoaderState
return this.label;
}
}
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import com.google.common.eventbus.EventBus;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.InputStream;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import cpw.mods.fml.common.versioning.ArtifactVersion;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.Set;
+63 -13
View File
@@ -1,16 +1,15 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.lang.annotation.ElementType;
@@ -18,11 +17,11 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import net.minecraft.item.ItemBlock;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraft.src.ItemBlock;
/**
* The new mod style in FML 1.3
*
@@ -100,6 +99,41 @@ public @interface Mod
* @return A string listing modids to exclude from loading with this mod.
*/
String modExclusionList() default "";
/**
* Specifying this field allows for a mod to expect a signed jar with a fingerprint matching this value.
* The fingerprint should be SHA-1 encoded, lowercase with ':' removed. An empty value indicates that
* the mod is not expecting to be signed.
*
* Any incorrectness of the fingerprint, be it missing or wrong, will result in the {@link FingerprintWarning}
* method firing <i>prior to any other event on the mod</i>.
*
* @return A certificate fingerprint that is expected for this mod.
*/
String certificateFingerprint() default "";
/**
* The language the mod is authored in. This will be used to control certain libraries being downloaded.
* Valid values are currently "java", "scala"
*
* @return The language the mod is authored in
*/
String modLanguage() default "java";
/**
* An optional ASM hook class, that can be used to apply ASM to classes loaded from this mod. It is also given
* the ASM tree of the class declaring {@link Mod} to with what it will.
*
* @return The name of a class to be loaded and executed. Must implement {@link IASMHook}.
*/
String asmHookClass() default "";
/**
* Mark the designated method as to be called at if there is something wrong with the certificate fingerprint of
* the mod's jar, or it is missing, or otherwise a problem.
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface FingerprintWarning {}
/**
* Mark the designated method as being called at the "pre-initialization" phase
* @author cpw
@@ -124,6 +158,14 @@ public @interface Mod
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface PostInit {}
/**
* Mark the designated method as being called at the "server-about-to-start" phase
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ServerAboutToStart {}
/**
* Mark the designated method as being called at the "server-starting" phase
* @author cpw
@@ -148,6 +190,14 @@ public @interface Mod
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ServerStopping {}
/**
* Mark the designated method as being called at the "server-stopped" phase
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ServerStopped {}
/**
* Mark the designated method as the receiver for {@link FMLInterModComms} messages
* Called between {@link Init} and {@link PostInit}
+11 -12
View File
@@ -1,16 +1,15 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
@@ -70,7 +69,7 @@ public class ModClassLoader extends URLClassLoader
}
catch (URISyntaxException e)
{
FMLLog.log(Level.SEVERE, "Unable to process our input to locate the minecraft code", e);
FMLLog.log(Level.SEVERE, e, "Unable to process our input to locate the minecraft code");
throw new LoaderException(e);
}
}
+15 -13
View File
@@ -1,19 +1,19 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
import java.security.cert.Certificate;
import java.util.List;
import java.util.Set;
@@ -80,13 +80,13 @@ public interface ModContainer
/**
* A list of modids that should be loaded prior to this one. The special
* value <strong>*</strong> indicates to load <em>before</em> any other mod.
* value <strong>*</strong> indicates to load <em>after</em> any other mod.
*/
List<ArtifactVersion> getDependencies();
/**
* A list of modids that should be loaded <em>after</em> this one. The
* special value <strong>*</strong> indicates to load <em>after</em> any
* special value <strong>*</strong> indicates to load <em>before</em> any
* other mod.
*/
List<ArtifactVersion> getDependants();
@@ -129,4 +129,6 @@ public interface ModContainer
String getDisplayVersion();
VersionRange acceptableMinecraftVersionRange();
Certificate getSigningCertificate();
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.io.File;
+9 -11
View File
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
@@ -15,6 +15,7 @@ package cpw.mods.fml.common;
import java.util.Arrays;
import java.util.logging.Level;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToAccessFieldException;
import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
@@ -27,8 +28,6 @@ import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
*/
public class ObfuscationReflectionHelper
{
public static boolean obfuscation;
@SuppressWarnings("unchecked")
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
{
@@ -43,12 +42,23 @@ public class ObfuscationReflectionHelper
}
}
public static String[] remapFieldNames(String className, String... fieldNames)
{
String internalClassName = FMLDeobfuscatingRemapper.INSTANCE.unmap(className.replace('.', '/'));
String[] mappedNames = new String[fieldNames.length];
int i = 0;
for (String fName : fieldNames)
{
mappedNames[i++] = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(internalClassName, fName, null);
}
return mappedNames;
}
@SuppressWarnings("unchecked")
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, String... fieldNames)
{
try
{
return ReflectionHelper.getPrivateValue(classToAccess, instance, fieldNames);
return ReflectionHelper.getPrivateValue(classToAccess, instance, remapFieldNames(classToAccess.getName(),fieldNames));
}
catch (UnableToFindFieldException e)
{
@@ -91,7 +101,7 @@ public class ObfuscationReflectionHelper
{
try
{
ReflectionHelper.setPrivateValue(classToAccess, instance, value, fieldNames);
ReflectionHelper.setPrivateValue(classToAccess, instance, value, remapFieldNames(classToAccess.getName(), fieldNames));
}
catch (UnableToFindFieldException e)
{
@@ -104,13 +114,4 @@ public class ObfuscationReflectionHelper
throw e;
}
}
/**
*
*/
public static void detectObfuscation(Class<?> clazz)
{
obfuscation = !clazz.getSimpleName().equals("World");
}
}
+10 -11
View File
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
@@ -21,6 +19,7 @@ import java.util.logging.Level;
import cpw.mods.fml.common.discovery.ASMDataTable;
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
import cpw.mods.fml.relauncher.Side;
/**
* @author cpw
-35
View File
@@ -1,35 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package cpw.mods.fml.common;
public enum Side {
CLIENT, SERVER, BUKKIT;
/**
* @return If this is the server environment
*/
public boolean isServer()
{
return !isClient();
}
/**
* @return if this is the Client environment
*/
public boolean isClient()
{
return this == CLIENT;
}
}
+9 -11
View File
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.EnumSet;
+9 -26
View File
@@ -1,15 +1,13 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
@@ -30,19 +28,6 @@ public enum TickType {
* arg 0 : float "partial render time"
*/
RENDER,
/**
* client side
* Fired during the render processing phase if a GUI is open
* arg 0 : float "partial render time"
* arg 1 : the open gui or null if no gui is open
*/
GUI,
/**
* client side
* Fired during the client evaluation loop
* arg 0 : The open gui or null if no gui is open
*/
CLIENTGUI,
/**
* server side
* Fired once as the world loads from disk
@@ -74,8 +59,6 @@ public enum TickType {
{
if (this==CLIENT) return EnumSet.of(RENDER);
if (this==RENDER) return EnumSet.of(CLIENT);
if (this==GUI) return EnumSet.of(CLIENTGUI);
if (this==CLIENTGUI) return EnumSet.of(GUI);
return EnumSet.noneOf(TickType.class);
}
}
}
@@ -1,11 +1,22 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
import java.util.Map;
import net.minecraft.src.NBTBase;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.SaveHandler;
import net.minecraft.src.WorldInfo;
import net.minecraft.nbt.*;
import net.minecraft.world.storage.*;
public interface WorldAccessContainer
{
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common;
public class WrongMinecraftVersionException extends RuntimeException
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm;
import org.objectweb.asm.ClassReader;
@@ -12,7 +24,7 @@ import cpw.mods.fml.relauncher.IClassTransformer;
public class ASMTransformer implements IClassTransformer
{
@Override
public byte[] transform(String name, byte[] bytes)
public byte[] transform(String name,String transformedName, byte[] bytes)
{
if ("net.minecraft.src.Block".equals(name))
{
@@ -24,7 +36,7 @@ public class ASMTransformer implements IClassTransformer
cn.accept(cw);
return cw.toByteArray();
}
return bytes;
}
@@ -1,5 +1,35 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStreamReader;
import java.io.ObjectInputStream.GetField;
import java.io.StringReader;
import java.net.JarURLConnection;
import java.nio.charset.Charset;
import java.security.CodeSource;
import java.security.cert.CertPath;
import java.security.cert.CertPathValidator;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.PKIXCertPathValidatorResult;
import java.security.cert.PKIXParameters;
import java.security.cert.TrustAnchor;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import javax.swing.JOptionPane;
@@ -9,11 +39,16 @@ import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
import cpw.mods.fml.common.CertificateHelper;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.IFMLCallHook;
import cpw.mods.fml.relauncher.RelaunchClassLoader;
public class FMLSanityChecker implements IFMLCallHook
{
private static final String FMLFINGERPRINT = "AE:F6:54:79:96:E9:1B:D1:59:70:6C:B4:6B:F5:4A:89:C5:CE:08:1D".toLowerCase().replace(":","");
private static final String FORGEFINGERPRINT = "DE:4C:F8:A3:F3:BC:15:63:58:10:04:4C:39:24:0B:F9:68:04:EA:7D".toLowerCase().replace(":", "");
static class MLDetectorClassVisitor extends ClassVisitor
{
private boolean foundMarker = false;
@@ -38,6 +73,42 @@ public class FMLSanityChecker implements IFMLCallHook
@Override
public Void call() throws Exception
{
CodeSource codeSource = getClass().getProtectionDomain().getCodeSource();
boolean goodFML = false;
if (codeSource.getLocation().getProtocol().equals("jar"))
{
Certificate[] certificates = codeSource.getCertificates();
if (certificates!=null)
{
for (Certificate cert : certificates)
{
String fingerprint = CertificateHelper.getFingerprint(cert);
if (fingerprint.equals(FMLFINGERPRINT))
{
FMLRelaunchLog.info("Found valid fingerprint for FML. Certificate fingerprint %s", fingerprint);
goodFML = true;
}
else if (fingerprint.equals(FORGEFINGERPRINT))
{
FMLRelaunchLog.info("Found valid fingerprint for Minecraft Forge. Certificate fingerprint %s", fingerprint);
goodFML = true;
}
else
{
FMLRelaunchLog.severe("Found invalid fingerprint for FML: %s", fingerprint);
}
}
}
}
else
{
goodFML = true;
}
if (!goodFML)
{
FMLRelaunchLog.severe("FML appears to be missing any signature data. This is not a good thing");
}
byte[] mlClass = cl.getClassBytes("ModLoader");
// Only care in obfuscated env
if (mlClass == null)
@@ -67,6 +138,7 @@ public class FMLSanityChecker implements IFMLCallHook
public void injectData(Map<String, Object> data)
{
cl = (RelaunchClassLoader) data.get("classLoader");
FMLDeobfuscatingRemapper.INSTANCE.setup((File)data.get("mcLocation"), cl, (String) data.get("deobfuscationFileName"));
}
}
@@ -0,0 +1,29 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to force certain classes to reobfuscate
* @author cpw
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface ReobfuscationMarker {
}
@@ -1,15 +0,0 @@
package cpw.mods.fml.common.asm;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import cpw.mods.fml.common.Side;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface SideOnly
{
public Side value();
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers;
import static org.objectweb.asm.Opcodes.ACC_FINAL;
@@ -35,6 +47,7 @@ import com.google.common.collect.Multimap;
import com.google.common.io.LineProcessor;
import com.google.common.io.Resources;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.IClassTransformer;
public class AccessTransformer implements IClassTransformer
@@ -143,15 +156,45 @@ public class AccessTransformer implements IClassTransformer
@SuppressWarnings("unchecked")
@Override
public byte[] transform(String name, byte[] bytes)
public byte[] transform(String name, String transformedName, byte[] bytes)
{
if (bytes == null) { return null; }
if (!modifiers.containsKey(name)) { return bytes; }
if (bytes == null) { return null; }
boolean makeAllPublic = FMLDeobfuscatingRemapper.INSTANCE.isRemappedClass(name);
if (DEBUG)
{
System.out.printf("Considering all methods and fields on %s (%s): %b\n", name, transformedName, makeAllPublic);
}
if (!makeAllPublic && !modifiers.containsKey(name)) { return bytes; }
ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0);
if (makeAllPublic)
{
// class
Modifier m = new Modifier();
m.targetAccess = ACC_PUBLIC;
m.modifyClassVisibility = true;
modifiers.put(name,m);
// fields
m = new Modifier();
m.targetAccess = ACC_PUBLIC;
m.name = "*";
modifiers.put(name,m);
// methods
m = new Modifier();
m.targetAccess = ACC_PUBLIC;
m.name = "*";
m.desc = "<dummy>";
modifiers.put(name,m);
if (DEBUG)
{
System.out.printf("Injected all public modifiers for %s (%s)\n", name, transformedName);
}
}
Collection<Modifier> mods = modifiers.get(name);
for (Modifier m : mods)
{
@@ -375,7 +418,7 @@ public class AccessTransformer implements IClassTransformer
for (AccessTransformer trans : transformers)
{
entryData = trans.transform(name, entryData);
entryData = trans.transform(name, name, entryData);
}
}
@@ -416,4 +459,4 @@ public class AccessTransformer implements IClassTransformer
m.modifyClassVisibility = true;
modifiers.put(modClazzName, m);
}
}
}
@@ -0,0 +1,54 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.RemappingClassAdapter;
import org.objectweb.asm.tree.ClassNode;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.common.asm.transformers.deobf.FMLRemappingAdapter;
import cpw.mods.fml.relauncher.IClassNameTransformer;
import cpw.mods.fml.relauncher.IClassTransformer;
public class DeobfuscationTransformer implements IClassTransformer, IClassNameTransformer {
@Override
public byte[] transform(String name, String transformedName, byte[] bytes)
{
if (bytes == null)
{
return null;
}
ClassReader classReader = new ClassReader(bytes);
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
RemappingClassAdapter remapAdapter = new FMLRemappingAdapter(classWriter);
classReader.accept(remapAdapter, ClassReader.EXPAND_FRAMES);
return classWriter.toByteArray();
}
@Override
public String remapClassName(String name)
{
return FMLDeobfuscatingRemapper.INSTANCE.map(name.replace('.','/')).replace('/', '.');
}
@Override
public String unmapClassName(String name)
{
return FMLDeobfuscatingRemapper.INSTANCE.unmap(name.replace('.', '/')).replace('/','.');
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers;
import java.io.BufferedOutputStream;
@@ -35,8 +47,8 @@ import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MCPMerger
{
@@ -45,6 +57,7 @@ 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)
@@ -134,11 +147,16 @@ public class MCPMerger
String line;
while ((line = br.readLine()) != null)
{
line = line.split("#")[0];
boolean toClient = line.charAt(0) == '<';
line = line.split("#")[0];
char cmd = line.charAt(0);
line = line.substring(1).trim();
if (toClient) copyToClient.add(line);
else copyToServer.add(line);
switch (cmd)
{
case '!': dontAnnotate.add(line); break;
case '<': copyToClient.add(line); break;
case '>': copyToServer.add(line); break;
}
}
in.close();
@@ -225,20 +243,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()})
@@ -289,7 +301,7 @@ public class MCPMerger
reader.accept(classNode, 0);
if (!classNode.name.equals("bdz")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
if (!dontAnnotate.contains(classNode.name))
{
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers;
import java.io.BufferedInputStream;
@@ -87,7 +99,7 @@ public class MarkerTransformer implements IClassTransformer
@SuppressWarnings("unchecked")
@Override
public byte[] transform(String name, byte[] bytes)
public byte[] transform(String name, String transformedName, byte[] bytes)
{
if (bytes == null) { return null; }
if (!markers.containsKey(name)) { return bytes; }
@@ -240,7 +252,7 @@ public class MarkerTransformer implements IClassTransformer
for (MarkerTransformer trans : transformers)
{
entryData = trans.transform(name, entryData);
entryData = trans.transform(name, name, entryData);
}
}
@@ -274,4 +286,4 @@ public class MarkerTransformer implements IClassTransformer
}
}
}
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers;
import java.util.Iterator;
@@ -11,9 +23,9 @@ import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.relauncher.FMLRelauncher;
import cpw.mods.fml.relauncher.IClassTransformer;
import cpw.mods.fml.relauncher.SideOnly;
public class SideTransformer implements IClassTransformer
{
@@ -21,7 +33,7 @@ public class SideTransformer implements IClassTransformer
private static final boolean DEBUG = false;
@SuppressWarnings("unchecked")
@Override
public byte[] transform(String name, byte[] bytes)
public byte[] transform(String name, String transformedName, byte[] bytes)
{
if (bytes == null) { return null; }
@@ -69,7 +81,7 @@ public class SideTransformer implements IClassTransformer
classNode.accept(writer);
return writer.toByteArray();
}
private boolean remove(List<AnnotationNode> anns, String side)
{
if (anns == null)
@@ -0,0 +1,322 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers.deobf;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.commons.Remapper;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.collect.ImmutableBiMap.Builder;
import com.google.common.io.CharStreams;
import com.google.common.io.InputSupplier;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.RelaunchClassLoader;
public class FMLDeobfuscatingRemapper extends Remapper {
public static final FMLDeobfuscatingRemapper INSTANCE = new FMLDeobfuscatingRemapper();
private BiMap<String, String> classNameBiMap;
private BiMap<String, String> mcpNameBiMap;
private Map<String,Map<String,String>> rawFieldMaps;
private Map<String,Map<String,String>> rawMethodMaps;
private Map<String,Map<String,String>> fieldNameMaps;
private Map<String,Map<String,String>> methodNameMaps;
private RelaunchClassLoader classLoader;
private FMLDeobfuscatingRemapper()
{
classNameBiMap=ImmutableBiMap.of();
mcpNameBiMap=ImmutableBiMap.of();
}
public void setup(File mcDir, RelaunchClassLoader classLoader, String deobfFileName)
{
this.classLoader = classLoader;
try
{
File libDir = new File(mcDir, "lib");
File mapData = new File(libDir, deobfFileName);
mapData = mapData.getCanonicalFile();
ZipFile mapZip = new ZipFile(mapData);
ZipEntry classData = mapZip.getEntry("joined.srg");
ZipInputSupplier zis = new ZipInputSupplier(mapZip, classData);
InputSupplier<InputStreamReader> srgSupplier = CharStreams.newReaderSupplier(zis,Charsets.UTF_8);
List<String> srgList = CharStreams.readLines(srgSupplier);
rawMethodMaps = Maps.newHashMap();
rawFieldMaps = Maps.newHashMap();
Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
Builder<String, String> mcpBuilder = ImmutableBiMap.<String,String>builder();
Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
for (String line : srgList)
{
String[] parts = Iterables.toArray(splitter.split(line),String.class);
String typ = parts[0];
if ("CL".equals(typ))
{
parseClass(builder, parts);
parseMCPClass(mcpBuilder,parts);
}
else if ("MD".equals(typ))
{
parseMethod(parts);
}
else if ("FD".equals(typ))
{
parseField(parts);
}
}
classNameBiMap = builder.build();
// Special case some mappings for modloader mods
mcpBuilder.put("BaseMod","net/minecraft/src/BaseMod");
mcpBuilder.put("ModLoader","net/minecraft/src/ModLoader");
mcpBuilder.put("EntityRendererProxy","net/minecraft/src/EntityRendererProxy");
mcpBuilder.put("MLProp","net/minecraft/src/MLProp");
mcpBuilder.put("TradeEntry","net/minecraft/src/TradeEntry");
mcpNameBiMap = mcpBuilder.build();
}
catch (IOException ioe)
{
FMLRelaunchLog.log(Level.SEVERE, ioe, "An error occurred loading the deobfuscation map data");
}
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());
}
public boolean isRemappedClass(String className)
{
return classNameBiMap.containsKey(className) || mcpNameBiMap.containsKey(className);
}
private void parseField(String[] parts)
{
String oldSrg = parts[1];
int lastOld = oldSrg.lastIndexOf('/');
String cl = oldSrg.substring(0,lastOld);
String oldName = oldSrg.substring(lastOld+1);
String newSrg = parts[2];
int lastNew = newSrg.lastIndexOf('/');
String newName = newSrg.substring(lastNew+1);
if (!rawFieldMaps.containsKey(cl))
{
rawFieldMaps.put(cl, Maps.<String,String>newHashMap());
}
rawFieldMaps.get(cl).put(oldName, newName);
}
private void parseClass(Builder<String, String> builder, String[] parts)
{
builder.put(parts[1],parts[2]);
}
private void parseMCPClass(Builder<String, String> builder, String[] parts)
{
int clIdx = parts[2].lastIndexOf('/');
builder.put("net/minecraft/src/"+parts[2].substring(clIdx+1),parts[2]);
}
private void parseMethod(String[] parts)
{
String oldSrg = parts[1];
int lastOld = oldSrg.lastIndexOf('/');
String cl = oldSrg.substring(0,lastOld);
String oldName = oldSrg.substring(lastOld+1);
String sig = parts[2];
String newSrg = parts[3];
int lastNew = newSrg.lastIndexOf('/');
String newName = newSrg.substring(lastNew+1);
if (!rawMethodMaps.containsKey(cl))
{
rawMethodMaps.put(cl, Maps.<String,String>newHashMap());
}
rawMethodMaps.get(cl).put(oldName+sig, newName);
}
@Override
public String mapFieldName(String owner, String name, String desc)
{
if (classNameBiMap == null || classNameBiMap.isEmpty())
{
return name;
}
Map<String, String> fieldMap = getFieldMap(owner);
return fieldMap!=null && fieldMap.containsKey(name) ? fieldMap.get(name) : name;
}
@Override
public String map(String typeName)
{
if (classNameBiMap == null || classNameBiMap.isEmpty())
{
return typeName;
}
int dollarIdx = typeName.indexOf('$');
String realType = dollarIdx > -1 ? typeName.substring(0, dollarIdx) : typeName;
String subType = dollarIdx > -1 ? typeName.substring(dollarIdx+1) : "";
String result = classNameBiMap.containsKey(realType) ? classNameBiMap.get(realType) : mcpNameBiMap.containsKey(realType) ? mcpNameBiMap.get(realType) : realType;
result = dollarIdx > -1 ? result+"$"+subType : result;
// System.out.printf("Mapping %s=>%s\n",typeName,result);
return result;
}
public String unmap(String typeName)
{
if (classNameBiMap == null || classNameBiMap.isEmpty())
{
return typeName;
}
int dollarIdx = typeName.indexOf('$');
String realType = dollarIdx > -1 ? typeName.substring(0, dollarIdx) : typeName;
String subType = dollarIdx > -1 ? typeName.substring(dollarIdx+1) : "";
String result = classNameBiMap.containsValue(realType) ? classNameBiMap.inverse().get(realType) : mcpNameBiMap.containsValue(realType) ? mcpNameBiMap.inverse().get(realType) : realType;
result = dollarIdx > -1 ? result+"$"+subType : result;
// System.out.printf("Unmapping %s=>%s\n",typeName,result);
return result;
}
@Override
public String mapMethodName(String owner, String name, String desc)
{
if (classNameBiMap==null || classNameBiMap.isEmpty())
{
return name;
}
Map<String, String> methodMap = getMethodMap(owner);
String methodDescriptor = name+desc;
return methodMap!=null && methodMap.containsKey(methodDescriptor) ? methodMap.get(methodDescriptor) : name;
}
private Map<String,String> getFieldMap(String className)
{
if (!fieldNameMaps.containsKey(className))
{
findAndMergeSuperMaps(className);
}
return fieldNameMaps.get(className);
}
private Map<String,String> getMethodMap(String className)
{
if (!methodNameMaps.containsKey(className))
{
findAndMergeSuperMaps(className);
}
return methodNameMaps.get(className);
}
private void findAndMergeSuperMaps(String name)
{
try
{
byte[] classBytes = classLoader.getClassBytes(name);
if (classBytes == null)
{
return;
}
ClassReader cr = new ClassReader(classBytes);
String superName = cr.getSuperName();
String[] interfaces = cr.getInterfaces();
if (interfaces == null)
{
interfaces = new String[0];
}
mergeSuperMaps(name, superName, interfaces);
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void mergeSuperMaps(String name, String superName, String[] interfaces)
{
// System.out.printf("Computing super maps for %s: %s %s\n", name, superName, Arrays.asList(interfaces));
if (classNameBiMap == null || classNameBiMap.isEmpty())
{
return;
}
// Skip Object
if (Strings.isNullOrEmpty(superName))
{
return;
}
List<String> allParents = ImmutableList.<String>builder().add(superName).addAll(Arrays.asList(interfaces)).build();
// generate maps for all parent objects
for (String parentThing : allParents)
{
if (!methodNameMaps.containsKey(parentThing))
{
findAndMergeSuperMaps(parentThing);
}
}
Map<String, String> methodMap = Maps.<String,String>newHashMap();
Map<String, String> fieldMap = Maps.<String,String>newHashMap();
for (String parentThing : allParents)
{
if (methodNameMaps.containsKey(parentThing))
{
methodMap.putAll(methodNameMaps.get(parentThing));
}
if (fieldNameMaps.containsKey(parentThing))
{
fieldMap.putAll(fieldNameMaps.get(parentThing));
}
}
if (rawMethodMaps.containsKey(name))
{
methodMap.putAll(rawMethodMaps.get(name));
}
if (rawFieldMaps.containsKey(name))
{
fieldMap.putAll(rawFieldMaps.get(name));
}
methodNameMaps.put(name, ImmutableMap.copyOf(methodMap));
fieldNameMaps.put(name, ImmutableMap.copyOf(fieldMap));
// System.out.printf("Maps: %s %s\n", name, methodMap);
}
}
@@ -0,0 +1,35 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers.deobf;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.commons.RemappingClassAdapter;
public class FMLRemappingAdapter extends RemappingClassAdapter {
public FMLRemappingAdapter(ClassVisitor cv)
{
super(cv, FMLDeobfuscatingRemapper.INSTANCE);
}
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
if (interfaces == null)
{
interfaces = new String[0];
}
FMLDeobfuscatingRemapper.INSTANCE.mergeSuperMaps(name, superName, interfaces);
super.visit(version, access, name, signature, superName, interfaces);
}
}
@@ -0,0 +1,38 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.asm.transformers.deobf;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import com.google.common.io.InputSupplier;
public class ZipInputSupplier implements InputSupplier<InputStream> {
private ZipFile zipFile;
private ZipEntry zipEntry;
public ZipInputSupplier(ZipFile zip, ZipEntry entry)
{
this.zipFile = zip;
this.zipEntry = entry;
}
@Override
public InputStream getInput() throws IOException
{
return zipFile.getInputStream(zipEntry);
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.util.List;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.util.List;
@@ -29,4 +41,4 @@ public enum ContainerType
{
return discoverer.discover(candidate, table);
}
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.io.File;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.util.List;
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.util.Collections;
@@ -42,6 +54,10 @@ public class JarDiscoverer implements ITypeDiscoverer
}
for (ZipEntry ze : Collections.list(jar.entries()))
{
if (ze.getName()!=null && ze.getName().startsWith("__MACOSX"))
{
continue;
}
Matcher match = classFile.matcher(ze.getName());
if (match.matches())
{
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.io.File;
@@ -81,4 +93,4 @@ public class ModCandidate
{
baseModCandidateTypes.add(modParser);
}
}
}
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery;
import java.io.File;
@@ -44,7 +56,7 @@ public class ModDiscoverer
{
if (knownLibraries.contains(minecraftSources[i].getName()))
{
FMLLog.fine("Skipping known library file %s", minecraftSources[i].getAbsolutePath());
FMLLog.finer("Skipping known library file %s", minecraftSources[i].getAbsolutePath());
}
else
{
@@ -1,3 +1,15 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.common.discovery.asm;
import java.io.IOException;
@@ -13,6 +25,7 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import cpw.mods.fml.common.FMLLog;
@@ -52,7 +65,7 @@ public class ASMModParser
{
this.asmType = Type.getObjectType(typeQName);
this.classVersion = classVersion;
this.asmSuperType = Type.getObjectType(superClassQName);
this.asmSuperType = !Strings.isNullOrEmpty(superClassQName) ? Type.getObjectType(superClassQName) : null;
}
public void startClassAnnotation(String annotationName)
@@ -116,7 +129,7 @@ public class ASMModParser
public boolean isBaseMod(List<String> rememberedTypes)
{
return getASMSuperType().equals(Type.getType(BaseMod.class)) || rememberedTypes.contains(getASMSuperType().getClassName());
return getASMSuperType().equals(Type.getType("LBaseMod;")) || getASMSuperType().equals(Type.getType("Lnet/minecraft/src/BaseMod;"))|| rememberedTypes.contains(getASMSuperType().getClassName());
}
public void setBaseModProperties(String foundProperties)
Loaded 100 of 364 files, more files were not shown because too many files have changed in this diff. Show more