Compare commits

..
197 Commits
Author SHA1 Message Date
Christian d5af053edb First draft 1.7.9 support.
This is not modding minecraft. It's performing an update. Go away!
2014-05-17 16:30:13 -04:00
Christian 43e3ee1af1 Swap Listenerlist constructor around. Should fix parent resizing issue? 2014-05-14 14:22:51 -04:00
Christian 70570a863f Fix up possible CME 2014-05-13 15:11:50 -04:00
Christian 503da3a257 Don't consider null NetworkDispatchers. This should fix a bunch of fakeplayer issues.
Nothing to see here. No modding being done.
2014-05-13 08:14:21 -04:00
cpw 42713c66e5 Merge pull request #426 from sfPlayer1/master
Fix ObjectIntIdentityMap sporadically matching non-identical objects.
2014-05-12 10:50:20 -04:00
Player 8dbd1ae0a1 Fix ObjectIntIdentityMap sporadically matching non-identical objects. 2014-05-12 16:29:37 +02:00
Christian a8cbef2321 Finally hopefully fully kills the race condition causing a classcast
on slow machines.

This is me bugfixing. NOT MODDING! No! Stop it! I'm not!
2014-05-11 22:15:29 -04:00
Christian 5275cea844 Try and see if there is anything to the identityHashCode collision hypothesis. If you see this in your error messages, kindly let us know! 2014-05-10 14:53:08 -04:00
Christian d8b6adb259 Add a helper for casting some common collection types into generic form 2014-05-10 13:36:24 -04:00
Lex Manos 0c36868f92 Fix network disconnect with message on the client side in NetworkDispatcher. 2014-05-09 13:23:24 -07:00
Lex Manos f2fe80dc36 Fixed default network mod checking to allow client side mods without the server side. Mods wishing to REQUIRE server side components must specify a custom check handler using @NetworkCheckHandler 2014-05-09 13:22:54 -07:00
Christian cd43eacbb2 Ensure that the loadcontroller is ready to preinit. 2014-05-08 10:40:52 -04:00
Christian de546bdf6c Clean up some missing generic info
PS: NOPE: still not modding.
2014-05-08 10:36:01 -04:00
Christian b0eb1ef7c6 Split loadmods into loadmods and preinitmods, to allow resource loading to occur *always* between the two phases. This should fix
mods not being able to access resources during preinit.

PS: I'm still not modding.
2014-05-08 10:23:05 -04:00
Christian 738ce1d7cd Re-add removed genericiterable to clean a warning 2014-05-08 09:58:03 -04:00
Christian b9de9ebc96 Revert "Fix refreshResources not happening if an error occurs."
This reverts commit fff86ee9d3.
2014-05-08 09:56:43 -04:00
LexManos 362ec8dee7 Merge pull request #419 from Thog92/master
updated wrapper to gradle 1.12
2014-05-07 15:41:05 -07:00
LexManos ddc2cfbe86 Merge pull request #402 from AbrarSyed/patch-1
Added dependency examples to the shipped example mod's build.gradle.
2014-05-07 15:40:50 -07:00
AbrarSyed 542e9acec1 documented dependencies 2014-05-07 17:34:44 -05:00
Lex Manos 1436ac2f14 Fine use FMLCommonHandler. 2014-05-07 14:36:00 -07:00
Lex Manos c73a2076e3 Fix potential rance condition in connecting to vanilla servers as well. And move latch into client side only. 2014-05-07 13:54:22 -07:00
Lex Manos 3612ad0c25 Attempt to fix another race condition related to reading NetClientHandler. 2014-05-07 13:31:16 -07:00
LexManos 1d5fc60f82 Merge pull request #411 from matthewprenger/master
Update ExampleMod mcmod.info
2014-05-07 12:39:12 -07:00
Thog92 8555344eb3 updated wrapper to gradle 1.12 2014-05-06 22:03:44 +02:00
Lex Manos 251af1d09d Fixed memory leak on the client caused by Netty holding references to the World. Closes #415 #417 2014-05-05 22:14:13 -07:00
Christian b84d0760ae Fix display of mod status at the server 2014-04-30 22:47:10 -04:00
Christian 76d8d0e870 Fix mod version checking 2014-04-30 22:26:16 -04:00
Christian fff86ee9d3 Fix refreshResources not happening if an error occurs. 2014-04-30 21:55:55 -04:00
Christian 810b1f3075 Clean some generic warnings up. Make a generic list handler. Helpful for others I think too. 2014-04-30 21:55:55 -04:00
LexManos d0f8073fa5 Merge pull request #413 from sfPlayer1/master
backup+default block use fix
2014-04-30 10:12:21 -07:00
Player 2c56c32c5a Fix saving backups with the raw name.
Fix air block not being assigned as the default.
2014-04-30 09:44:09 +02:00
Matthew Prenger a70308ef41 Update mcmod.info 2014-04-28 22:27:52 -05:00
Player 78248da399 Registry: Treat all 1.6 entries as items. 2014-04-26 21:56:25 +02:00
Player 7ba167c500 Registry: Misc tweaks 2014-04-26 21:56:25 +02:00
Player 9b1cbab03b Registry: Crash earlier with conflicting name/object registrations. 2014-04-26 21:56:25 +02:00
Player d88b2aa0c5 prevent the world from getting saved twice at shutdown 2014-04-26 21:56:25 +02:00
Player 59a5adfdb3 Registry: Fix Block-before-ItemBlock allocation when loading 1.6 world saves, more validation 2014-04-26 21:56:25 +02:00
Player ddee7eb117 Fix vanilla bug causing integrated server saving from 2 threads concurrently after a crash 2014-04-26 21:56:25 +02:00
Christian 2b8d0f6680 Fix SimpleNetworkWrapper - this is not me modding,
I didn't realize it was broken until Pahimar told me.

Put an example in the docs.
2014-04-26 09:33:09 -04:00
Christian 7f01cf549b I'm still not modding. Player has contributed greatly to the 1.7 release of FML. He needs authorship credit. 2014-04-19 11:38:46 -04:00
Christian 77c254a6d9 I am not modding, I am fixing an annoyance. The MCP version has long since been 9.03. Also, the JSON from MC updated.. 2014-04-19 10:46:04 -04:00
LexManos 3b42b33b6e Merge pull request #400 from sfPlayer1/master
Fix various registry issues
2014-04-07 09:57:13 -07:00
Player 294c93212c Registry: Add support for registering ItemBlocks before their Blocks 2014-04-07 17:30:38 +02:00
Player 8e44006f43 Registry: Protect against putObject misuse, handle duplicate registrations better 2014-04-06 17:11:23 +02:00
Player c8a0b72eba Registry: Complain about missing mods when repairing broken worlds
Registry: Reduce console spam
2014-04-06 14:49:59 +02:00
Player c8a245a985 Registry: Fix debug info 2014-04-05 01:54:07 +02:00
Player c7adb42199 Registry: Repair mismatched ItemBlocks as well
Fix a few misc issues
2014-04-05 01:47:19 +02:00
Player f77632df35 Remove unneeded entity spawn debug logging. 2014-04-03 21:00:42 +02:00
Player c47fc3b382 Enable custom gui rendering only as required 2014-04-03 17:58:53 +02:00
Player fd6d55afcc Registry: Allow ignoring missing mods from the GUI, with confirm+backup
Registry: Add confirm+backup for automated corrupted id table fixup
Require the user to confirm loading from a backup level.dat
2014-04-01 21:56:53 +02:00
Player 9be92dcfcb Registry: Complain about bogus registrations 2014-04-01 14:40:24 +02:00
Player 49c623f59c initial attempt at a better way to ask the user in case of startup issues 2014-04-01 14:30:47 +02:00
Player 038fa17ad3 Merge branch 'master' of https://github.com/MinecraftForge/FML
Conflicts:
	src/main/java/cpw/mods/fml/client/FMLClientHandler.java
	src/main/java/cpw/mods/fml/client/GuiModItemsMissing.java
	src/main/java/cpw/mods/fml/common/FMLContainer.java
	src/main/java/cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry.java
	src/main/java/cpw/mods/fml/common/registry/GameData.java
2014-04-01 07:00:20 +02:00
Lex Manos 58a4095f56 Update patches for Fixed FF in FG 1.2. 2014-03-31 16:02:54 -07:00
Player 6fd3c12a4a Registry: allow handling missing blocks/items regardless of the mod id 2014-03-31 04:09:59 +02:00
Player eb29d651eb Fix old 1.7 worlds with broken ID mappings 2014-03-30 17:17:54 +02:00
Player 7325aa5033 Registry: cleanup, fix missing id error GUI formatting 2014-03-27 08:30:55 +01:00
LexManos 89cda92561 Merge pull request #392 from AbrarSyed/master
Updated to ForgeGradle 1.2
2014-03-26 16:04:30 -07:00
AbrarSyed 385beb504d updated wrapper to gradle 1.11 2014-03-26 13:34:25 -05:00
AbrarSyed 2b46906ac5 updated example a little 2014-03-26 13:34:01 -05:00
Player 5eebd4df71 Registry: Implement support for remapping blocks/items to a new name. 2014-03-25 00:36:37 +01:00
Player fd9389015f Fix FMLMissingMappingsEvent.get 2014-03-24 21:47:25 +01:00
Player a82195772e Registry: Block IDs after failing to find a mapping for them 2014-03-24 21:16:36 +01:00
Player e58562d3ed Fix remaining issue with autoassigned Block and Item IDs overlapping. 2014-03-20 23:41:01 +01:00
AbrarSyed c3912836dc updated for ForgeGradle 1.2 2014-03-19 02:15:53 -05:00
LexManos 40270c881a Update README.txt 2014-03-18 01:54:32 -05:00
Lex Manos c2143dbeb1 Fix network close events never getting called. Closes #381 #382 2014-03-15 18:16:27 -07:00
Lex Manos f08b485852 Fix long standing deobf issue that caused announce-player-achievements property to have no effect on dedicated servers. 2014-03-11 01:57:44 -07:00
Lex Manos ef07de4f65 Fix hard link to DedicatedSerever when opening a LAN connection causing stalls on connecting. 2014-03-11 00:50:55 -07:00
Lex Manos b7ad532ab5 Re-enable post initalize texture pack reloading to allow Icons to be registerd through any init phase. 2014-03-03 23:23:55 -08:00
Lex Manos 399770e572 Kill the modEventTypes list, register anything that extends FMLEvent, Fixes MissingMappingEvent handler, and any future events added. 2014-02-25 12:30:29 -08:00
Lex Manos e8b60441cc Reload game settings after mod loading is finished to capture mod keybindings. Closes #378 2014-02-22 20:59:25 -08:00
Christian d0dd05a15c FML expands S3F to support payloads up to 2 megs in size. Should be transparent 2014-02-16 18:30:27 -05:00
cpw 572d32358a Merge pull request #373 from bloodmc/master
Prevent player data getting reset during disconnects.
2014-02-14 10:57:50 -07:00
cpw 33100d6bab Merge pull request #371 from bl4ckscor3/patch-1
Fix ExampleMod.java for build #1024+
2014-02-14 10:57:32 -07:00
bloodshot 45409bfa0c Prevent player dat files getting reset during disconnects.
Since FML nulls out the player's playerNetServerHandler during login, we need to
make sure that writePlayerData does not attempt to overwrite the player's dat file
if the player disconnects during the "Logging In" process.
2014-02-13 02:44:18 -05:00
Christian fa5f4c8842 Some argumentation 2014-02-08 22:41:02 -05:00
Christian 995c204338 Fix failing to load a world with missing mod blocks and items. There will be a way to force worlds to load
when stuff is missing, but for right now, it will fail as this is "world safe".
2014-02-08 22:37:40 -05:00
Christian c890206268 Try and handle removal of mods a bit better. Currently no way to allow a world which has missing
blocks to load - but i have the code in place to allow it i think.
2014-02-08 12:18:34 -05:00
bl4ckscor3 2aa73afa15 Fix ExampleMod.java for build #1024+ 2014-02-08 12:34:01 +01:00
Dan Roque 064b66af3d Prevent players from logging in until server has finished starting.
This improves server security as it guarantees no players will be
allowed to connect until the server has fully initialized.
2014-02-05 20:49:10 -05:00
Lex Manos 8c9e8b5270 Fix isRemote, this is integral to so many parts of the code, everyone knows it by this name, People should not change it. 2014-02-04 23:40:50 -08:00
Lex Manos b7b3450dcd Update MCP mapping snapshot to latest crowdsourced names. 2014-02-04 22:56:27 -08:00
Christian 6bb9b8b953 Clean up FMLEventChannel. Closes #367. 2014-02-04 20:01:44 -05:00
Lex Manos 03fb1879d7 Fix obf error when right clicking a Empty Map. 2014-02-04 12:49:18 -08:00
Christian cee0f0b811 Tweak so that writing to the context will automatically send a message back to
the originator in handshakeestablished.
2014-02-02 12:11:57 -05:00
Christian 359ac3ca2a Ensure we check both item and block registries when finding valid IDs. Should fix #365 2014-02-01 11:05:33 +00:00
Lex Manos d87822ad85 Bump gradle wrapper to 1.10 2014-01-29 21:04:55 -08:00
Christian 8633d780c9 And make a loud message if there isn't a modcontainer found, substitute Minecraft. In general, this can only happen
for coremods not properly registering their code. Closes #363
2014-01-25 06:20:09 -05:00
Christian ab199c5811 Try harder to find a mod container. 2014-01-25 06:17:14 -05:00
Christian 544320b8d2 Beginning of a saveinspectionhandler. 2014-01-20 22:27:03 -05:00
Christian 741e172ffe Log4j2 doesn't need debug level logging for itself anymore 2014-01-20 22:01:20 -05:00
Christian a7ca131a33 And don't spam NONE everywhere 2014-01-20 22:00:24 -05:00
Christian 8692ca17d1 Log4j2 logging context for things. This should help add context when things go wrong in mods. 2014-01-20 21:58:39 -05:00
Christian b6d95d704b Name the log files properly. fml-junk is an early startup annoyance I can't kill because log4j2. 2014-01-20 21:31:20 -05:00
Christian 458b0620b4 Log the bad packet in a prettier way. Also, don't show the authlib debug data in the log file. 2014-01-20 17:29:17 -05:00
Christian 675b5a0778 And turn down some more logging, now we have useful logging back again.. 2014-01-20 16:09:34 -05:00
Christian 1c793abe0e Fix derp with networkcheck 2014-01-20 16:06:50 -05:00
Christian a355eecb2c Add in error logging for outbound messages. Fix bug with indexedcodec NPE 2014-01-20 16:02:26 -05:00
Christian 9a8d16b66e Fix log4j2 config. Fix server gui to *show* logging. Fix log spamminess in the console. Fix bug in servergui that can cause deadlock. 2014-01-20 15:09:24 -05:00
Christian 5719b9ec53 Fix reply handling. Make the proxy message available for subclasses of indexedcodec. Fire user events into the network
event firing.
2014-01-20 11:58:14 -05:00
Christian 16d33d2989 Clean up and document outbound handler a bit better. Add in dispatcher target. Closes #361 2014-01-20 11:26:54 -05:00
Christian 32bb7315cc Add in example assets dir. Closes #308 2014-01-20 08:15:55 -05:00
Christian 3dfb54e066 Merge branch 'trait-optional' of github.com:RainWarrior/FML 2014-01-20 08:14:27 -05:00
Christian 79b04898d4 And restore suppressions. ABRAR, DON'T TIDY CODE!!!! 2014-01-20 08:09:02 -05:00
Christian 9d2e089df6 Merge branch 'logging' of github.com:AbrarSyed/FML into abrar-borked 2014-01-20 08:06:45 -05:00
Christian 35a38d7840 Make sidedproxy support non-public fields. Closes #344 2014-01-20 07:55:26 -05:00
Christian 6a695c4348 Try and stop the epic channel closed spam at close time. Closes #353 2014-01-20 07:53:09 -05:00
Christian a62374d4ac findBlock should now return null, not the default block, if the thing being looked for is not found. Closes #352 2014-01-20 07:49:44 -05:00
Christian 3d26f28bcf Allow connection when server is apparently offline. Might allow :NOFML circumvention though. Hmmm. Closes #359 2014-01-20 07:46:17 -05:00
Christian 5adacc3b33 Check the mod, not it's container, in the check handler. Closes #358 2014-01-20 07:42:35 -05:00
Christian 7ac5bddbc3 Allow indexed messages to validate themselves. Also, catch exceptions from
an embedded channel, and cause them to close the connection. It's ugly, but
it means that the client doesn't crash if it connects to a screwy bungycord that's trying a 1.6 handshake for some reason.
2014-01-19 22:08:19 -05:00
Christian 7907e16e96 Add a type adapter for artifact version. Should fix #354 2014-01-19 10:49:28 -05:00
cpw 79d42fca8d Merge pull request #355 from jk-5/errorhandling
Throw an exception when discriminator is not found
2014-01-19 07:38:41 -08:00
cpw dfc0899ec6 Merge pull request #357 from jk-5/sharable
Make NetworkEventFiringHandler sharable
2014-01-19 07:37:52 -08:00
jk-5 2524045728 Make NetworkEventFiringHandler sharable
Fixes #356
2014-01-19 12:27:31 +01:00
jk-5 3557fe31c9 Throw an exception when discriminator is not found 2014-01-19 11:21:24 +01:00
Christian 449ac98b77 SSP Worlds updating from 1.6 will now pop a warning message before loading, and will capture a timestamped
zip file in the minecraft dir before starting to load. Allows for people to test updates.
2014-01-18 22:25:35 -05:00
Abrar Syed f23eba4352 put max number of FML log files to 3 2014-01-19 00:53:58 +00:00
Abrar Syed f0132a6f3b changed fml log level to all 2014-01-19 00:49:47 +00:00
Lex Manos 444a7d7fa1 Move placement of single player world load hook to fix NPEs. 2014-01-18 13:05:18 -08:00
Christian 2a5a8d0cd0 Fix memory leak?! 2014-01-17 23:36:03 -05:00
Christian 275ccac6f1 Fix NPE at startup 2014-01-17 23:35:53 -05:00
Christian ff7b5845e7 Clean up some warnings about @Override 2014-01-17 23:19:22 -05:00
Christian 7c5d62704a Make UniqueIdentifier final and add a hashCode. Closes #348
Clean up language registry. It can be used to access all translations of mods on client or server.
Auto loads from assets files.
2014-01-17 17:47:30 -05:00
Christian 53557dcd05 Put logging exception handlers on all channel inbounds. Fix problem with failure to login. Closes #350 2014-01-17 17:00:55 -05:00
Christian 9c96ca4402 Fire a custom packet channel registration/deregistration event, for any mods that care about that
kind of thing
2014-01-16 19:45:42 -05:00
Christian a429e106dd Fix bug with SSP, and hook so we can do confirmation of world loading, as well as other things 2014-01-16 18:15:45 -05:00
Christian 9cab2ab36e Add in some tests and examples for the "simple" network stuff 2014-01-16 18:07:25 -05:00
Christian 30882b0c1d Clean up some warnings. Add in simple network impl 2014-01-16 18:06:36 -05:00
Christian c013870b1d Merge branch 'simplenet' 2014-01-16 14:59:13 -05:00
Christian dd17979a2f Fix bukkit connectivity issue. 2014-01-16 14:58:28 -05:00
Christian e14efe786f Some fixes and tweaks 2014-01-16 09:14:39 -05:00
Lex Manos a4686b1261 Added basic Mojang account authentication support for development time login. 2014-01-14 16:49:03 -08:00
LexManos e344303ec7 Merge pull request #346 from Jezzadabomb338/master
At the request of AbrarSyed.
2014-01-13 23:11:42 -08:00
Jezzadabomb b362e8a273 At the request of AbrarSyed. 2014-01-14 15:39:24 +11:00
Christian 5da6dcc7e3 Divert connection through FML, so we can deny connections to servers that don't want us 2014-01-13 13:47:18 -05:00
Christian 10d056a494 Fix possible NPE derp 2014-01-13 13:46:22 -05:00
Christian fc69bcf280 Fix up privacy derp in TickEvent. Closes #343 2014-01-13 08:43:33 -05:00
Christian 80b00dc796 Fix openGui. Closes #342 2014-01-13 08:40:56 -05:00
Christian 28293b29ea Add in a simple(ish) event driven network handling system. Register using newEventDrivenChannel
and you'll get a simple network handler that will fire events at the subscriber(s) of your
choice, whenever a packet is received. You'll also get some convenience methods for sending
to things.
2014-01-12 13:20:41 -05:00
Christian 584c0f368b Fix potential ordering issue, clean up some imports 2014-01-11 22:01:01 -05:00
AbrarSyed fc025a7b73 Logging Changes 2014-01-11 16:43:14 +00:00
RainWarrior 4aa2416ce5 Propagate Optional method removal to trait implementation classes 2014-01-10 00:56:00 +04:00
Christian 717a8d6945 Fix csv string vs list of strings. Thanks immibis. Closes #334 2014-01-09 14:55:52 -05:00
cpw a89939e57e Merge pull request #336 from jadar/master
added override toString method for getting full name.
2014-01-09 11:54:54 -08:00
Christian 43068eb986 Fix TargetPoint to be static 2014-01-09 08:41:52 -05:00
Christian dd098854b0 Fix the keybinding array to the right one 2014-01-09 08:40:42 -05:00
Christian d5bfd69e35 Fix problem with connecting to vanilla.
SHOW what's modded and what's vanilla in the list. Hooks that make the blocking work to come
2014-01-06 23:48:53 -05:00
Jadar 96c19b3580 undid readme change 2014-01-06 15:58:42 -06:00
Jadar acf74a3403 changed the readme to reflect new setup task. 2014-01-06 11:09:34 -06:00
Jadar 1db3daa0e8 added override toString method for getting full name. 2014-01-06 10:25:13 -06:00
Lex Manos 0d810c01fa Mark jopt needed on the server, herp derp, blame Abrar! 2014-01-05 19:02:47 -08:00
Christian 9de9a15530 Fix stupid hardcoding derp 2014-01-03 23:04:24 -05:00
Christian 5317672631 Add a utility method for finding the channel handler name based on type. Should fix naming weirdnesses. 2014-01-03 22:57:36 -05:00
Christian 6f1da6550e Fix up mcpname derp in GuiScrollingList. 2014-01-02 22:44:26 -05:00
Christian b51fb91355 Merge branch 'patch-1' of github.com:airbreather/FML 2014-01-02 22:21:25 -05:00
Christian 779cd05aa1 Tweaks 2014-01-02 22:18:02 -05:00
Christian 7bf119e1e5 Fix up readmes and credits. We no longer support modloader. 2014-01-02 22:18:02 -05:00
iChun fa4f3015a0 Added transparent background for GuiIngameModOptions as per cpw's request. May not compile due to manual de-mcp-fication. 2014-01-02 22:18:02 -05:00
Christian fbc1f8f6f9 Config GUIs in the modlist now work. 2014-01-02 11:51:16 -05:00
airbreather c5e29b574a Avoiding redundant calls to LogManager 2014-01-01 11:40:32 -05:00
Christian 3113138bd1 Tweak button positions. 2014-01-01 02:09:40 -05:00
iChun ab5eb3ccff Fix button size for GuiModList 2014-01-01 14:16:23 +08:00
Christian cdd9d92a4f Starting work on the actual GUI. Still work to do. Needs an API. 2014-01-01 00:57:24 -05:00
Christian b3f98d1ee0 Fix derpiness with Mods button when Realms is available 2013-12-31 20:21:28 -05:00
Christian 21b13d6351 Lots of network cleanup. Gui packets now work too! 2013-12-31 19:55:41 -05:00
Christian 22ba6fda5e Expose the nethandler in a few places, and pull out FMLEmbeddedChannel, exposing a utility method on it.
More to come.
2013-12-31 09:45:26 -05:00
Christian f36152398d Add in the tweakclass, fix the json for lzma @ the server. 2013-12-30 13:06:59 -05:00
Christian 5d069629cf Allow itemstacks for furnace recipe inputs. Allow passing extra arguments through registerblock into the itemblock constructor. 2013-12-28 18:04:30 -05:00
Christian 061288909d Fire simple network connect/disconnect gameevents. 2013-12-28 17:51:40 -05:00
Christian 6a5f9e135f Fix example mod code for 1.7 2013-12-28 13:44:37 -05:00
Christian 53a1f98414 Attempt to load old pre-1.7 worlds. ENSURE YOU HAVE A BACKUP! 2013-12-27 11:48:55 -05:00
Christian 34819c9303 Make gradlew executable on linux 2013-12-27 11:26:46 -05:00
Christian ec316f113f AT for renderblocks 2013-12-27 00:08:49 -05:00
Christian f8d6213829 Update render registry 2013-12-27 00:07:48 -05:00
Christian 268bbabee6 Fix handling world reloads when new stuffs are added 2013-12-26 12:42:40 -05:00
Lex Manos c180d9b157 Add 1.7.2 base json, Gradle will automatically download updated versions of this. Keeping it in the repo allows us to see what base json we have built our jsons off of. And if it changes update accordingly. 2013-12-23 22:36:47 -08:00
Christian 7d3b1250e8 Fix handshaking properly. Also, fix ID syncup. It now will completely freeze the idmap after preinit.
This frozen map is used to inject "new" stuff into existing serverside worlds. Interesting sideeffect: remote
servers lacking things will change the client, to also LACK ids for those things. watch for -1 ids in your remap
events. Note: idmaps should be considered temporary per server instance. SERVERSTOPPED will restore "startup" state,
as will client logout.
2013-12-24 00:47:10 -05:00
Christian 156a9ae03a Fix build script 2013-12-23 20:24:54 -05:00
Lex Manos 58132ccda3 Add new required --accessToken to launch specs. 2013-12-22 18:35:50 -08:00
Christian f860c8ad3b bump to legacy launcher 1.9 with logging unification stuffs. 2013-12-18 11:15:53 -05:00
Christian 3e76dfba34 More tweaking on id stuffs at worldload 2013-12-18 11:15:03 -05:00
Christian 31ea100b29 Working on id missing handling 2013-12-18 08:34:44 -05:00
Lex Manos ef3856f9a3 Update patches for Gradle's rename rewrite: MinecraftForge/ForgeGradle@19e7acf2a2 2013-12-18 04:01:37 -08:00
Christian e4b63a1801 IWorldGenerator now has an ordering at registration time. This means the order of worldgen should be much more stable. 2013-12-17 11:42:54 -05:00
Christian 85516d9588 ICraftingHandler, IPickupHandler are now both events. 2013-12-17 11:24:57 -05:00
Christian a17489172c Code to disable mods at runtime, or other times. 2013-12-17 10:51:00 -05:00
Christian 32561265fc Ticks, Player events, keybindings, all migrated to the new event driven system. 2013-12-16 23:18:00 -05:00
Christian 0b419ac79c Fire a user event down the channels when a handshake has occured. 2013-12-16 20:00:01 -05:00
Christian 4071ff38af Patch some GUIs. We're gonna add some basic mod gui config support. 2013-12-16 11:48:39 -05:00
Christian a2b324beb2 Copy eventhandler from Forge into FML. It is going to replace a lot of the runtime event systems. 2013-12-16 11:48:09 -05:00
Christian 557357fe17 Update for log4j2 2013-12-16 11:47:48 -05:00
Christian 3b2994a3de Some patching touchups 2013-12-13 00:18:05 -05:00
LexManos 0098c57f94 Merge pull request #316 from AbrarSyed/patch-4
Update shiped ForgeGradle for 1.7
2013-12-12 17:23:04 -08:00
Lex Manos 55aa337f95 Rename synthetic bridge methods, these methods are not decompiled, but need to reobf correctly cross the recompile boundary. 2013-12-12 17:18:04 -08:00
Abrar Syed df870c1a33 Update shiped ForgeGradle for 1.7 2013-12-12 17:11:37 -06:00
234 changed files with 49158 additions and 53337 deletions

No files matched your search

+4 -3
View File
@@ -2,13 +2,14 @@ This is Forge Mod Loader.
You can find the source code at all times at https://github.com/MinecraftForge/FML
This minecraft mod is a clean open source implementation of a mod loader for
minecraft servers, minecraft bukkit servers, and minecraft clients.
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
and minecraft clients.
The code is authored by cpw.
It (partially) implements API defined by the client side ModLoader, authored by Risugami.
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
http://www.minecraftforum.net/topic/75440-
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
http://www.minecraftforge.net/
+23 -46
View File
@@ -2,9 +2,7 @@ This is Forge Mod Loader, or FML for short, by cpw.
More information can be found at https://github.com/MinecraftForge/FML/wiki
It is a clean reimplementation of a mod loading system for client, server and
bukkit use, incorporating API implementations of client side ModLoader by
Risugami.
It is a clean reimplementation of a mod loading system for client and server.
It can be installed on its own, or as part of Minecraft Forge.
@@ -14,25 +12,14 @@ About Forge Mod Loader
Environments and compatibility
==============================
FML covers the three main environments: client, server and bukkit. All
environments share the main mod loading code base, with additional varying hooks
based on the specific environment. Compatibility is almost 100% with all
ModLoader based mods- any mod with any difficulty (unless noted below) should
be reported as a ticket to the github, please.
FML covers two main environments: client and server. All environments share
the main mod loading code base, with additional varying hooks based on the
specific environment.
Client side mods should be 100% compatible with ModLoader. The only exception is
Optifine, however new versions of optifine are compatible. There are some very
visible changes to the client when FML is installed.
There are some very visible changes to the client when FML is installed.
Server side mods are mostly compatible with previous MLMP based incarnations,
however, this compatibility is not guaranteed. Most mods have adapted to FML
and MLMP is not assured and will cause errors. Ask your mod author to update
to FML.
Bukkit side modding is an adaptation of the server side mod code to the bukkit
environment. Mods need to be recompiled against the bukkit decompilation to work
however there are guides and tools in development to make this process easier.
Consult mcportcentral.co.za for more information.
There are some bukkit compatibility hooks available, consult MCPC+ for more
information.
Minecraft Forge in all cases bundles FML as it's modloading technology of choice
because FML is open source, freely distributable, and can be easily updated by
@@ -46,12 +33,6 @@ Minecraft Forge installation. FML will detect and ensure the good operation of
Optifine (you can see it in your client as an additional data line on the
bottom left).
Client notes
============
FML does provide a standard pattern for mods to provide HD textures. This is why
optifine needed integration code. FML supports HD texture packs
up to 128x resolution.
Mod information
===============
FML exposes the mod information through a mod list visible on the main screen as
@@ -68,45 +49,41 @@ or server):
Installation
============
To install on a server, simply execute the FML or Forge jar file, with a copy of
minecraft_server.jar placed in the same directory. FML will launch it's patched
copy.
minecraft_server-@MC_VERSION@.jar placed in the same directory. FML will launch
it's patched copy.
To install on a client, FIRST delete META-INF from the minecraft.jar file, then
copy the contents of the FML or Forge jar file into it. FML and Forge provide
their own META-INF data which should *not* be deleted.
To install on a client, run the installer by executing java -jar <installer>.jar.
It will identify the location of you minecraft installation (this can be customized)
and create a new profile "FML" there.
Forge Installation
==================
This code also ships as a part of Minecraft Forge. You do not need to install it
separately from your Minecraft Forge installation. Minecraft Forge contains the
exact same code as this. Generally, you should not install FML if you are also
installing Minecraft Forge.
exact same code as this. You should not install FML if you are also installing
Minecraft Forge.
-------------------------------------------
Source installation information for modders
-------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply
some small patches to your MCP extracted source code, giving you and it access
some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "unrenamed" MCP source code- this
means that you will not be able to read them directly against normal code.
Note also that the patches are built against "unrenamed" MCP source code (aka
srgnames) - this means that you will not be able to read them directly against
normal code.
Source pack installation information:
Standalone source installation
==============================
To install this source code for development purposes, extract this zip file
into an mcp installation containing vanilla jars only. It should create a new
folder "fml" inside that installation.
Be sure that you have both vanilla client jars, and the vanilla server jar installed
as per the MCP install instructions. Both are required for FML to run properly.
Once extracted, run the install.sh or install.bat script provided from the fml
directory. It should decompile and patch your MCP source code for the client
and server.
To install this source code for development purposes, extract this zip file.
It ships with a demonstration mod. Run "gradle setupDevWorkspace" to create
a gradle environment primed with FML. Run gradle eclipse or gradle idea to
create an IDE workspace of your choice.
Refer to ForgeGradle for more information about the gradle environment
Forge source installation
=========================
+5 -4
View File
@@ -12,7 +12,7 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
@@ -29,10 +29,11 @@ repositories {
}
minecraft {
version = '1.7.2'
mcpVersion = '9.01-pre'
version = '1.7.9'
mcpVersion = '9.04'
fmlDir = projectDir.getAbsolutePath();
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
}
@@ -49,7 +50,7 @@ uploadArchives {
logger.info('Publishing to files server')
mavenDeployer {
configuration = configurations.deployerJars
configuration = configurations.deployJars
repository(url: project.filesmaven.url) {
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
+1467 -361
View File
File diff suppressed because it is too large. Load diff
+1570 -2517
View File
File diff suppressed because it is too large. Load diff
+12849 -12209
View File
File diff suppressed because it is too large. Load diff
+22230 -21030
View File
File diff suppressed because it is too large. Load diff
+1592 -2001
View File
File diff suppressed because it is too large. Load diff
+1 -11740
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -1,4 +1,4 @@
[VERSION]
MCPVersion = 9.01-alpha
ClientVersion = 1.7.2
ServerVersion = 1.7.2
MCPVersion = 9.04
ClientVersion = 1.7.9
ServerVersion = 1.7.9
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Tue Oct 29 18:00:54 CDT 2013
#Tue May 06 21:57:37 CEST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
Vendored Regular → Executable
View File
File mode changed.
+37
View File
@@ -0,0 +1,37 @@
-------------------------------------------
Source installation information for modders
-------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply
some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "unrenamed" MCP source code (aka
srgnames) - this means that you will not be able to read them directly against
normal code.
Source pack installation information:
Standalone source installation
==============================
To install this source code for development purposes, extract this zip file.
It ships with a demonstration mod. Run 'gradlew setupDevWorkspace' to create
a gradle environment primed with FML. Run 'gradlew eclipse' or 'gradlew idea' to
create an IDE workspace of your choice.
Refer to ForgeGradle for more information about the gradle environment
Note: On macs or linux you run the './gradlew.sh' instead of 'gradlew'
Forge source installation
=========================
MinecraftForge ships with this code and installs it as part of the forge
installation process, no further action is required on your part.
For reference this is version @MAJOR@.@MINOR@.@REV@.@BUILD@ of FML
for Minecraft version @MCVERSION@.
LexManos' Install Video
=======================
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
For more details update more often refer to the Forge Forums:
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
+24 -2
View File
@@ -11,7 +11,7 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
@@ -22,10 +22,32 @@ group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-
archivesBaseName = "modid"
minecraft {
version = "${version}"
version = "${version}"
assetDir = "eclipse/assets"
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
@@ -7,7 +7,7 @@
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.minecraft.launchwrapper.Launch"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--version 1.6 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--version 1.6 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --accessToken FML"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Minecraft"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M -Dfml.ignoreInvalidMinecraftCertificates=true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
@@ -1,6 +1,6 @@
package com.example.examplemod;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -15,6 +15,6 @@ public class ExampleMod
public void init(FMLInitializationEvent event)
{
// some example code
System.out.println("DIRT BLOCK >> "+Block.dirt.getUnlocalizedName());
System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authors": ["ExampleDude"],
"authorList": ["ExampleDude"],
"credits": "The Forge and FML guys, for making this example",
"logoFile": "",
"screenshots": [],
+2 -2
View File
@@ -6,7 +6,7 @@
"minecraftArguments": "--version FML_DEV --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.8",
"name": "net.minecraft:launchwrapper:1.9",
"comment" : "Important for FML, we add this"
},
{
@@ -200,4 +200,4 @@
],
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 9
}
}
+6 -4
View File
@@ -22,7 +22,7 @@
"url": "http://files.minecraftforge.net/maven/"
},
{
"name": "net.minecraft:launchwrapper:1.8",
"name": "net.minecraft:launchwrapper:1.9",
"serverreq":true
},
{
@@ -55,10 +55,12 @@
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"serverreq":true
},
{
"name": "lzma:lzma:0.0.1"
"name": "lzma:lzma:0.0.1",
"serverreq":true
},
{
"name": "com.paulscode:codecjorbis:20101023"
@@ -214,4 +216,4 @@
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 9
}
}
}
+173
View File
@@ -0,0 +1,173 @@
{
"id": "1.7.2",
"time": "2014-04-02T12:00:00+02:00",
"releaseTime": "2013-10-25T15:00:00+02:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets} --uuid ${auth_uuid} --accessToken ${auth_access_token}",
"minimumLauncherVersion": 9,
"libraries": [
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:15.0"
},
{
"name": "org.apache.commons:commons-lang3:3.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.3"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows"
},
"extract": {
"exclude": [
"META-INF/"
]
},
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20131017",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20131017",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20131017",
"natives": {
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
},
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.client.main.Main"
}
+179
View File
@@ -0,0 +1,179 @@
{
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--version FML_DEV --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.9",
"comment" : "Important for FML, we add this"
},
{
"name": "org.ow2.asm:asm-debug-all:4.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2",
"comment" : "Important for FML, we add this"
},
{
"name": "org.scala-lang:scala-library:2.10.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2",
"comment" : "Important for FML, we add this"
},
{
"name": "org.scala-lang:scala-compiler:2.10.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2",
"comment" : "Important for FML, we add this"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
},
{
"name": "lzma:lzma:0.0.1"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:15.0"
},
{
"name": "org.apache.commons:commons-lang3:3.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.13"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:5.16"
},
{
"name": "tv.twitch:twitch-platform:5.16",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 9
}
+219
View File
@@ -0,0 +1,219 @@
{
"install": {
"profileName": "@project@",
"target":"@minecraft_version@-@project@@version@",
"path":"@artifact@",
"version":"@project@ @version@",
"filePath":"@universal_jar@",
"welcome":"Welcome to the simple @project@ installer.",
"minecraft":"@minecraft_version@",
"mirrorList" : "http://files.minecraftforge.net/mirror-brand.list",
"logo":"/big_logo.png"
},
"versionInfo": {
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets} --uuid ${auth_uuid} --accessToken ${auth_access_token} --tweakClass cpw.mods.fml.common.launcher.FMLTweaker",
"libraries": [
{
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"name": "net.minecraft:launchwrapper:1.9",
"serverreq":true
},
{
"name": "org.ow2.asm:asm-all:4.1",
"serverreq":true
},
{
"name": "org.scala-lang:scala-library:2.10.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "6ba65d12cd09d441083262d6f73d2257fec7c663", "65de4339eaed1c3675485fb03a3532fecfd8e8cd" ],
"comment" : "Important for FML, we add this",
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-compiler:2.10.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "64c8b1380cc53d6850823d6e4e7ae984aa44ef9c", "99fd0ffb66f3088b0cd1071315fd5eb2b2b070ff" ],
"comment" : "Important for FML, we add this",
"serverreq":true,
"clientreq":true
},
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5",
"serverreq":true
},
{
"name": "lzma:lzma:0.0.1",
"serverreq":true
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:15.0"
},
{
"name": "org.apache.commons:commons-lang3:3.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.3"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20131017",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20131017",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20131017",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
],
"natives": {
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 9
}
}
+150
View File
@@ -0,0 +1,150 @@
{
"id": "1.7.9",
"time": "2014-04-14T15:29:23+02:00",
"releaseTime": "2014-04-14T15:29:23+02:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
"minimumLauncherVersion": 13,
"assets": "1.7.4",
"libraries": [
{
"name": "java3d:vecmath:1.3.1"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.10.Final"
},
{
"name": "com.google.guava:guava:15.0"
},
{
"name": "org.apache.commons:commons-lang3:3.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.13"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:5.16"
},
{
"name": "tv.twitch:twitch-platform:5.16",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.client.main.Main"
}
@@ -12,7 +12,7 @@
public class Block
{
- public static final RegistryNamespaced field_149771_c = new RegistryNamespacedDefaultedByKey("air");
+ public static final RegistryNamespaced field_149771_c = GameData.blockRegistry;
+ public static final RegistryNamespaced field_149771_c = GameData.getBlockRegistry();
private CreativeTabs field_149772_a;
protected String field_149768_d;
public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F);
@@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java
@@ -1,5 +1,6 @@
package net.minecraft.client;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.Gui;
@@ -138,6 +139,8 @@
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}
+ if (!FMLClientHandler.instance().handleLoadingScreen(scaledresolution))
+ {
Tessellator tessellator = Tessellator.field_78398_a;
this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k);
float f = 32.0F;
@@ -175,6 +178,7 @@
OpenGlHelper.func_148821_a(770, 771, 1, 0);
this.field_73725_b.field_71466_p.func_78261_a(this.field_73726_c, (l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2, i1 / 2 - 4 - 16, 16777215);
this.field_73725_b.field_71466_p.func_78261_a(this.field_73727_a, (l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2, i1 / 2 - 4 + 8, 16777215);
+ }
this.field_146588_g.func_147609_e();
if (OpenGlHelper.func_148822_b())
@@ -1,16 +1,16 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -1,6 +1,9 @@
package net.minecraft.client;
import com.google.common.collect.Lists;
+
@@ -9,6 +9,9 @@
import com.google.common.util.concurrent.ListenableFutureTask;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.util.concurrent.GenericFutureListener;
@@ -146,6 +149,8 @@
@@ -169,6 +172,8 @@
import org.lwjgl.opengl.PixelFormat;
import org.lwjgl.util.glu.GLU;
@@ -19,16 +19,43 @@
@SideOnly(Side.CLIENT)
public class Minecraft implements IPlayerUsage
{
@@ -457,6 +462,8 @@
this.func_71357_I();
this.field_71466_p = new FontRenderer(this.field_71474_y, new ResourceLocation("textures/font/ascii.png"), this.field_71446_o, false);
@@ -344,21 +349,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
System.out.println(p_71377_1_.func_71502_e());
+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
+
if (this.field_71474_y.field_74363_ab != null)
+ int retVal;
if (p_71377_1_.func_71497_f() != null)
{
this.field_71466_p.func_78264_a(this.field_135017_as.func_135042_a() || this.field_71474_y.field_151455_aw);
@@ -508,6 +515,7 @@
System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f());
- System.exit(-1);
+ retVal = -1;
}
else if (p_71377_1_.func_147149_a(file2))
{
System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ retVal = -1;
}
else
{
System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ retVal = -2;
}
+ FMLCommonHandler.instance().handleExit(retVal);
}
public void func_71367_a(String p_71367_1_, int p_71367_2_)
@@ -471,7 +478,7 @@
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
this.field_110451_am.func_110542_a(this.field_135017_as);
- this.func_110436_a();
+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71446_o);
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
@@ -532,12 +539,13 @@
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
@@ -36,15 +63,22 @@
this.func_71361_d("Post startup");
this.field_71456_v = new GuiIngame(this);
@@ -527,6 +535,7 @@
if (this.field_71475_ae != null)
{
- this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
+ FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
}
else
{
@@ -553,6 +561,7 @@
this.func_71352_k();
}
+ FMLClientHandler.instance().onInitializationComplete();
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
}
@@ -915,9 +924,11 @@
try
{
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
@@ -970,9 +979,11 @@
if (!this.field_71454_w)
{
@@ -56,14 +90,7 @@
}
GL11.glFlush();
@@ -1490,11 +1501,15 @@
public void func_71407_l()
{
+ FMLCommonHandler.instance().rescheduleTicks(Side.CLIENT);
+
if (this.field_71467_ac > 0)
{
@@ -1554,6 +1565,8 @@
--this.field_71467_ac;
}
@@ -72,7 +99,23 @@
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n)
@@ -1977,6 +1992,8 @@
@@ -1698,6 +1711,7 @@
this.field_71462_r.func_146274_d();
}
}
+ FMLCommonHandler.instance().fireMouseInput();
}
if (this.field_71429_W > 0)
@@ -1834,6 +1848,7 @@
}
}
}
+ FMLCommonHandler.instance().fireKeyInput();
}
}
@@ -2025,12 +2040,15 @@
this.field_71453_ak.func_74428_b();
}
@@ -81,3 +124,31 @@
this.field_71424_I.func_76319_b();
this.field_71423_H = func_71386_F();
}
public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_)
{
+ FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_);
this.func_71403_a((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2066,6 +2084,12 @@
while (!this.field_71437_Z.func_71200_ad())
{
+ if (!StartupQuery.check())
+ {
+ func_71403_a(null);
+ func_147108_a(null);
+ return;
+ }
String s2 = this.field_71437_Z.func_71195_b_();
if (s2 != null)
@@ -2141,6 +2165,7 @@
this.field_110448_aq.func_148529_f();
this.func_71351_a((ServerData)null);
this.field_71455_al = false;
+ FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
}
this.field_147127_av.func_147690_c();
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java
@@ -23,6 +23,7 @@
public boolean field_146125_m;
protected boolean field_146123_n;
private static final String __OBFID = "CL_00000668";
+ public int packedFGColour;
public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_)
{
@@ -76,8 +77,12 @@
this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
- if (!this.field_146124_l)
+ if (packedFGColour != 0)
{
+ l = packedFGColour;
+ }
+ else if (!this.field_146124_l)
+ {
l = 10526880;
}
else if (this.field_146123_n)
@@ -7,15 +7,15 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.awt.Color;
@@ -312,6 +313,11 @@
this.func_73731_b(fontrenderer, s2, k - fontrenderer.func_78256_a(s2) - 2, 2, 14737632);
s2 = "Allocated memory: " + i4 * 100L / l3 + "% (" + i4 / 1024L / 1024L + "MB)";
this.func_73731_b(fontrenderer, s2, k - fontrenderer.func_78256_a(s2) - 2, 12, 14737632);
@@ -314,6 +315,11 @@
this.func_73731_b(fontrenderer, s, k - fontrenderer.func_78256_a(s) - 2, 2, 14737632);
s = "Allocated memory: " + j5 * 100L / i5 + "% (" + j5 / 1024L / 1024L + "MB)";
this.func_73731_b(fontrenderer, s, k - fontrenderer.func_78256_a(s) - 2, 12, 14737632);
+ int offset = 22;
+ for (String brd : FMLCommonHandler.instance().getBrandings(false))
+ {
+ this.func_73731_b(fontrenderer, brd, k - fontrenderer.func_78256_a(brd) - 2, offset+=10, 14737632);
+ }
k3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70165_t);
j3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70163_u);
int l4 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70161_v);
j3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70165_t);
k3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70163_u);
int l3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70161_v);
@@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
@@ -1,5 +1,6 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.achievement.GuiAchievements;
@@ -29,8 +30,9 @@
this.field_146292_n.add(new GuiButton(4, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 24 + b0, I18n.func_135052_a("menu.returnToGame", new Object[0])));
this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.options", new Object[0])));
+ this.field_146292_n.add(new GuiButton(12, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, "Mod Options..."));
GuiButton guibutton;
- this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.shareToLan", new Object[0])));
+ this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 72 + b0, 200, 20, I18n.func_135052_a("menu.shareToLan", new Object[0])));
this.field_146292_n.add(new GuiButton(5, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.achievements", new Object[0])));
this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.stats", new Object[0])));
guibutton.field_146124_l = this.field_146297_k.func_71356_B() && !this.field_146297_k.func_71401_C().func_71344_c();
@@ -64,6 +66,10 @@
break;
case 7:
this.field_146297_k.func_147108_a(new GuiShareToLan(this));
+ break;
+ case 12:
+ FMLClientHandler.instance().showInGameModOptions(this);
+ break;
}
}
@@ -16,17 +16,17 @@
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import net.minecraft.client.Minecraft;
@@ -33,6 +36,9 @@
import org.lwjgl.opengl.GL11;
@@ -35,6 +38,9 @@
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.Project;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+
@SideOnly(Side.CLIENT)
public class GuiMainMenu extends GuiScreen
public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback
{
@@ -65,6 +71,8 @@
@@ -67,6 +73,8 @@
private GuiButton field_130023_H;
private static final String __OBFID = "CL_00001154";
@@ -35,12 +35,12 @@
public GuiMainMenu()
{
this.field_146972_A = field_96138_a;
@@ -265,13 +273,22 @@
@@ -267,13 +275,22 @@
private void func_130022_h()
{
this.field_130023_H.field_146125_m = true;
+ fmlModButton.field_146120_f = 98;
+ fmlModButton.field_146121_g = this.field_146294_l / 2 + 2;
+ fmlModButton.field_146128_h = this.field_146294_l / 2 + 2;
}
private void func_73969_a(int p_73969_1_, int p_73969_2_)
@@ -54,12 +54,12 @@
+
+ field_130023_H = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online"));
+ field_130023_H.field_146120_f = 98;
+ field_130023_H.field_146121_g = this.field_146294_l / 2 - 100;
+ field_130023_H.field_146128_h = this.field_146294_l / 2 - 100;
+ this.field_146292_n.add(field_130023_H);
this.field_130023_H.field_146125_m = false;
}
@@ -320,6 +337,11 @@
@@ -322,6 +339,11 @@
this.field_146297_k.func_71400_g();
}
@@ -71,7 +71,7 @@
if (p_146284_1_.field_146127_k == 11)
{
this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a);
@@ -583,7 +605,15 @@
@@ -585,7 +607,15 @@
s = s + " Demo";
}
@@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
@@ -2,6 +2,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
@@ -40,6 +41,7 @@
public GuiMultiplayer(GuiScreen p_i1040_1_)
{
this.field_146798_g = p_i1040_1_;
+ FMLClientHandler.instance().setupServerList();
}
public void func_73866_w_()
@@ -366,7 +368,7 @@
private void func_146791_a(ServerData p_146791_1_)
{
- this.field_146297_k.func_147108_a(new GuiConnecting(this, this.field_146297_k, p_146791_1_));
+ FMLClientHandler.instance().connectToServer(this, p_146791_1_);
}
public void func_146790_a(int p_146790_1_)
@@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
@@ -1,5 +1,6 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.text.DateFormat;
@@ -179,7 +180,7 @@
if (this.field_146297_k.func_71359_d().func_90033_f(s))
{
- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null);
+ FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1);
}
}
}
@@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
@@ -2,6 +2,7 @@
import com.google.common.base.Charsets;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -83,7 +84,7 @@
boolean flag2 = this.field_148301_e.field_82821_f < 5;
boolean flag3 = flag1 || flag2;
this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_148279_2_ + 32 + 3, p_148279_3_ + 1, 16777215);
- List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_148279_4_ - 32 - 2);
+ List list = this.field_148300_d.field_71466_p.func_78271_c(FMLClientHandler.instance().fixDescription(this.field_148301_e.field_78843_d), p_148279_4_ - 32 - 2);
for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1)
{
@@ -174,6 +175,11 @@
int k2 = p_148279_7_ - p_148279_2_;
int l2 = p_148279_8_ - p_148279_3_;
+ String tooltip = FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, p_148279_2_, p_148279_4_, p_148279_3_, k2, l2);
+ if (tooltip != null)
+ {
+ this.field_148303_c.func_146793_a(tooltip);
+ } else
if (k2 >= p_148279_4_ - 15 && k2 <= p_148279_4_ - 5 && l2 >= 0 && l2 <= 8)
{
this.field_148303_c.func_146793_a(s1);
@@ -1,15 +1,16 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
@@ -5,6 +5,8 @@
@@ -5,6 +5,9 @@
import com.mojang.authlib.exceptions.InvalidCredentialsException;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.util.concurrent.Future;
@@ -23,6 +25,7 @@
@@ -23,6 +26,7 @@
import net.minecraft.network.login.server.S00PacketDisconnect;
import net.minecraft.network.login.server.S01PacketEncryptionRequest;
import net.minecraft.network.login.server.S02PacketLoginSuccess;
@@ -17,7 +18,7 @@
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.CryptManager;
import net.minecraft.util.IChatComponent;
@@ -90,7 +93,7 @@
@@ -100,7 +104,7 @@
public void func_147390_a(S02PacketLoginSuccess p_147390_1_)
{
@@ -26,3 +27,15 @@
}
public void func_147231_a(IChatComponent p_147231_1_)
@@ -114,7 +118,10 @@
if (p_147232_2_ == EnumConnectionState.PLAY)
{
- this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d));
+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d);
+ this.field_147393_d.func_150719_a(nhpc);
+ FMLClientHandler.instance().setPlayClient(nhpc);
+
}
}
@@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java
+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java
@@ -4,6 +4,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.bootstrap.Bootstrap;
@@ -147,6 +148,7 @@
p_147224_1_.func_147407_a((String)null);
}
+ FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse);
networkmanager.func_150725_a(new C01PacketPing(Minecraft.func_71386_F()), new GenericFutureListener[0]);
this.field_147403_d = true;
}
@@ -8,7 +8,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.util.Direction;
@@ -242,7 +243,53 @@
@@ -245,7 +246,53 @@
{
p_147805_1_.func_149719_a(this.field_147845_a, p_147805_2_, p_147805_3_, p_147805_4_);
this.func_147775_a(p_147805_1_);
@@ -63,7 +63,7 @@
}
}
@@ -8060,6 +8107,10 @@
@@ -8089,6 +8136,10 @@
this.func_147799_a((BlockHopper)p_147800_1_, 0, 0, 0, 0, true);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
@@ -74,7 +74,7 @@
}
else
{
@@ -8118,7 +8169,24 @@
@@ -8147,7 +8198,24 @@
public static boolean func_147739_a(int p_147739_0_)
{
@@ -12,7 +12,7 @@
return field_110906_m;
default:
- return field_110903_f;
+ return VillagerRegistry.getVillagerSkin(p_110902_1_.func_70946_n(), field_110903_f);
+ return VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f);
}
}
@@ -9,7 +9,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -879,6 +881,7 @@
@@ -1049,6 +1051,7 @@
public void func_74303_b()
{
@@ -7,7 +7,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -141,6 +142,7 @@
@@ -140,6 +141,7 @@
return IntCache.func_85144_b();
}
});
@@ -1,15 +1,19 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
@@ -5,6 +5,8 @@
@@ -5,6 +5,7 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
+
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
@@ -66,6 +68,8 @@
@@ -63,9 +64,13 @@
import net.minecraft.stats.StatBase;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -18,7 +22,7 @@
public class EntityList
{
private static final Logger field_151516_b = LogManager.getLogger();
@@ -145,9 +149,10 @@
@@ -145,9 +150,10 @@
p_75615_0_.func_82580_o("Type");
}
@@ -30,7 +34,7 @@
if (oclass != null)
{
@@ -161,7 +166,17 @@
@@ -161,7 +167,17 @@
if (entity != null)
{
@@ -41,7 +45,7 @@
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_75615_0_.func_74779_i("id"), oclass.getName());
+ entity = null;
@@ -4,7 +4,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.FMLCommonHandler;
+
public class EntityItem extends Entity
{
@@ -13,7 +13,7 @@
}
}
+ GameRegistry.onPickupNotification(p_70100_1_, this);
+ FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this);
+
this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F);
p_70100_1_.func_71001_a(this, i);
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java
@@ -240,7 +240,7 @@
@@ -247,7 +247,7 @@
{
Chunk chunk = this.field_70170_p.func_72938_d(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.field_70161_v));
@@ -12,7 +12,7 @@
MerchantRecipeList merchantrecipelist;
merchantrecipelist = new MerchantRecipeList();
+ VillagerRegistry.manageVillagerTrades(merchantrecipelist, this, this.func_70946_n(), this.field_70146_Z);
int j;
int k;
label50:
@@ -626,7 +628,7 @@
@@ -10,7 +10,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Collection;
@@ -194,6 +197,7 @@
@@ -193,6 +196,7 @@
public void func_70071_h_()
{
@@ -18,7 +18,7 @@
if (this.field_71074_e != null)
{
ItemStack itemstack = this.field_71071_by.func_70448_g();
@@ -317,6 +321,7 @@
@@ -316,6 +320,7 @@
this.field_71100_bB.func_75118_a(this);
this.func_71064_a(StatList.field_75948_k, 1);
}
@@ -26,8 +26,8 @@
}
public int func_82145_z()
@@ -1986,6 +1991,11 @@
return uuid;
@@ -2031,6 +2036,11 @@
}
}
+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z)
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java
@@ -11,6 +11,9 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
@@ -3,7 +3,7 @@
@@ -1,5 +1,6 @@
package net.minecraft.inventory;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -11,7 +11,7 @@
public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_)
{
+ GameRegistry.onItemCrafted(p_82870_1_, p_82870_2_, field_75239_a);
+ FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a);
this.func_75208_c(p_82870_2_);
for (int i = 0; i < this.field_75239_a.func_70302_i_(); ++i)
@@ -3,7 +3,7 @@
@@ -1,5 +1,6 @@
package net.minecraft.inventory;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -11,7 +11,7 @@
this.field_75228_b = 0;
+ GameRegistry.onItemSmelted(field_75229_a, p_75208_1_);
+ FMLCommonHandler.instance().firePlayerSmeltedEvent(field_75229_a, p_75208_1_);
+
if (p_75208_1_.func_77973_b() == Items.field_151042_j)
{
@@ -14,7 +14,7 @@
public class Item
{
- public static final RegistryNamespaced field_150901_e = new RegistryNamespaced();
+ public static final RegistryNamespaced field_150901_e = GameData.itemRegistry;
+ public static final RegistryNamespaced field_150901_e = GameData.getItemRegistry();
protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
private CreativeTabs field_77701_a;
protected static Random field_77697_d = new Random();
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java
+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java
@@ -25,7 +25,7 @@
int i = 128 * (1 << mapdata.field_76197_d);
mapdata.field_76201_a = (int)(Math.round(p_77659_3_.field_70165_t / (double)i) * (long)i);
mapdata.field_76199_b = (int)(Math.round(p_77659_3_.field_70161_v / (double)i) * (long)i);
- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.field_76574_g;
+ mapdata.field_76200_c = p_77659_2_.field_73011_w.field_76574_g;
mapdata.func_76185_a();
--p_77659_1_.field_77994_a;
@@ -9,7 +9,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.bootstrap.Bootstrap;
@@ -127,7 +129,7 @@
@@ -142,7 +144,7 @@
final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_);
final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get();
@@ -18,7 +18,7 @@
{
field_150735_g.debug("Disabled auto read");
this.field_150746_k.config().setAutoRead(false);
@@ -135,7 +137,7 @@
@@ -150,7 +152,7 @@
if (this.field_150746_k.eventLoop().inEventLoop())
{
@@ -27,7 +27,7 @@
{
this.func_150723_a(enumconnectionstate);
}
@@ -149,7 +151,7 @@
@@ -164,7 +166,7 @@
private static final String __OBFID = "CL_00001241";
public void run()
{
@@ -36,7 +36,7 @@
{
NetworkManager.this.func_150723_a(enumconnectionstate);
}
@@ -299,6 +301,11 @@
@@ -315,6 +317,11 @@
this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_);
}
@@ -13,8 +13,8 @@
;
}
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer()).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer());
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer()).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer());
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h));
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h));
NetworkManager networkmanager = new NetworkManager(false);
NetworkSystem.this.field_151272_f.add(networkmanager);
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
@@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java
+++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java
@@ -8,6 +8,8 @@
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import java.lang.reflect.Type;
import java.util.UUID;
import net.minecraft.util.IChatComponent;
@@ -233,6 +235,7 @@
serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon"));
}
+ FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject);
return serverstatusresponse;
}
@@ -260,6 +263,7 @@
jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d());
}
+ FMLNetworkHandler.enhanceStatusQuery(jsonobject);
return jsonobject;
}
@@ -1,46 +1,64 @@
--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java
+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java
@@ -4,6 +4,8 @@
import com.mojang.authlib.GameProfile;
@@ -5,6 +5,11 @@
import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.LoaderState;
+import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -381,7 +383,11 @@
@@ -343,7 +348,7 @@
public void func_71260_j()
{
- if (!this.field_71290_O)
+ if (!this.field_71290_O && Loader.instance().hasReachedState(LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice
{
field_147145_h.info("Stopping server");
@@ -394,6 +399,7 @@
{
if (this.func_71197_b())
{
+ FMLCommonHandler.instance().handleServerStarted();
+
long i = func_130071_aq();
+
+ FMLCommonHandler.instance().onWorldLoadTick(field_71305_c);
long j = 0L;
long l = 0L;
this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C));
this.field_147147_p.func_151321_a(new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.7.2", 4));
@@ -425,6 +431,7 @@
Thread.sleep(1L);
@@ -438,12 +444,20 @@
Thread.sleep(Math.max(1L, 50L - l));
this.field_71296_Q = true;
}
+ FMLCommonHandler.instance().handleServerStopping();
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
}
else
{
@@ -462,6 +469,10 @@
{
try
{
+ if (FMLCommonHandler.instance().shouldServerBeKilledQuietly())
+ {
+ return;
+ }
this.func_71260_j();
this.field_71316_v = true;
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
this.func_71228_a((CrashReport)null);
}
@@ -471,6 +482,8 @@
}
+ catch (StartupQuery.AbortedException e)
+ {
+ // ignore silently
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
+ }
catch (Throwable throwable1)
{
field_147145_h.error("Encountered an unexpected exception", throwable1);
@@ -469,6 +483,7 @@
field_147145_h.error("We were unable to save this crash report to disk.");
}
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
this.func_71228_a(crashreport);
}
finally
@@ -484,6 +499,8 @@
}
finally
{
@@ -49,18 +67,15 @@
this.func_71240_o();
}
}
@@ -511,8 +524,10 @@
@@ -529,6 +546,7 @@
public void func_71217_p()
{
+ FMLCommonHandler.instance().rescheduleTicks(Side.SERVER);
long i = System.nanoTime();
AxisAlignedBB.func_72332_a().func_72298_a();
+ FMLCommonHandler.instance().onPreServerTick();
++this.field_71315_w;
if (this.field_71295_T)
@@ -566,6 +581,7 @@
@@ -582,6 +600,7 @@
this.field_71304_b.func_76319_b();
this.field_71304_b.func_76319_b();
@@ -68,7 +83,7 @@
}
public void func_71190_q()
@@ -593,6 +609,7 @@
@@ -608,6 +627,7 @@
}
this.field_71304_b.func_76320_a("tick");
@@ -76,7 +91,7 @@
CrashReport crashreport;
try
@@ -617,6 +634,7 @@
@@ -632,6 +652,7 @@
throw new ReportedException(crashreport);
}
@@ -84,7 +99,15 @@
this.field_71304_b.func_76319_b();
this.field_71304_b.func_76320_a("tracker");
worldserver.func_73039_n().func_72788_a();
@@ -695,7 +713,7 @@
@@ -663,6 +684,7 @@
public void func_71256_s()
{
+ StartupQuery.reset();
(new Thread("Server thread")
{
private static final String __OBFID = "CL_00001418";
@@ -715,7 +737,7 @@
public String getServerModName()
{
@@ -93,3 +116,12 @@
}
public CrashReport func_71230_b(CrashReport p_71230_1_)
@@ -1117,7 +1139,7 @@
return false;
}
- public abstract String func_71206_a(WorldSettings.GameType var1, boolean var2);
+ public abstract String func_71206_a(WorldSettings.GameType p_71206_1_, boolean p_71206_2_);
public int func_71259_af()
{
@@ -7,7 +7,15 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -109,6 +110,8 @@
@@ -46,6 +47,7 @@
private boolean field_71338_p;
private WorldSettings.GameType field_71337_q;
private boolean field_71335_s;
+ public static boolean allowPlayerLogins = false;
private static final String __OBFID = "CL_00001784";
public DedicatedServer(File p_i1508_1_)
@@ -110,6 +112,8 @@
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
@@ -16,29 +24,29 @@
field_155771_h.info("Loading properties");
this.field_71340_o = new PropertyManager(new File("server.properties"));
@@ -180,6 +183,8 @@
field_155771_h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
@@ -192,6 +196,7 @@
}
else
{
+ FMLCommonHandler.instance().onServerStarted();
this.func_152361_a(new DedicatedPlayerList(this));
long j = System.nanoTime();
+ FMLCommonHandler.instance().onServerStarted();
+
this.func_71210_a(new DedicatedPlayerList(this));
long j = System.nanoTime();
@@ -237,6 +242,7 @@
this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16);
this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256));
this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z()));
+ if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\"");
this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
@@ -257,7 +263,8 @@
this.field_71339_n.func_72602_a();
}
@@ -225,6 +230,7 @@
this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16);
this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256));
this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z()));
+ if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\"");
this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s3);
long i1 = System.nanoTime() - j;
@@ -245,7 +251,7 @@
this.field_71339_n.func_72602_a();
- return true;
+ allowPlayerLogins = true;
+ return FMLCommonHandler.instance().handleServerStarting(this);
}
- return true;
+ return FMLCommonHandler.instance().handleServerStarting(this);
}
public boolean func_71225_e()
@@ -0,0 +1,34 @@
--- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java
+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java
@@ -13,6 +13,7 @@
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
@@ -79,6 +80,7 @@
System.exit(0);
}
});
+ minecraftservergui.latch.countDown();
}
public MinecraftServerGui(DedicatedServer p_i2362_1_)
@@ -164,8 +166,15 @@
return jpanel;
}
+ private CountDownLatch latch = new CountDownLatch(1);
public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_)
{
+ try
+ {
+ latch.await();
+ } catch (InterruptedException e)
+ {
+ }
if (!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
@@ -1,15 +1,24 @@
--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
@@ -88,7 +88,7 @@
@@ -4,6 +4,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
+
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -98,7 +100,7 @@
this.field_72405_c = 8;
}
- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_)
+ public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver)
{
NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_);
p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
@@ -104,7 +104,7 @@
GameProfile gameprofile = p_72355_2_.func_146103_bH();
PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax();
@@ -119,7 +121,7 @@
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
ChunkCoordinates chunkcoordinates = worldserver.func_72861_E();
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
@@ -18,3 +27,44 @@
nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldserver.func_72912_H().func_76093_s(), worldserver.field_73011_w.field_76574_g, worldserver.field_73013_u, this.func_72352_l(), worldserver.func_72912_H().func_76067_t()));
nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", this.func_72365_p().getServerModName().getBytes(Charsets.UTF_8)));
nethandlerplayserver.func_147359_a(new S05PacketSpawnPosition(chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c));
@@ -161,6 +163,7 @@
p_72355_2_.func_71116_b();
+ FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_);
if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10))
{
Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver);
@@ -250,6 +253,8 @@
protected void func_72391_b(EntityPlayerMP p_72391_1_)
{
+ if (p_72391_1_.field_71135_a == null) return;
+
this.field_72412_k.func_75753_a(p_72391_1_);
StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au());
@@ -281,6 +286,7 @@
public void func_72367_e(EntityPlayerMP p_72367_1_)
{
+ FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_);
p_72367_1_.func_71029_a(StatList.field_75947_j);
this.func_72391_b(p_72367_1_);
WorldServer worldserver = p_72367_1_.func_71121_q();
@@ -436,6 +442,7 @@
this.field_72404_b.add(entityplayermp1);
entityplayermp1.func_71116_b();
entityplayermp1.func_70606_j(entityplayermp1.func_110143_aJ());
+ FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1);
return entityplayermp1;
}
@@ -461,6 +468,7 @@
PotionEffect potioneffect = (PotionEffect)iterator.next();
p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect));
}
+ FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_);
}
public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
@@ -1,5 +1,6 @@
package net.minecraft.server.network;
+import cpw.mods.fml.common.FMLCommonHandler;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.NetworkManager;
@@ -24,6 +25,14 @@
public void func_147383_a(C00Handshake p_147383_1_)
{
+ if (!FMLCommonHandler.instance().shouldAllowPlayerLogins())
+ {
+ ChatComponentText chatcomponenttext = new ChatComponentText("Server is still starting! Please wait before reconnecting.");
+ this.field_147386_b.func_150725_a(new S00PacketDisconnect(chatcomponenttext), new GenericFutureListener[0]);
+ this.field_147386_b.func_150718_a(chatcomponenttext);
+ return;
+ }
+
switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.field_151291_a[p_147383_1_.func_149594_c().ordinal()])
{
case 1:
@@ -18,7 +18,7 @@
{
this.func_147322_a("Took too long to log in");
}
@@ -97,7 +99,7 @@
@@ -96,7 +98,7 @@
{
this.field_147328_g = NetHandlerLoginServer.LoginState.ACCEPTED;
this.field_147333_a.func_150725_a(new S02PacketLoginSuccess(this.field_147337_i), new GenericFutureListener[0]);
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -1,10 +1,13 @@
@@ -1,10 +1,12 @@
package net.minecraft.tileentity;
+import cpw.mods.fml.common.FMLLog;
@@ -9,12 +9,20 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
+import java.util.logging.Level;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockJukebox;
import net.minecraft.crash.CrashReportCategory;
@@ -87,9 +90,10 @@
@@ -12,6 +14,8 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -87,9 +91,10 @@
{
TileEntity tileentity = null;
@@ -26,7 +34,7 @@
if (oclass != null)
{
@@ -103,7 +107,17 @@
@@ -103,7 +108,17 @@
if (tileentity != null)
{
@@ -36,7 +44,7 @@
+ }
+ catch (Exception ex)
+ {
+ FMLLog.log(Level.SEVERE, ex,
+ FMLLog.log(Level.ERROR, ex,
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_145827_0_.func_74779_i("id"), oclass.getName());
+ tileentity = null;
@@ -44,3 +52,11 @@
}
else
{
@@ -137,7 +152,6 @@
}
}
- @SideOnly(Side.CLIENT)
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{
double d3 = (double)this.field_145851_c + 0.5D - p_145835_1_;
@@ -7,7 +7,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -319,7 +320,15 @@
@@ -322,7 +323,15 @@
}
}
@@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/util/ObjectIntIdentityMap.java
+++ ../src-work/minecraft/net/minecraft/util/ObjectIntIdentityMap.java
@@ -2,20 +2,21 @@
import com.google.common.base.Predicates;
import com.google.common.collect.Iterators;
-import gnu.trove.map.hash.TIntIntHashMap;
import java.util.ArrayList;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
public class ObjectIntIdentityMap implements IObjectIntIterable
{
- protected TIntIntHashMap field_148749_a = new TIntIntHashMap(256, 0.5F, -1, -1);
+ protected Map<Object, Integer> field_148749_a = new IdentityHashMap<Object, Integer>(512);
protected List field_148748_b = new ArrayList();
private static final String __OBFID = "CL_00001203";
public void func_148746_a(Object p_148746_1_, int p_148746_2_)
{
- this.field_148749_a.put(System.identityHashCode(p_148746_1_), p_148746_2_);
+ this.field_148749_a.put(p_148746_1_, p_148746_2_);
while (this.field_148748_b.size() <= p_148746_2_)
{
@@ -27,7 +28,8 @@
public int func_148747_b(Object p_148747_1_)
{
- return this.field_148749_a.get(System.identityHashCode(p_148747_1_));
+ Integer ret = this.field_148749_a.get(p_148747_1_);
+ return ret != null ? ret : -1;
}
public Object func_148745_a(int p_148745_1_)
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/util/StringTranslate.java
+++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java
@@ -3,6 +3,8 @@
@@ -3,10 +3,13 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
@@ -9,24 +9,67 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.IOException;
@@ -25,9 +27,19 @@
import java.io.InputStream;
+import java.util.HashMap;
import java.util.IllegalFormatException;
import java.util.Iterator;
import java.util.Map;
@@ -18,16 +21,35 @@
{
private static final Pattern field_111053_a = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]");
private static final Splitter field_135065_b = Splitter.on('=').limit(2);
+ private final Map field_74816_c;
private static StringTranslate field_74817_a = new StringTranslate();
- private final Map field_74816_c = Maps.newHashMap();
private long field_150511_e;
private static final String __OBFID = "CL_00001212";
public StringTranslate()
{
+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang");
+ localInject(inputstream);
+ field_74816_c = Maps.newHashMap();
+ inject(this, inputstream);
+ }
+
+
+ public static void inject(InputStream inputstream)
+ {
+ field_74817_a.localInject(inputstream);
+ inject(field_74817_a, inputstream);
+ }
+
+ private void localInject(InputStream inputstream)
+
+ private static void inject(StringTranslate inst, InputStream inputstream)
+ {
+ HashMap<String, String> map = parseLangFile(inputstream);
+ inst.field_74816_c.putAll(map);
+ inst.field_150511_e = System.currentTimeMillis();
+ }
+
+ public static HashMap<String,String> parseLangFile(InputStream inputstream)
+ {
+ HashMap<String,String> table = Maps.newHashMap();
try
{
- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang");
Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator();
while (iterator.hasNext())
@@ -42,17 +64,17 @@
{
String s1 = astring[0];
String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s");
- this.field_74816_c.put(s1, s2);
+ table.put(s1, s2);
}
}
}
- this.field_150511_e = System.currentTimeMillis();
}
- catch (IOException ioexception)
+ catch (Exception ioexception)
{
;
}
+ return table;
}
static StringTranslate func_74808_a()
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/world/World.java
+++ ../src-work/minecraft/net/minecraft/world/World.java
@@ -1800,14 +1800,14 @@
@@ -1799,14 +1799,14 @@
}
}
@@ -17,7 +17,7 @@
this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty())
@@ -3570,7 +3570,7 @@
@@ -3597,7 +3597,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
@@ -1,15 +1,19 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -9,6 +9,8 @@
@@ -9,6 +9,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -27,6 +29,8 @@
@@ -24,9 +25,13 @@
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.storage.IThreadedFileIO;
import net.minecraft.world.storage.ThreadedFileIOBase;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -18,44 +22,44 @@
public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO
{
private static final Logger field_151505_a = LogManager.getLogger();
@@ -260,11 +264,20 @@
Entity entity = (Entity)iterator.next();
@@ -260,11 +265,20 @@
Entity entity = (Entity)iterator1.next();
nbttagcompound1 = new NBTTagCompound();
- if (entity.func_70039_c(nbttagcompound1))
+ try
{
- p_75820_1_.field_76644_m = true;
- nbttaglist1.func_74742_a(nbttagcompound1);
- nbttaglist2.func_74742_a(nbttagcompound1);
+ if (entity.func_70039_c(nbttagcompound1))
+ {
+ p_75820_1_.field_76644_m = true;
+ nbttaglist1.func_74742_a(nbttagcompound1);
+ nbttaglist2.func_74742_a(nbttagcompound1);
+ }
}
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ entity.getClass().getName());
+ }
}
}
@@ -276,8 +289,16 @@
@@ -276,8 +290,16 @@
{
TileEntity tileentity = (TileEntity)iterator.next();
TileEntity tileentity = (TileEntity)iterator1.next();
nbttagcompound1 = new NBTTagCompound();
+ try {
tileentity.func_145841_b(nbttagcompound1);
nbttaglist2.func_74742_a(nbttagcompound1);
nbttaglist3.func_74742_a(nbttagcompound1);
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ FMLLog.log(Level.ERROR, e,
+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ tileentity.getClass().getName());
+ }
}
p_75820_3_.func_74782_a("TileEntities", nbttaglist2);
p_75820_3_.func_74782_a("TileEntities", nbttaglist3);
@@ -1,15 +1,14 @@
--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java
+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java
@@ -6,6 +6,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
@@ -1,6 +1,7 @@
package net.minecraft.world.gen;
import com.google.common.collect.Lists;
+import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.EnumCreatureType;
@@ -209,6 +211,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -216,6 +217,7 @@
if (this.field_73246_d != null)
{
this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_);
@@ -1,15 +1,16 @@
--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java
+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java
@@ -6,6 +6,8 @@
@@ -6,6 +6,9 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -107,16 +109,24 @@
@@ -107,20 +110,29 @@
NBTTagCompound nbttagcompound;
NBTTagCompound nbttagcompound1;
@@ -26,16 +27,21 @@
+ FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo;
}
catch (Exception exception)
+ catch (StartupQuery.AbortedException e)
+ {
+ throw e;
+ }
catch (Exception exception1)
{
+ if (FMLCommonHandler.instance().shouldServerBeKilledQuietly())
+ {
+ throw (RuntimeException)exception;
+ }
exception.printStackTrace();
exception1.printStackTrace();
}
}
@@ -129,7 +139,9 @@
+ FMLCommonHandler.instance().confirmBackupLevelDatUse(this);
file1 = new File(this.field_75770_b, "level.dat_old");
if (file1.exists())
@@ -129,8 +141,14 @@
{
nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
nbttagcompound1 = nbttagcompound.func_74775_l("Data");
@@ -44,9 +50,14 @@
+ FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo;
}
catch (Exception exception1)
+ catch (StartupQuery.AbortedException e)
+ {
+ throw e;
+ }
catch (Exception exception)
{
@@ -146,6 +158,8 @@
exception.printStackTrace();
@@ -146,6 +164,8 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.func_74782_a("Data", nbttagcompound1);
@@ -55,7 +66,7 @@
try
{
File file1 = new File(this.field_75770_b, "level.dat_new");
@@ -184,6 +198,8 @@
@@ -184,6 +204,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.func_74782_a("Data", nbttagcompound);
@@ -0,0 +1,18 @@
package cpw.mods.fml.client;
import java.util.Map;
public class ExtendedServerListData {
public final String type;
public final boolean isCompatible;
public final Map<String,String> modData;
public final boolean isBlocked;
public ExtendedServerListData(String type, boolean isCompatible, Map<String,String> modData, boolean isBlocked)
{
this.type = type;
this.isCompatible = isCompatible;
this.modData = modData;
this.isBlocked = isBlocked;
}
}
@@ -12,18 +12,33 @@
*/
package cpw.mods.fml.client;
import java.io.File;
import java.io.FileInputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
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 java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngameMenu;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.ServerListEntryNormal;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.OldServerPinger;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.IReloadableResourceManager;
@@ -32,15 +47,32 @@ import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.ServerStatusResponse;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.storage.SaveFormatOld;
import org.apache.logging.log4j.Level;
import org.lwjgl.input.Mouse;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Maps;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.DuplicateModsFoundException;
@@ -54,7 +86,13 @@ 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.StartupQuery;
import cpw.mods.fml.common.WrongMinecraftVersionException;
import cpw.mods.fml.common.eventhandler.EventBus;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.toposort.ModSortingException;
import cpw.mods.fml.relauncher.Side;
@@ -119,6 +157,13 @@ public class FMLClientHandler implements IFMLSidedHandler
private Map<String, IResourcePack> resourcePackMap;
private BiMap<ModContainer, IModGuiFactory> guiFactories;
private Map<ServerStatusResponse,JsonObject> extraServerListData;
private Map<ServerData, ExtendedServerListData> serverDataTag;
private WeakReference<NetHandlerPlayClient> currentPlayClient;
/**
* Called to start the whole game off
*
@@ -133,7 +178,7 @@ public class FMLClientHandler implements IFMLSidedHandler
this.resourcePackList = resourcePackList;
this.resourceManager = resourceManager;
this.resourcePackMap = Maps.newHashMap();
if (minecraft.func_71355_q())
if (minecraft.isDemo())
{
FMLLog.severe("DEMO MODE DETECTED, FML will not work. Finishing now.");
haltGame("FML will not run in demo mode", new RuntimeException());
@@ -176,7 +221,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
}
catch (LoaderException le)
@@ -184,7 +229,25 @@ public class FMLClientHandler implements IFMLSidedHandler
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
}
finally
{
client.refreshResources();
}
try
{
Loader.instance().preinitializeMods();
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
}
catch (LoaderException le)
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
}
Map<String,Map<String,String>> sharedModList = (Map<String, Map<String, String>>) Launch.blackboard.get("modList");
if (sharedModList == null)
{
@@ -205,7 +268,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void haltGame(String message, Throwable t)
{
client.func_71377_b(new CrashReport(message, t));
client.displayCrashReport(new CrashReport(message, t));
throw Throwables.propagate(t);
}
/**
@@ -226,7 +289,7 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt");
customError = custom;
return;
}
@@ -237,10 +300,30 @@ public class FMLClientHandler implements IFMLSidedHandler
}
// Reload resources
client.func_110436_a();
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);
client.refreshResources();
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.instance.entityRenderMap);
guiFactories = HashBiMap.create();
for (ModContainer mc : Loader.instance().getActiveModList())
{
String className = mc.getGuiClassName();
if (Strings.isNullOrEmpty(className))
{
continue;
}
try
{
Class<?> clazz = Class.forName(className, true, Loader.instance().getModClassLoader());
Class<? extends IModGuiFactory> guiClassFactory = clazz.asSubclass(IModGuiFactory.class);
IModGuiFactory guiFactory = guiClassFactory.newInstance();
guiFactory.initialize(client);
guiFactories.put(mc, guiFactory);
} catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "A critical error occurred instantiating the gui factory for mod %s", mc.getModId());
}
}
loading = false;
KeyBindingRegistry.instance().uploadKeyBindingsToGame(client.field_71474_y);
client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings.
}
@SuppressWarnings("unused")
@@ -304,15 +387,6 @@ public class FMLClientHandler implements IFMLSidedHandler
return client;
}
/**
* Get a handle to the client's logger instance
* The client actually doesn't have one- so we return null
*/
public Logger getMinecraftLogger()
{
return null;
}
/**
* @return the instance
*/
@@ -327,8 +401,8 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
public void displayGuiScreen(EntityPlayer player, GuiScreen gui)
{
if (client.field_71439_g==player && gui != null) {
client.func_147108_a(gui);
if (client.thePlayer==player && gui != null) {
client.displayGuiScreen(gui);
}
}
@@ -368,17 +442,64 @@ public class FMLClientHandler implements IFMLSidedHandler
public void showGuiScreen(Object clientGuiElement)
{
GuiScreen gui = (GuiScreen) clientGuiElement;
client.func_147108_a(gui);
client.displayGuiScreen(gui);
}
@Override
public void queryUser(StartupQuery query) throws InterruptedException
{
if (query.getResult() == null)
{
client.displayGuiScreen(new GuiNotification(query));
}
else
{
client.displayGuiScreen(new GuiConfirmation(query));
}
if (query.isSynchronous())
{
while (client.currentScreen instanceof GuiNotification)
{
if (Thread.interrupted()) throw new InterruptedException();
client.loadingScreen.resetProgresAndWorkingMessage("");
Thread.sleep(50);
}
client.loadingScreen.resetProgresAndWorkingMessage(""); // make sure the blank screen is being drawn at the end
}
}
public boolean handleLoadingScreen(ScaledResolution scaledResolution)
{
if (client.currentScreen instanceof GuiNotification)
{
int width = scaledResolution.getScaledWidth();
int height = scaledResolution.getScaledHeight();
int mouseX = Mouse.getX() * width / client.displayWidth;
int mouseZ = height - Mouse.getY() * height / client.displayHeight - 1;
client.currentScreen.drawScreen(mouseX, mouseZ, 0);
client.currentScreen.handleInput();
return true;
}
else
{
return false;
}
}
public WorldClient getWorldClient()
{
return client.field_71441_e;
return client.theWorld;
}
public EntityClientPlayerMP getClientPlayerEntity()
{
return client.field_71439_g;
return client.thePlayer;
}
@Override
@@ -394,10 +515,16 @@ public class FMLClientHandler implements IFMLSidedHandler
// NOOP
}
@Override
public File getSavesDirectory()
{
return ((SaveFormatOld) client.getSaveLoader()).savesDirectory;
}
@Override
public MinecraftServer getServer()
{
return client.func_71401_C();
return client.getIntegratedServer();
}
public void displayMissingMods(Object modMissingPacket)
@@ -427,13 +554,14 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
public boolean isGUIOpen(Class<? extends GuiScreen> gui)
{
return client.field_71462_r != null && client.field_71462_r.getClass().equals(gui);
return client.currentScreen != null && client.currentScreen.getClass().equals(gui);
}
@Override
public void addModAsResource(ModContainer container)
{
LanguageRegistry.instance().loadLanguagesFor(container, Side.CLIENT);
Class<?> resourcePackType = container.getCustomResourcePackClass();
if (resourcePackType != null)
{
@@ -445,23 +573,17 @@ public class FMLClientHandler implements IFMLSidedHandler
}
catch (NoSuchMethodException e)
{
FMLLog.log(Level.SEVERE, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
FMLLog.log(Level.ERROR, "The container %s (type %s) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return;
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
FMLLog.log(Level.ERROR, e, "An unexpected exception occurred constructing the custom resource pack for %s", container.getName());
throw Throwables.propagate(e);
}
}
}
@Override
public void updateResourcePackList()
{
client.func_110436_a();
}
public IResourcePack getResourcePackFor(String modId)
{
return resourcePackMap.get(modId);
@@ -470,7 +592,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public String getCurrentLanguage()
{
return client.func_135016_M().func_135041_c().func_135034_a();
return client.getLanguageManager().getCurrentLanguage().getLanguageCode();
}
@Override
@@ -479,15 +601,266 @@ public class FMLClientHandler implements IFMLSidedHandler
// If the server crashes during startup, it might hang the client- reset the client so it can abend properly.
MinecraftServer server = getServer();
if (server != null && !server.func_71200_ad())
if (server != null && !server.serverIsInRunLoop())
{
ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, server, true, "field_71296"+"_Q","serverIs"+"Running");
}
}
@Override
public INetHandler getClientPlayHandler()
{
return this.currentPlayClient == null ? null : this.currentPlayClient.get();
}
@Override
public NetworkManager getClientToServerNetworkManager()
{
return this.client.func_147114_u()!=null ? this.client.func_147114_u().func_147298_b() : null;
return this.client.getNetHandler()!=null ? this.client.getNetHandler().getNetworkManager() : null;
}
public void handleClientWorldClosing(WorldClient world)
{
NetworkManager client = getClientToServerNetworkManager();
// ONLY revert a non-local connection
if (client != null && !client.isLocalChannel())
{
GameData.revertToFrozen();
}
}
public void startIntegratedServer(String id, String name, WorldSettings settings)
{
playClientBlock = new CountDownLatch(1);
}
public File getSavesDir()
{
return new File(client.mcDataDir, "saves");
}
public void tryLoadExistingWorld(GuiSelectWorld selectWorldGUI, String dirName, String saveName)
{
File dir = new File(getSavesDir(), dirName);
NBTTagCompound leveldat;
try
{
leveldat = CompressedStreamTools.readCompressed(new FileInputStream(new File(dir, "level.dat")));
}
catch (Exception e)
{
try
{
leveldat = CompressedStreamTools.readCompressed(new FileInputStream(new File(dir, "level.dat_old")));
}
catch (Exception e1)
{
FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", dirName);
return;
}
}
NBTTagCompound fmlData = leveldat.getCompoundTag("FML");
if (fmlData.hasKey("ModItemData"))
{
showGuiScreen(new GuiOldSaveLoadConfirm(dirName, saveName, selectWorldGUI));
}
else
{
try
{
client.launchIntegratedServer(dirName, saveName, (WorldSettings)null);
}
catch (StartupQuery.AbortedException e)
{
// ignore
}
}
}
public void showInGameModOptions(GuiIngameMenu guiIngameMenu)
{
showGuiScreen(new GuiIngameModOptions(guiIngameMenu));
}
public IModGuiFactory getGuiFactoryFor(ModContainer selectedMod)
{
return guiFactories.get(selectedMod);
}
public void setupServerList()
{
extraServerListData = Collections.synchronizedMap(Maps.<ServerStatusResponse,JsonObject>newHashMap());
serverDataTag = Collections.synchronizedMap(Maps.<ServerData,ExtendedServerListData>newHashMap());
}
public void captureAdditionalData(ServerStatusResponse serverstatusresponse, JsonObject jsonobject)
{
if (jsonobject.has("modinfo"))
{
JsonObject fmlData = jsonobject.get("modinfo").getAsJsonObject();
extraServerListData.put(serverstatusresponse, fmlData);
}
}
public void bindServerListData(ServerData data, ServerStatusResponse originalResponse)
{
if (extraServerListData.containsKey(originalResponse))
{
JsonObject jsonData = extraServerListData.get(originalResponse);
String type = jsonData.get("type").getAsString();
JsonArray modDataArray = jsonData.get("modList").getAsJsonArray();
boolean moddedClientAllowed = jsonData.has("clientModsAllowed") ? jsonData.get("clientModsAllowed").getAsBoolean() : true;
Builder<String, String> modListBldr = ImmutableMap.<String,String>builder();
for (JsonElement obj : modDataArray)
{
JsonObject modObj = obj.getAsJsonObject();
modListBldr.put(modObj.get("modid").getAsString(), modObj.get("version").getAsString());
}
Map<String,String> modListMap = modListBldr.build();
serverDataTag.put(data, new ExtendedServerListData(type, FMLNetworkHandler.checkModList(modListMap, Side.CLIENT) == null, modListMap, !moddedClientAllowed));
}
else
{
String serverDescription = data.serverMOTD;
boolean moddedClientAllowed = true;
if (!Strings.isNullOrEmpty(serverDescription))
{
moddedClientAllowed = !serverDescription.endsWith(":NOFML§r");
}
serverDataTag.put(data, new ExtendedServerListData("VANILLA", false, ImmutableMap.<String,String>of(), !moddedClientAllowed));
}
startupConnectionData.countDown();
}
private static final ResourceLocation iconSheet = new ResourceLocation("fml:textures/gui/icons.png");
private static final CountDownLatch startupConnectionData = new CountDownLatch(1);
public String enhanceServerListEntry(ServerListEntryNormal serverListEntry, ServerData serverEntry, int x, int width, int y, int relativeMouseX, int relativeMouseY)
{
String tooltip;
int idx;
boolean blocked = false;
if (serverDataTag.containsKey(serverEntry))
{
ExtendedServerListData extendedData = serverDataTag.get(serverEntry);
if ("FML".equals(extendedData.type) && extendedData.isCompatible)
{
idx = 0;
tooltip = String.format("Compatible FML modded server\n%d mods present", extendedData.modData.size());
}
else if ("FML".equals(extendedData.type) && !extendedData.isCompatible)
{
idx = 16;
tooltip = String.format("Incompatible FML modded server\n%d mods present", extendedData.modData.size());
}
else if ("BUKKIT".equals(extendedData.type))
{
idx = 32;
tooltip = String.format("Bukkit modded server");
}
else if ("VANILLA".equals(extendedData.type))
{
idx = 48;
tooltip = String.format("Vanilla server");
}
else
{
idx = 64;
tooltip = String.format("Unknown server data");
}
blocked = extendedData.isBlocked;
}
else
{
return null;
}
this.client.getTextureManager().bindTexture(iconSheet);
Gui.func_146110_a(x + width - 18, y + 10, 0, (float)idx, 16, 16, 256.0f, 256.0f);
if (blocked)
{
Gui.func_146110_a(x + width - 18, y + 10, 0, 80, 16, 16, 256.0f, 256.0f);
}
return relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26 ? tooltip : null;
}
public String fixDescription(String description)
{
return description.endsWith(":NOFML§r") ? description.substring(0, description.length() - 8)+"§r" : description;
}
public void connectToServerAtStartup(String host, int port)
{
setupServerList();
OldServerPinger osp = new OldServerPinger();
ServerData serverData = new ServerData("Command Line", host+":"+port);
try
{
osp.func_147224_a(serverData);
startupConnectionData.await(30, TimeUnit.SECONDS);
}
catch (Exception e)
{
showGuiScreen(new GuiConnecting(new GuiMainMenu(), client, host, port));
return;
}
connectToServer(new GuiMainMenu(), serverData);
}
public void connectToServer(GuiScreen guiMultiplayer, ServerData serverEntry)
{
ExtendedServerListData extendedData = serverDataTag.get(serverEntry);
if (extendedData != null && extendedData.isBlocked)
{
showGuiScreen(new GuiAccessDenied(guiMultiplayer, serverEntry));
}
else
{
showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry));
}
playClientBlock = new CountDownLatch(1);
}
private CountDownLatch playClientBlock;
public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient)
{
playClientBlock.countDown();
this.currentPlayClient = new WeakReference<NetHandlerPlayClient>(netHandlerPlayClient);
}
@Override
public void waitForPlayClient()
{
boolean gotIt = false;
try
{
gotIt = playClientBlock.await(1,TimeUnit.SECONDS);
} catch (InterruptedException e)
{
}
if (!gotIt)
{
throw new RuntimeException("Timeout waiting for client thread to catch up!");
}
}
@Override
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
{
if (side == Side.CLIENT)
{
waitForPlayClient();
bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayClient>(manager, channelSet, channel, side, NetHandlerPlayClient.class));
}
else
{
bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayServer>(manager, channelSet, channel, side, NetHandlerPlayServer.class));
}
}
@Override
public boolean shouldAllowPlayerLogins()
{
return true; //Always true as the server has to be started before clicking 'Open to lan'
}
}
@@ -0,0 +1,100 @@
package cpw.mods.fml.client;
import java.util.List;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
public class FMLConfigGuiFactory implements IModGuiFactory {
public static class FMLConfigGuiScreen extends GuiScreen {
private GuiScreen parent;
public FMLConfigGuiScreen(GuiScreen parent)
{
this.parent = parent;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(parent);
}
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader test config screen", this.width / 2, 40, 0xFFFFFF);
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@SuppressWarnings("unused")
private Minecraft minecraft;
@Override
public void initialize(Minecraft minecraftInstance)
{
this.minecraft = minecraftInstance;
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass()
{
return FMLConfigGuiScreen.class;
}
private static final Set<RuntimeOptionCategoryElement> fmlCategories = ImmutableSet.of(new RuntimeOptionCategoryElement("HELP", "FML"));
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
{
return fmlCategories;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
{
return new RuntimeOptionGuiHandler() {
@Override
public void paint(int x, int y, int w, int h)
{
// TODO Auto-generated method stub
}
@Override
public void close()
{
}
@Override
public void addWidgets(List<Gui> widgets, int x, int y, int w, int h)
{
widgets.add(new GuiButton(100, x+10, y+10, "HELLO"));
}
@Override
public void actionCallback(int actionId)
{
// TODO Auto-generated method stub
}
};
}
}
@@ -4,7 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO;
@@ -26,22 +26,22 @@ public class FMLFileResourcePack extends FileResourcePack {
}
@Override
public String func_130077_b()
public String getPackName()
{
return "FMLFileResourcePack:"+container.getName();
}
@Override
protected InputStream func_110591_a(String resourceName) throws IOException
protected InputStream getInputStreamByName(String resourceName) throws IOException
{
try
{
return super.func_110591_a(resourceName);
return super.getInputStreamByName(resourceName);
}
catch (IOException ioe)
{
if ("pack.mcmeta".equals(resourceName))
{
FMLLog.log(container.getName(), Level.WARNING, "Mod %s is missing a pack.mcmeta file, things may not work well", container.getName());
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -54,8 +54,8 @@ public class FMLFileResourcePack extends FileResourcePack {
}
@Override
public BufferedImage func_110586_a() throws IOException
public BufferedImage getPackImage() throws IOException
{
return ImageIO.read(func_110591_a(container.getMetadata().logoFile));
return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile));
}
}
@@ -4,7 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO;
@@ -26,27 +26,27 @@ public class FMLFolderResourcePack extends FolderResourcePack {
}
@Override
protected boolean func_110593_b(String p_110593_1_)
protected boolean hasResourceName(String p_110593_1_)
{
return super.func_110593_b(p_110593_1_);
return super.hasResourceName(p_110593_1_);
}
@Override
public String func_130077_b()
public String getPackName()
{
return "FMLFileResourcePack:"+container.getName();
}
@Override
protected InputStream func_110591_a(String resourceName) throws IOException
protected InputStream getInputStreamByName(String resourceName) throws IOException
{
try
{
return super.func_110591_a(resourceName);
return super.getInputStreamByName(resourceName);
}
catch (IOException ioe)
{
if ("pack.mcmeta".equals(resourceName))
{
FMLLog.log(container.getName(), Level.WARNING, "Mod %s is missing a pack.mcmeta file, things may not work well", container.getName());
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" +
" \"pack\": {\n"+
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
@@ -59,9 +59,9 @@ public class FMLFolderResourcePack extends FolderResourcePack {
}
@Override
public BufferedImage func_110586_a() throws IOException
public BufferedImage getPackImage() throws IOException
{
return ImageIO.read(func_110591_a(container.getMetadata().logoFile));
return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile));
}
}
@@ -0,0 +1,55 @@
/*
* 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.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.I18n;
public class GuiAccessDenied extends GuiScreen
{
private GuiScreen parent;
private ServerData data;
public GuiAccessDenied(GuiScreen parent, ServerData data)
{
this.parent = parent;
this.data = data;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(parent);
}
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.drawDefaultBackground();
int offset = Math.max(85 - 2 * 10, 10);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader could not connect to this server", this.width / 2, offset, 0xFFFFFF);
offset += 10;
this.drawCenteredString(this.fontRendererObj, String.format("The server %s has forbidden modded access", data.serverName), this.width / 2, offset, 0xFFFFFF);
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -0,0 +1,55 @@
/*
* 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 net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
public class GuiBackupFailed extends GuiScreen
{
private GuiScreen parent;
private File zipName;
public GuiBackupFailed(GuiScreen parent, File zipName)
{
this.parent = parent;
this.zipName = zipName;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(parent);
}
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.drawDefaultBackground();
int offset = Math.max(85 - 2 * 10, 10);
this.drawCenteredString(this.fontRendererObj, String.format("There was an error saving the archive %s", zipName.getName()), this.width / 2, offset, 0xFFFFFF);
offset += 10;
this.drawCenteredString(this.fontRendererObj, String.format("Please fix the problem and try again"), this.width / 2, offset, 0xFFFFFF);
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -0,0 +1,33 @@
package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiOptionButton;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.common.StartupQuery;
public class GuiConfirmation extends GuiNotification
{
public GuiConfirmation(StartupQuery query)
{
super(query);
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height - 38, I18n.format("gui.yes")));
this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height - 38, I18n.format("gui.no")));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.enabled && (button.id == 0 || button.id == 1))
{
FMLClientHandler.instance().showGuiScreen(null);
query.setResult(button.id == 0);
query.finish();
}
}
}
@@ -23,15 +23,15 @@ public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
this.customException = customException;
}
@Override
public void func_73866_w_()
public void initGui()
{
super.func_73866_w_();
this.customException.initGui(this, field_146289_q);
super.initGui();
this.customException.initGui(this, fontRendererObj);
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.customException.drawScreen(this, field_146289_q, p_73863_1_, p_73863_2_, p_73863_3_);
this.drawDefaultBackground();
this.customException.drawScreen(this, fontRendererObj, p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -31,25 +31,25 @@ public class GuiDupesFound extends GuiErrorScreen
}
@Override
public void func_73866_w_()
public void initGui()
{
super.func_73866_w_();
super.initGui();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.drawDefaultBackground();
int offset = Math.max(85 - dupes.dupes.size() * 10, 10);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, "You have mod sources that are duplicate within your system", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "You have mod sources that are duplicate within your system", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, "Mod Id : File name", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Mod Id : File name", this.width / 2, offset, 0xFFFFFF);
offset+=5;
for (Entry<ModContainer, File> mc : dupes.dupes.entries())
{
offset+=10;
this.func_73732_a(this.field_146289_q, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.width / 2, offset, 0xEEEEEE);
}
}
}
@@ -0,0 +1,55 @@
package cpw.mods.fml.client;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
public class GuiIngameModOptions extends GuiScreen
{
private final GuiScreen parentScreen;
protected String title = "Mod Options";
private GuiModOptionList optionList;
public GuiIngameModOptions(GuiScreen parentScreen)
{
this.parentScreen = parentScreen;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.optionList=new GuiModOptionList(this);
this.optionList.registerScrollButtons(this.buttonList, 7, 8);
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
@Override
protected void actionPerformed(GuiButton p_146284_1_)
{
if (p_146284_1_.enabled)
{
if (p_146284_1_.id == 200)
{
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.parentScreen);
}
}
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
// force a non-transparent background
this.drawDefaultBackground();
this.optionList.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 0xFFFFFF);
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
FontRenderer getFontRenderer() {
return fontRendererObj;
}
}
+121 -50
View File
@@ -33,12 +33,15 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Strings;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModContainer.Disableable;
/**
* @author cpw
@@ -52,6 +55,10 @@ public class GuiModList extends GuiScreen
private ModContainer selectedMod;
private int listWidth;
private ArrayList<ModContainer> mods;
private GuiButton configModButton;
private GuiButton disableModButton;
private ResourceLocation cachedLogo;
private Dimension cachedLogoDimensions;
/**
* @param mainMenu
@@ -82,91 +89,117 @@ public class GuiModList extends GuiScreen
@SuppressWarnings("unchecked")
@Override
public void func_73866_w_()
public void initGui()
{
for (ModContainer mod : mods) {
listWidth=Math.max(listWidth,getFontRenderer().func_78256_a(mod.getName()) + 10);
listWidth=Math.max(listWidth,getFontRenderer().func_78256_a(mod.getVersion()) + 10);
listWidth=Math.max(listWidth,getFontRenderer().getStringWidth(mod.getName()) + 10);
listWidth=Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 10);
}
listWidth=Math.min(listWidth, 150);
this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 - 75, this.field_146295_m - 38, I18n.func_135052_a("gui.done")));
this.buttonList.add(new GuiButton(6, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
configModButton = new GuiButton(20, 10, this.height - 60, this.listWidth, 20, "Config");
disableModButton = new GuiButton(21, 10, this.height - 38, this.listWidth, 20, "Disable");
this.buttonList.add(configModButton);
this.buttonList.add(disableModButton);
this.modList=new GuiSlotModList(this, mods, listWidth);
this.modList.registerScrollButtons(this.field_146292_n, 7, 8);
this.modList.registerScrollButtons(this.buttonList, 7, 8);
}
@Override
protected void func_146284_a(GuiButton button) {
if (button.field_146124_l)
protected void actionPerformed(GuiButton button) {
if (button.enabled)
{
switch (button.field_146127_k)
switch (button.id)
{
case 6:
this.field_146297_k.func_147108_a(this.mainMenu);
this.mc.displayGuiScreen(this.mainMenu);
return;
case 20:
try
{
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
this.mc.displayGuiScreen(newScreen);
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
}
return;
}
}
super.func_146284_a(button);
super.actionPerformed(button);
}
public int drawLine(String line, int offset, int shifty)
{
this.field_146289_q.func_78276_b(line, offset, shifty, 0xd7edea);
this.fontRendererObj.drawString(line, offset, shifty, 0xd7edea);
return shifty + 10;
}
@Override
public void func_73863_a(int p_571_1_, int p_571_2_, float p_571_3_)
public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_)
{
this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_);
this.func_73732_a(this.field_146289_q, "Mod List", this.field_146294_l / 2, 16, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Mod List", this.width / 2, 16, 0xFFFFFF);
int offset = this.listWidth + 20;
if (selectedMod != null) {
GL11.glEnable(GL11.GL_BLEND);
if (!selectedMod.getMetadata().autogenerated) {
configModButton.visible = true;
disableModButton.visible = true;
disableModButton.packedFGColour = 0xFF3377;
configModButton.enabled = false;
int shifty = 35;
String logoFile = selectedMod.getMetadata().logoFile;
if (!logoFile.isEmpty())
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
TextureManager tm = field_146297_k.func_110434_K();
TextureManager tm = mc.getTextureManager();
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
try
{
BufferedImage logo = null;
if (pack!=null)
if (cachedLogo == null)
{
logo = pack.func_110586_a();
}
else
{
InputStream logoResource = getClass().getResourceAsStream(logoFile);
if (logoResource != null)
BufferedImage logo = null;
if (pack!=null)
{
logo = ImageIO.read(logoResource);
logo = pack.getPackImage();
}
else
{
InputStream logoResource = getClass().getResourceAsStream(logoFile);
if (logoResource != null)
{
logo = ImageIO.read(logoResource);
}
}
if (logo != null)
{
cachedLogo = tm.getDynamicTextureLocation("modlogo", new DynamicTexture(logo));
cachedLogoDimensions = new Dimension(logo.getWidth(), logo.getHeight());
}
}
if (logo != null)
if (cachedLogo != null)
{
ResourceLocation rl = tm.func_110578_a("modlogo", new DynamicTexture(logo));
this.field_146297_k.field_71446_o.func_110577_a(rl);
Dimension dim = new Dimension(logo.getWidth(), logo.getHeight());
double scaleX = dim.width / 200.0;
double scaleY = dim.height / 65.0;
this.mc.renderEngine.bindTexture(cachedLogo);
double scaleX = cachedLogoDimensions.width / 200.0;
double scaleY = cachedLogoDimensions.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;
cachedLogoDimensions.width *= scale;
cachedLogoDimensions.height *= scale;
int top = 32;
Tessellator tess = Tessellator.field_78398_a;
tess.func_78382_b();
tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1);
tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1);
tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0);
tess.func_78374_a(offset, top, field_73735_i, 0, 0);
tess.func_78381_a();
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV(offset, top + cachedLogoDimensions.height, zLevel, 0, 1);
tess.addVertexWithUV(offset + cachedLogoDimensions.width, top + cachedLogoDimensions.height, zLevel, 1, 1);
tess.addVertexWithUV(offset + cachedLogoDimensions.width, top, zLevel, 1, 0);
tess.addVertexWithUV(offset, top, zLevel, 0, 0);
tess.draw();
shifty += 65;
}
@@ -176,7 +209,7 @@ public class GuiModList extends GuiScreen
;
}
}
this.field_146289_q.func_78261_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
this.fontRendererObj.drawStringWithShadow(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
shifty += 12;
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
@@ -187,30 +220,67 @@ public class GuiModList extends GuiScreen
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);
int rightSide = this.field_146294_l - offset - 20;
int rightSide = this.width - offset - 20;
if (rightSide > 20)
{
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
this.getFontRenderer().drawSplitString(selectedMod.getMetadata().description, offset, shifty + 10, rightSide, 0xDDDDDD);
}
Disableable disableable = selectedMod.canBeDisabled();
if (disableable == Disableable.RESTART)
{
disableModButton.enabled = true;
disableModButton.visible = true;
disableModButton.packedFGColour = 0xFF3377;
}
else if (disableable == Disableable.YES)
{
disableModButton.enabled = true;
disableModButton.visible = true;
disableModButton.packedFGColour = 0;
}
else
{
disableModButton.packedFGColour = 0;
disableModButton.visible = true;
disableModButton.enabled = false;
}
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
if (guiFactory == null || guiFactory.mainConfigGuiClass() == null)
{
configModButton.visible = true;
configModButton.enabled = false;
}
else
{
configModButton.visible = true;
configModButton.enabled = true;
}
} else {
offset = ( this.listWidth + this.field_146294_l ) / 2;
this.func_73732_a(this.field_146289_q, selectedMod.getName(), offset, 35, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("Version: %s",selectedMod.getVersion()), offset, 45, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
this.func_73732_a(this.field_146289_q, "No mod information found", offset, 65, 0xDDDDDD);
this.func_73732_a(this.field_146289_q, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
offset = ( this.listWidth + this.width ) / 2;
this.drawCenteredString(this.fontRendererObj, selectedMod.getName(), offset, 35, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, String.format("Version: %s",selectedMod.getVersion()), offset, 45, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "No mod information found", offset, 65, 0xDDDDDD);
this.drawCenteredString(this.fontRendererObj, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
configModButton.visible = false;
disableModButton.visible = false;
}
GL11.glDisable(GL11.GL_BLEND);
}
super.func_73863_a(p_571_1_, p_571_2_, p_571_3_);
else
{
configModButton.visible = false;
disableModButton.visible = false;
}
super.drawScreen(p_571_1_, p_571_2_, p_571_3_);
}
Minecraft getMinecraftInstance() {
return field_146297_k;
return mc;
}
FontRenderer getFontRenderer() {
return field_146289_q;
return fontRendererObj;
}
/**
@@ -224,6 +294,7 @@ public class GuiModList extends GuiScreen
} else {
this.selectedMod=null;
}
cachedLogo = null;
}
public boolean modIndexSelected(int var1)
@@ -0,0 +1,47 @@
package cpw.mods.fml.client;
import net.minecraft.client.renderer.Tessellator;
public class GuiModOptionList extends GuiScrollingList {
private GuiIngameModOptions parent;
public GuiModOptionList(GuiIngameModOptions parent)
{
super(parent.mc, 150, parent.height, 32, parent.height - 65 + 4, 10, 35);
this.parent = parent;
}
@Override
protected int getSize()
{
return 1;
}
@Override
protected void elementClicked(int index, boolean doubleClick)
{
// TODO Auto-generated method stub
}
@Override
protected boolean isSelected(int index)
{
return false;
}
@Override
protected void drawBackground()
{
}
@Override
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5)
{
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("Test 1", listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("TEST 2", listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
}
}
@@ -29,18 +29,18 @@ public class GuiModsMissing extends GuiErrorScreen
}
@Override
public void func_73866_w_()
public void initGui()
{
super.func_73866_w_();
super.initGui();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.drawDefaultBackground();
int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, "The mods and versions listed below could not be found", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The mods and versions listed below could not be found", this.width / 2, offset, 0xFFFFFF);
offset+=5;
for (ArtifactVersion v : modsMissing.missingMods)
{
@@ -50,13 +50,13 @@ public class GuiModsMissing extends GuiErrorScreen
DefaultArtifactVersion dav = (DefaultArtifactVersion)v;
if (dav.getRange() != null && dav.getRange().isUnboundedAbove())
{
this.func_73732_a(this.field_146289_q, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.width / 2, offset, 0xEEEEEE);
continue;
}
}
this.func_73732_a(this.field_146289_q, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE);
}
offset+=20;
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The file 'ForgeModLoader-client-0.log' contains more information", this.width / 2, offset, 0xFFFFFF);
}
}
@@ -29,35 +29,35 @@ public class GuiModsMissingForServer extends GuiScreen
@SuppressWarnings("unchecked")
@Override
public void func_73866_w_()
public void initGui()
{
this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 75, this.field_146295_m - 38, I18n.func_135052_a("gui.done")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 75, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void func_146284_a(GuiButton p_73875_1_)
protected void actionPerformed(GuiButton p_73875_1_)
{
if (p_73875_1_.field_146124_l && p_73875_1_.field_146127_k == 1)
if (p_73875_1_.enabled && p_73875_1_.id == 1)
{
FMLClientHandler.instance().showGuiScreen(null);
}
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.drawDefaultBackground();
int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader could not connect to this server", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader could not connect to this server", this.width / 2, offset, 0xFFFFFF);
offset += 10;
this.func_73732_a(this.field_146289_q, "The mods and versions listed below could not be found", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The mods and versions listed below could not be found", this.width / 2, offset, 0xFFFFFF);
offset += 10;
this.func_73732_a(this.field_146289_q, "They are required to play on this server", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "They are required to play on this server", this.width / 2, offset, 0xFFFFFF);
offset += 5;
for (ArtifactVersion v : modsMissing.missingMods)
{
offset += 10;
this.func_73732_a(this.field_146289_q, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE);
}
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
}
@@ -0,0 +1,62 @@
package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import cpw.mods.fml.common.StartupQuery;
public class GuiNotification extends GuiScreen
{
public GuiNotification(StartupQuery query)
{
this.query = query;
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height - 38, I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.enabled && button.id == 0)
{
FMLClientHandler.instance().showGuiScreen(null);
query.finish();
}
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.drawDefaultBackground();
String[] lines = query.getText().split("\n");
int spaceAvailable = this.height - 38 - 20;
int spaceRequired = Math.min(spaceAvailable, 10 + 10 * lines.length);
int offset = 10 + (spaceAvailable - spaceRequired) / 2; // vertically centered
for (String line : lines)
{
if (offset >= spaceAvailable)
{
this.drawCenteredString(this.fontRendererObj, "...", this.width / 2, offset, 0xFFFFFF);
break;
}
else
{
if (!line.isEmpty()) this.drawCenteredString(this.fontRendererObj, line, this.width / 2, offset, 0xFFFFFF);
offset += 10;
}
}
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
protected final StartupQuery query;
}
@@ -0,0 +1,88 @@
package cpw.mods.fml.client;
import java.io.File;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiLabel;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.world.WorldSettings;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.common.ZipperUtil;
public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback {
private String dirName;
private String saveName;
private File zip;
private GuiScreen parent;
public GuiOldSaveLoadConfirm(String dirName, String saveName, GuiScreen parent)
{
super(null, "", "", 0);
this.parent = parent;
this.dirName = dirName;
this.saveName = saveName;
this.zip = new File(FMLClientHandler.instance().getClient().mcDataDir,String.format("%s-%2$td%2$tm%2$ty%2$tH%2$tM%2$tS.zip", dirName, System.currentTimeMillis()));
}
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, String.format("The world %s contains pre-update modding data", saveName), this.width / 2, 50, 16777215);
this.drawCenteredString(this.fontRendererObj, String.format("There may be problems updating it to this version"), this.width / 2, 70, 16777215);
this.drawCenteredString(this.fontRendererObj, String.format("FML will save a zip to %s", zip.getName()), this.width / 2, 90, 16777215);
this.drawCenteredString(this.fontRendererObj, String.format("Do you wish to continue loading?"), this.width / 2, 110, 16777215);
int k;
for (k = 0; k < this.buttonList.size(); ++k)
{
((GuiButton)this.buttonList.get(k)).drawButton(this.mc, p_73863_1_, p_73863_2_);
}
for (k = 0; k < this.labelList.size(); ++k)
{
((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, p_73863_1_, p_73863_2_);
}
}
@Override
protected void actionPerformed(GuiButton p_146284_1_)
{
if (p_146284_1_.id == 1)
{
ObfuscationReflectionHelper.setPrivateValue(GuiSelectWorld.class, (GuiSelectWorld)parentScreen, false, "field_"+"146634_i");
FMLClientHandler.instance().showGuiScreen(parent);
}
else
{
FMLLog.info("Capturing current state of world %s into file %s", saveName, zip.getAbsolutePath());
try
{
ZipperUtil.zip(new File(FMLClientHandler.instance().getSavesDir(), dirName), zip);
} catch (IOException e)
{
FMLLog.log(Level.WARN, e, "There was a problem saving the backup %s. Please fix and try again", zip.getName());
FMLClientHandler.instance().showGuiScreen(new GuiBackupFailed(parent, zip));
return;
}
FMLClientHandler.instance().showGuiScreen(null);
try
{
mc.launchIntegratedServer(dirName, saveName, (WorldSettings)null);
}
catch (StartupQuery.AbortedException e)
{
// ignore
}
}
}
}
@@ -17,6 +17,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.input.Mouse;
@@ -132,15 +133,15 @@ public abstract class GuiScrollingList
public void actionPerformed(GuiButton button)
{
if (button.field_146124_l)
if (button.enabled)
{
if (button.field_146127_k == this.scrollUpActionId)
if (button.id == this.scrollUpActionId)
{
this.scrollDistance -= (float)(this.slotHeight * 2 / 3);
this.initialMouseClickY = -2.0F;
this.applyScrollLimits();
}
else if (button.field_146127_k == this.scrollDownActionId)
else if (button.id == this.scrollDownActionId)
{
this.scrollDistance += (float)(this.slotHeight * 2 / 3);
this.initialMouseClickY = -2.0F;
@@ -262,20 +263,27 @@ public abstract class GuiScrollingList
}
this.applyScrollLimits();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator var18 = Tessellator.field_78398_a;
this.client.field_71446_o.func_110577_a(Gui.field_110325_k);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var17 = 32.0F;
var18.func_78382_b();
var18.func_78378_d(2105376);
var18.func_78374_a((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.func_78374_a((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.func_78374_a((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.func_78374_a((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.func_78381_a();
// boxRight = this.listWidth / 2 - 92 - 16;
Tessellator var18 = Tessellator.instance;
if (this.client.theWorld != null)
{
this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
this.client.renderEngine.bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var17 = 32.0F;
var18.startDrawingQuads();
var18.setColorOpaque_I(2105376);
var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.draw();
}
// boxRight = this.listWidth / 2 - 92 - 16;
var10 = this.top + 4 - (int)this.scrollDistance;
if (this.field_27262_q)
@@ -298,18 +306,18 @@ public abstract class GuiScrollingList
int var15 = boxRight;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
var18.func_78382_b();
var18.func_78378_d(8421504);
var18.func_78374_a((double)var14, (double)(var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)var15, (double)(var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
var18.func_78374_a((double)var15, (double)(var19 - 2), 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)var14, (double)(var19 - 2), 0.0D, 0.0D, 0.0D);
var18.func_78378_d(0);
var18.func_78374_a((double)(var14 + 1), (double)(var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)(var15 - 1), (double)(var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
var18.func_78374_a((double)(var15 - 1), (double)(var19 - 1), 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)(var14 + 1), (double)(var19 - 1), 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.startDrawingQuads();
var18.setColorOpaque_I(8421504);
var18.addVertexWithUV((double)var14, (double)(var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)var15, (double)(var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)var15, (double)(var19 - 2), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)var14, (double)(var19 - 2), 0.0D, 0.0D, 0.0D);
var18.setColorOpaque_I(0);
var18.addVertexWithUV((double)(var14 + 1), (double)(var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)(var15 - 1), (double)(var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)(var15 - 1), (double)(var19 - 1), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)(var14 + 1), (double)(var19 - 1), 0.0D, 0.0D, 0.0D);
var18.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
@@ -319,29 +327,32 @@ public abstract class GuiScrollingList
GL11.glDisable(GL11.GL_DEPTH_TEST);
byte var20 = 4;
this.overlayBackground(0, this.top, 255, 255);
this.overlayBackground(this.bottom, this.listHeight, 255, 255);
if (this.client.theWorld == null)
{
this.overlayBackground(0, this.top, 255, 255);
this.overlayBackground(this.bottom, this.listHeight, 255, 255);
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
var18.func_78382_b();
var18.func_78384_a(0, 0);
var18.func_78374_a((double)this.left, (double)(this.top + var20), 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)this.right, (double)(this.top + var20), 0.0D, 1.0D, 1.0D);
var18.func_78384_a(0, 255);
var18.func_78374_a((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.func_78382_b();
var18.func_78384_a(0, 255);
var18.func_78374_a((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.func_78384_a(0, 0);
var18.func_78374_a((double)this.right, (double)(this.bottom - var20), 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)this.left, (double)(this.bottom - var20), 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.startDrawingQuads();
var18.setColorRGBA_I(0, 0);
var18.addVertexWithUV((double)this.left, (double)(this.top + var20), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)this.right, (double)(this.top + var20), 0.0D, 1.0D, 1.0D);
var18.setColorRGBA_I(0, 255);
var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.draw();
var18.startDrawingQuads();
var18.setColorRGBA_I(0, 255);
var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.setColorRGBA_I(0, 0);
var18.addVertexWithUV((double)this.right, (double)(this.bottom - var20), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)this.left, (double)(this.bottom - var20), 0.0D, 0.0D, 0.0D);
var18.draw();
var19 = this.getContentHeight() - (this.bottom - this.top - 4);
if (var19 > 0)
@@ -365,27 +376,27 @@ public abstract class GuiScrollingList
var14 = this.top;
}
var18.func_78382_b();
var18.func_78384_a(0, 255);
var18.func_78374_a((double)scrollBarXStart, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)scrollBarXEnd, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.func_78374_a((double)scrollBarXEnd, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)scrollBarXStart, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.func_78382_b();
var18.func_78384_a(8421504, 255);
var18.func_78374_a((double)scrollBarXStart, (double)(var14 + var13), 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)scrollBarXEnd, (double)(var14 + var13), 0.0D, 1.0D, 1.0D);
var18.func_78374_a((double)scrollBarXEnd, (double)var14, 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.func_78382_b();
var18.func_78384_a(12632256, 255);
var18.func_78374_a((double)scrollBarXStart, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
var18.func_78374_a((double)(scrollBarXEnd - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
var18.func_78374_a((double)(scrollBarXEnd - 1), (double)var14, 0.0D, 1.0D, 0.0D);
var18.func_78374_a((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.func_78381_a();
var18.startDrawingQuads();
var18.setColorRGBA_I(0, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.draw();
var18.startDrawingQuads();
var18.setColorRGBA_I(8421504, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)(var14 + var13), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)(var14 + var13), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)var14, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.draw();
var18.startDrawingQuads();
var18.setColorRGBA_I(12632256, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)(scrollBarXEnd - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)(scrollBarXEnd - 1), (double)var14, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.draw();
}
this.func_27257_b(mouseX, mouseY);
@@ -397,17 +408,47 @@ 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;
this.client.field_71446_o.func_110577_a(Gui.field_110325_k);
Tessellator var5 = Tessellator.instance;
this.client.renderEngine.bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var6 = 32.0F;
var5.func_78382_b();
var5.func_78384_a(4210752, p_22239_4_);
var5.func_78374_a(0.0D, (double)p_22239_2_, 0.0D, 0.0D, (double)((float)p_22239_2_ / var6));
var5.func_78374_a((double)this.listWidth + 30, (double)p_22239_2_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_2_ / var6));
var5.func_78384_a(4210752, p_22239_3_);
var5.func_78374_a((double)this.listWidth + 30, (double)p_22239_1_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_1_ / var6));
var5.func_78374_a(0.0D, (double)p_22239_1_, 0.0D, 0.0D, (double)((float)p_22239_1_ / var6));
var5.func_78381_a();
var5.startDrawingQuads();
var5.setColorRGBA_I(4210752, p_22239_4_);
var5.addVertexWithUV(0.0D, (double)p_22239_2_, 0.0D, 0.0D, (double)((float)p_22239_2_ / var6));
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_2_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_2_ / var6));
var5.setColorRGBA_I(4210752, p_22239_3_);
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_1_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_1_ / var6));
var5.addVertexWithUV(0.0D, (double)p_22239_1_, 0.0D, 0.0D, (double)((float)p_22239_1_ / var6));
var5.draw();
}
protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6)
{
float f = (float)(par5 >> 24 & 255) / 255.0F;
float f1 = (float)(par5 >> 16 & 255) / 255.0F;
float f2 = (float)(par5 >> 8 & 255) / 255.0F;
float f3 = (float)(par5 & 255) / 255.0F;
float f4 = (float)(par6 >> 24 & 255) / 255.0F;
float f5 = (float)(par6 >> 16 & 255) / 255.0F;
float f6 = (float)(par6 >> 8 & 255) / 255.0F;
float f7 = (float)(par6 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double)par3, (double)par2, 0.0D);
tessellator.addVertex((double)par1, (double)par2, 0.0D);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double)par1, (double)par4, 0.0D);
tessellator.addVertex((double)par3, (double)par4, 0.0D);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
@@ -31,7 +31,7 @@ public class GuiSlotModList extends GuiScrollingList
public GuiSlotModList(GuiModList parent, ArrayList<ModContainer> mods, int listWidth)
{
super(parent.getMinecraftInstance(), listWidth, parent.field_146295_m, 32, parent.field_146295_m - 65 + 4, 10, 35);
super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 66 + 4, 10, 35);
this.parent=parent;
this.mods=mods;
}
@@ -57,7 +57,7 @@ public class GuiSlotModList extends GuiScrollingList
@Override
protected void drawBackground()
{
this.parent.func_146276_q_();
this.parent.drawDefaultBackground();
}
@Override
@@ -72,15 +72,15 @@ public class GuiSlotModList extends GuiScrollingList
ModContainer mc=mods.get(listIndex);
if (Loader.instance().getModState(mc)==ModState.DISABLED)
{
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFF2222);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xFF2222);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , var3 + 22, 0xFF2222);
}
else
{
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
this.parent.getFontRenderer().func_78276_b(this.parent.getFontRenderer().func_78269_a(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getName(), listWidth - 10), this.left + 3 , var3 + 2, 0xFFFFFF);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getDisplayVersion(), listWidth - 10), this.left + 3 , var3 + 12, 0xCCCCCC);
this.parent.getFontRenderer().drawString(this.parent.getFontRenderer().trimStringToWidth(mc.getMetadata() !=null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , var3 + 22, 0xCCCCCC);
}
}
@@ -14,31 +14,31 @@ public class GuiSortingProblem extends GuiScreen {
}
@Override
public void func_73866_w_()
public void initGui()
{
super.func_73866_w_();
super.initGui();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.drawDefaultBackground();
int offset = Math.max(85 - (failedList.getVisitedNodes().size() + 3) * 10, 10);
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, "A mod sorting cycle was detected and loading cannot continue", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "A mod sorting cycle was detected and loading cannot continue", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, "The remainder of the cycle involves these mods", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The remainder of the cycle involves these mods", this.width / 2, offset, 0xFFFFFF);
offset+=5;
for (ModContainer mc : failedList.getVisitedNodes())
{
offset+=10;
this.func_73732_a(this.field_146289_q, String.format("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s : before: %s, after: %s", mc.toString(), mc.getDependants(), mc.getDependencies()), this.width / 2, offset, 0xEEEEEE);
}
offset+=20;
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The file 'ForgeModLoader-client-0.log' contains more information", this.width / 2, offset, 0xFFFFFF);
}
}
@@ -25,22 +25,22 @@ public class GuiWrongMinecraft extends GuiErrorScreen
this.wrongMC = wrongMC;
}
@Override
public void func_73866_w_()
public void initGui()
{
super.func_73866_w_();
super.initGui();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_146276_q_();
this.drawDefaultBackground();
int offset = 75;
this.func_73732_a(this.field_146289_q, "Forge Mod Loader has found a problem with your minecraft installation", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_146289_q, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.width / 2, offset, 0xFFFFFF);
offset+=5;
offset+=10;
this.func_73732_a(this.field_146289_q, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_146294_l / 2, offset, 0xEEEEEE);
this.drawCenteredString(this.fontRendererObj, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.width / 2, offset, 0xEEEEEE);
offset+=20;
this.func_73732_a(this.field_146289_q, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_146294_l / 2, offset, 0xFFFFFF);
this.drawCenteredString(this.fontRendererObj, "The file 'ForgeModLoader-client-0.log' contains more information", this.width / 2, offset, 0xFFFFFF);
}
}
@@ -0,0 +1,129 @@
package cpw.mods.fml.client;
import java.util.List;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
public interface IModGuiFactory {
/**
* Called when instantiated to initialize with the active minecraft instance.
*
* @param minecraftInstance the instance
*/
public void initialize(Minecraft minecraftInstance);
/**
* Return the name of a class extending {@link GuiScreen}. This class will
* be instantiated when the "config" button is pressed in the mod list. It will
* have a single argument constructor - the "parent" screen, the same as all
* Minecraft GUIs. The expected behaviour is that this screen will replace the
* "mod list" screen completely, and will return to the mod list screen through
* the parent link, once the appropriate action is taken from the config screen.
*
* A null from this method indicates that the mod does not provide a "config"
* button GUI screen, and the config button will be hidden/disabled.
*
* This config GUI is anticipated to provide configuration to the mod in a friendly
* visual way. It should not be abused to set internals such as IDs (they're gonna
* keep disappearing anyway), but rather, interesting behaviours. This config GUI
* is never run when a server game is running, and should be used to configure
* desired behaviours that affect server state. Costs, mod game modes, stuff like that
* can be changed here.
*
* @return A class that will be instantiated on clicks on the config button
* or null if no GUI is desired.
*/
public Class<? extends GuiScreen> mainConfigGuiClass();
/**
* Return a list of the "runtime" categories this mod wishes to populate with
* GUI elements.
*
* Runtime categories are created on demand and organized in a 'lite' tree format.
* The parent represents the parent node in the tree. There is one special parent
* 'Help' that will always list first, and is generally meant to provide Help type
* content for mods. The remaining parents will sort alphabetically, though
* this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid
* category parent.
*
* Runtime configuration itself falls into two flavours: in-game help, which is
* generally non interactive except for the text it wishes to show, and client-only
* affecting behaviours. This would include things like toggling minimaps, or cheat modes
* or anything NOT affecting the behaviour of the server. Please don't abuse this to
* change the state of the server in any way, this is intended to behave identically
* when the server is local or remote.
*
* @return the set of options this mod wishes to have available, or empty if none
*/
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories();
/**
* Return an instance of a {@link RuntimeOptionGuiHandler} that handles painting the
* right hand side option screen for the specified {@link RuntimeOptionCategoryElement}.
*
* @param element The element we wish to paint for
* @return The Handler for painting it
*/
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element);
/**
* Represents an option category and entry in the runtime gui options list.
*
* @author cpw
*
*/
public static class RuntimeOptionCategoryElement {
public final String parent;
public final String child;
public RuntimeOptionCategoryElement(String parent, String child)
{
this.parent = parent;
this.child = child;
}
}
/**
* Responsible for painting the mod specific section of runtime options GUI for a particular category
*
* @author cpw
*
*/
public interface RuntimeOptionGuiHandler {
/**
* Called to add widgets to the screen, such as buttons.
* GUI identifier numbers should start at 100 and increase.
* The callback will be through {@link #actionCallback(int)}
*
* @param x X
* @param y Y
* @param w width
* @param h height
*/
public void addWidgets(List<Gui> widgetList, int x, int y, int w, int h);
/**
* Called to paint the rectangle specified.
* @param x X
* @param y Y
* @param w width
* @param h height
*/
public void paint(int x, int y, int w, int h);
/**
* Called if a widget with id >= 100 is fired.
*
* @param actionId the actionId of the firing widget
*/
public void actionCallback(int actionId);
/**
* Called when this handler is about to go away (probably replaced by another one, or closing the
* option screen)
*/
public void close();
}
}
@@ -12,9 +12,13 @@
package cpw.mods.fml.client.registry;
import org.apache.commons.lang3.ArrayUtils;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.tileentity.TileEntity;
public class ClientRegistry
@@ -36,7 +40,12 @@ public class ClientRegistry
@SuppressWarnings("unchecked")
public static void bindTileEntitySpecialRenderer(Class <? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer specialRenderer)
{
TileEntityRendererDispatcher.field_147556_a.field_147559_m.put(tileEntityClass, specialRenderer);
specialRenderer.func_147497_a(TileEntityRendererDispatcher.field_147556_a);
TileEntityRendererDispatcher.instance.mapSpecialRenderers.put(tileEntityClass, specialRenderer);
specialRenderer.func_147497_a(TileEntityRendererDispatcher.instance);
}
public static void registerKeyBinding(KeyBinding key)
{
Minecraft.getMinecraft().gameSettings.keyBindings = ArrayUtils.add(Minecraft.getMinecraft().gameSettings.keyBindings, key);
}
}
@@ -5,7 +5,7 @@
* 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
*/
@@ -18,11 +18,11 @@ import net.minecraft.world.IBlockAccess;
public interface ISimpleBlockRenderingHandler
{
public abstract void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer);
public abstract void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer);
public abstract boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer);
public abstract boolean shouldRender3DInInventory();
public abstract boolean shouldRender3DInInventory(int modelId);
public abstract int getRenderId();
}
@@ -1,203 +0,0 @@
/*
* 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.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
public class KeyBindingRegistry
{
/**
* Register a KeyHandler to the game. This handler will be called on certain tick events
* if any of its key is inactive or has recently changed state
*
* @param handler
*/
public static void registerKeyBinding(KeyHandler handler) {
instance().keyHandlers.add(handler);
if (!handler.isDummy)
{
TickRegistry.registerTickHandler(handler, Side.CLIENT);
}
}
/**
* Extend this class to register a KeyBinding and recieve callback
* when the key binding is triggered
*
* @author cpw
*
*/
public static abstract class KeyHandler implements ITickHandler
{
protected KeyBinding[] keyBindings;
protected boolean[] keyDown;
protected boolean[] repeatings;
private boolean isDummy;
/**
* Pass an array of keybindings and a repeat flag for each one
*
* @param keyBindings
* @param repeatings
*/
public KeyHandler(KeyBinding[] keyBindings, boolean[] repeatings)
{
assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length";
this.keyBindings = keyBindings;
this.repeatings = repeatings;
this.keyDown = new boolean[keyBindings.length];
}
/**
* Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire
* if you use this method
*
* @param keyBindings
*/
public KeyHandler(KeyBinding[] keyBindings)
{
this.keyBindings = keyBindings;
this.isDummy = true;
}
public KeyBinding[] getKeyBindings()
{
return this.keyBindings;
}
/**
* Not to be overridden - KeyBindings are tickhandlers under the covers
*/
@Override
public final void tickStart(EnumSet<TickType> type, Object... tickData)
{
keyTick(type, false);
}
/**
* Not to be overridden - KeyBindings are tickhandlers under the covers
*/
@Override
public final void tickEnd(EnumSet<TickType> type, Object... tickData)
{
keyTick(type, true);
}
private void keyTick(EnumSet<TickType> type, boolean tickEnd)
{
for (int i = 0; i < keyBindings.length; i++)
{
KeyBinding keyBinding = keyBindings[i];
int keyCode = keyBinding.func_151463_i();
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i] || (state && repeatings[i]))
{
if (state)
{
keyDown(type, keyBinding, tickEnd, state!=keyDown[i]);
}
else
{
keyUp(type, keyBinding, tickEnd);
}
if (tickEnd)
{
keyDown[i] = state;
}
}
}
}
/**
* Called when the key is first in the down position on any tick from the {@link #ticks()}
* set. Will be called subsequently with isRepeat set to true
*
* @see #keyUp(EnumSet, KeyBinding, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
* @param isRepeat is it a repeat key event
*/
public abstract void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
/**
* Fired once when the key changes state from down to up
*
* @see #keyDown(EnumSet, KeyBinding, boolean, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
*/
public abstract void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd);
/**
* This is the list of ticks for which the key binding should trigger. The only
* valid ticks are client side ticks, obviously.
*
* @see cpw.mods.fml.common.ITickHandler#ticks()
*/
public abstract EnumSet<TickType> ticks();
}
private static final KeyBindingRegistry INSTANCE = new KeyBindingRegistry();
private Set<KeyHandler> keyHandlers = Sets.newLinkedHashSet();
/**
* Deprecated as it should not be used by client code
* @return
*/
@Deprecated
public static KeyBindingRegistry instance()
{
return INSTANCE;
}
public void uploadKeyBindingsToGame(GameSettings settings)
{
ArrayList<KeyBinding> harvestedBindings = Lists.newArrayList();
for (KeyHandler key : keyHandlers)
{
for (KeyBinding kb : key.keyBindings)
{
harvestedBindings.add(kb);
}
}
KeyBinding[] modKeyBindings = harvestedBindings.toArray(new KeyBinding[harvestedBindings.size()]);
KeyBinding[] allKeys = new KeyBinding[settings.field_74324_K.length + modKeyBindings.length];
System.arraycopy(settings.field_74324_K, 0, allKeys, 0, settings.field_74324_K.length);
System.arraycopy(modKeyBindings, 0, allKeys, settings.field_74324_K.length, modKeyBindings.length);
settings.field_74324_K = allKeys;
settings.func_74300_a();
}
}
@@ -35,7 +35,7 @@ public class RenderingRegistry
{
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private int nextRenderId = 40;
private int nextRenderId = 42;
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
@@ -48,8 +48,8 @@ public class RenderingRegistry
*/
public static int addNewArmourRendererPrefix(String armor)
{
RenderBiped.field_82424_k = ObjectArrays.concat(RenderBiped.field_82424_k, armor);
return RenderBiped.field_82424_k.length - 1;
RenderBiped.bipedArmorFilenamePrefix = ObjectArrays.concat(RenderBiped.bipedArmorFilenamePrefix, armor);
return RenderBiped.bipedArmorFilenamePrefix.length - 1;
}
/**
@@ -128,7 +128,7 @@ public class RenderingRegistry
public boolean renderItemAsFull3DBlock(int modelId)
{
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelId);
return bri != null && bri.shouldRender3DInInventory();
return bri != null && bri.shouldRender3DInInventory(modelId);
}
public void loadEntityRenderers(Map<Class<? extends Entity>, Render> rendererMap)
@@ -136,7 +136,7 @@ public class RenderingRegistry
for (EntityRendererInfo info : entityRenderers)
{
rendererMap.put(info.target, info.renderer);
info.renderer.func_76976_a(RenderManager.field_78727_a);
info.renderer.setRenderManager(RenderManager.instance);
}
}
}
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.ImmutableList;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.common.versioning.ArtifactVersion;
@@ -109,6 +110,7 @@ public class DummyModContainer implements ModContainer
return md.version;
}
@Override
public boolean matches(Object mod)
{
return false;
@@ -141,12 +143,6 @@ public class DummyModContainer implements ModContainer
return false;
}
@Override
public boolean isNetworkMod()
{
return false;
}
@Override
public String getDisplayVersion()
{
@@ -186,4 +182,22 @@ public class DummyModContainer implements ModContainer
{
return null;
}
@Override
public Disableable canBeDisabled()
{
return Disableable.NEVER;
}
@Override
public String getGuiClassName()
{
return null;
}
@Override
public List<String> getOwnedPackages()
{
return ImmutableList.of();
}
}
@@ -12,27 +12,33 @@
package cpw.mods.fml.common;
import java.util.EnumSet;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetworkManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import com.google.common.base.Joiner;
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;
@@ -41,7 +47,11 @@ import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.common.eventhandler.EventBus;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.server.FMLServerHandler;
@@ -70,16 +80,24 @@ public class FMLCommonHandler
*/
private IFMLSidedHandler sidedDelegate;
private List<IScheduledTickHandler> scheduledClientTicks = Lists.newArrayList();
private List<IScheduledTickHandler> scheduledServerTicks = Lists.newArrayList();
private Class<?> forge;
private boolean noForge;
private List<String> brandings;
private List<String> brandingsNoMC;
private List<ICrashCallable> crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation());
private Set<SaveHandler> handlerSet = Sets.newSetFromMap(new MapMaker().weakKeys().<SaveHandler,Boolean>makeMap());
private WeakReference<SaveHandler> handlerToCheck;
private EventBus eventBus = new EventBus();
private volatile CountDownLatch exitLatch = null;
/**
* The FML event bus. Subscribe here for FML related events
*
* @return the event bus
*/
public EventBus bus()
{
return eventBus;
}
public void beginLoading(IFMLSidedHandler handler)
{
@@ -90,48 +108,6 @@ public class FMLCommonHandler
FMLLog.log("MinecraftForge", Level.INFO, "Completed early MinecraftForge initialization");
}
public void rescheduleTicks(Side side)
{
TickRegistry.updateTickQueue(side.isClient() ? scheduledClientTicks : scheduledServerTicks, side);
}
public void tickStart(EnumSet<TickType> ticks, Side side, Object ... data)
{
List<IScheduledTickHandler> scheduledTicks = side.isClient() ? scheduledClientTicks : scheduledServerTicks;
if (scheduledTicks.size()==0)
{
return;
}
for (IScheduledTickHandler ticker : scheduledTicks)
{
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
ticksToRun.retainAll(ticks);
if (!ticksToRun.isEmpty())
{
ticker.tickStart(ticksToRun, data);
}
}
}
public void tickEnd(EnumSet<TickType> ticks, Side side, Object ... data)
{
List<IScheduledTickHandler> scheduledTicks = side.isClient() ? scheduledClientTicks : scheduledServerTicks;
if (scheduledTicks.size()==0)
{
return;
}
for (IScheduledTickHandler ticker : scheduledTicks)
{
EnumSet<TickType> ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
ticksToRun.retainAll(ticks);
if (!ticksToRun.isEmpty())
{
ticker.tickEnd(ticksToRun, data);
}
}
}
/**
* @return the instance
*/
@@ -145,7 +121,14 @@ public class FMLCommonHandler
*/
public ModContainer findContainerFor(Object mod)
{
return Loader.instance().getReversedModObjectList().get(mod);
if (mod instanceof String)
{
return Loader.instance().getIndexedModList().get(mod);
}
else
{
return Loader.instance().getReversedModObjectList().get(mod);
}
}
/**
* Get the forge mod loader logging instance (goes to the forgemodloader log file)
@@ -181,7 +164,7 @@ public class FMLCommonHandler
*/
public void raiseException(Throwable exception, String message, boolean stopGame)
{
FMLLog.log(Level.SEVERE, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
FMLLog.log(Level.ERROR, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame);
if (stopGame)
{
getSidedDelegate().haltGame(message,exception);
@@ -261,37 +244,28 @@ public class FMLCommonHandler
public void onPostServerTick()
{
tickEnd(EnumSet.of(TickType.SERVER), Side.SERVER);
bus().post(new TickEvent.ServerTickEvent(Phase.END));
}
/**
* Every tick just after world and other ticks occur
*/
public void onPostWorldTick(Object world)
public void onPostWorldTick(World world)
{
tickEnd(EnumSet.of(TickType.WORLD), Side.SERVER, world);
bus().post(new TickEvent.WorldTickEvent(Side.SERVER, Phase.END, world));
}
public void onPreServerTick()
{
tickStart(EnumSet.of(TickType.SERVER), Side.SERVER);
bus().post(new TickEvent.ServerTickEvent(Phase.START));
}
/**
* Every tick just before world and other ticks occur
*/
public void onPreWorldTick(Object world)
public void onPreWorldTick(World world)
{
tickStart(EnumSet.of(TickType.WORLD), Side.SERVER, world);
}
public void onWorldLoadTick(World[] worlds)
{
rescheduleTicks(Side.SERVER);
for (World w : worlds)
{
tickStart(EnumSet.of(TickType.WORLDLOAD), Side.SERVER, w);
}
bus().post(new TickEvent.WorldTickEvent(Side.SERVER, Phase.START, world));
}
public boolean handleServerAboutToStart(MinecraftServer server)
@@ -314,6 +288,10 @@ public class FMLCommonHandler
Loader.instance().serverStopping();
}
public File getSavesDirectory() {
return sidedDelegate.getSavesDirectory();
}
public MinecraftServer getMinecraftServerInstance()
{
return sidedDelegate.getServer();
@@ -324,6 +302,11 @@ public class FMLCommonHandler
sidedDelegate.showGuiScreen(clientGuiElement);
}
public void queryUser(StartupQuery query) throws InterruptedException
{
sidedDelegate.queryUser(query);
}
public void onServerStart(MinecraftServer dedicatedServer)
{
FMLServerHandler.instance();
@@ -338,35 +321,32 @@ public class FMLCommonHandler
public void onPreClientTick()
{
tickStart(EnumSet.of(TickType.CLIENT), Side.CLIENT);
bus().post(new TickEvent.ClientTickEvent(Phase.START));
}
public void onPostClientTick()
{
tickEnd(EnumSet.of(TickType.CLIENT), Side.CLIENT);
bus().post(new TickEvent.ClientTickEvent(Phase.END));
}
public void onRenderTickStart(float timer)
{
tickStart(EnumSet.of(TickType.RENDER), Side.CLIENT, timer);
bus().post(new TickEvent.RenderTickEvent(Phase.START, timer));
}
public void onRenderTickEnd(float timer)
{
tickEnd(EnumSet.of(TickType.RENDER), Side.CLIENT, timer);
bus().post(new TickEvent.RenderTickEvent(Phase.END, timer));
}
public void onPlayerPreTick(EntityPlayer player)
{
Side side = player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT;
tickStart(EnumSet.of(TickType.PLAYER), side, player);
bus().post(new TickEvent.PlayerTickEvent(Phase.START, player));
}
public void onPlayerPostTick(EntityPlayer player)
{
Side side = player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT;
tickEnd(EnumSet.of(TickType.PLAYER), side, player);
bus().post(new TickEvent.PlayerTickEvent(Phase.END, player));
}
public void registerCrashCallable(ICrashCallable callable)
@@ -378,7 +358,7 @@ public class FMLCommonHandler
{
for (ICrashCallable call: crashCallables)
{
category.func_71500_a(call.getLabel(), call);
category.addCrashSectionCallable(call.getLabel(), call);
}
}
@@ -392,7 +372,7 @@ public class FMLCommonHandler
if (wac != null)
{
NBTTagCompound dataForWriting = wac.getDataForWriting(handler, worldInfo);
tagCompound.func_74782_a(mc.getModId(), dataForWriting);
tagCompound.setTag(mc.getModId(), dataForWriting);
}
}
}
@@ -409,8 +389,9 @@ public class FMLCommonHandler
return;
}
handlerSet.add(handler);
handlerToCheck = new WeakReference<SaveHandler>(handler); // for confirmBackupLevelDatUse
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
// worldInfo.setAdditionalProperties(additionalProperties);
worldInfo.setAdditionalProperties(additionalProperties);
for (ModContainer mc : Loader.instance().getModList())
{
if (mc instanceof InjectedModContainer)
@@ -418,12 +399,29 @@ public class FMLCommonHandler
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
if (wac != null)
{
wac.readData(handler, worldInfo, additionalProperties, tagCompound.func_74775_l(mc.getModId()));
wac.readData(handler, worldInfo, additionalProperties, tagCompound.getCompoundTag(mc.getModId()));
}
}
}
}
public void confirmBackupLevelDatUse(SaveHandler handler)
{
if (handlerToCheck == null || handlerToCheck.get() != handler) {
// only run if the save has been initially loaded
handlerToCheck = null;
return;
}
String text = "Forge Mod Loader detected that the backup level.dat is being used.\n\n" +
"This may happen due to a bug or corruption, continuing can damage\n" +
"your world beyond repair or lose data / progress.\n\n" +
"It's recommended to create a world backup before continuing.";
boolean confirmed = StartupQuery.confirm(text);
if (!confirmed) StartupQuery.abort();
}
public boolean shouldServerBeKilledQuietly()
{
if (sidedDelegate == null)
@@ -433,6 +431,50 @@ public class FMLCommonHandler
return sidedDelegate.shouldServerShouldBeKilledQuietly();
}
/**
* Make handleExit() wait for handleServerStopped().
*
* For internal use only!
*/
public void expectServerStopped()
{
exitLatch = new CountDownLatch(1);
}
/**
* Delayed System.exit() until the server is actually stopped/done saving.
*
* For internal use only!
*
* @param retVal Exit code for System.exit()
*/
public void handleExit(int retVal)
{
CountDownLatch latch = exitLatch;
if (latch != null)
{
try
{
FMLLog.info("Waiting for the server to terminate/save.");
if (!latch.await(10, TimeUnit.SECONDS))
{
FMLLog.warning("The server didn't stop within 10 seconds, exiting anyway.");
}
else
{
FMLLog.info("Server terminated.");
}
}
catch (InterruptedException e)
{
FMLLog.warning("Interrupted wait, exiting.");
}
}
System.exit(retVal);
}
public void handleServerStopped()
{
sidedDelegate.serverStopped();
@@ -440,6 +482,15 @@ public class FMLCommonHandler
Loader.instance().serverStopped();
// FORCE the internal server to stop: hello optifine workaround!
if (server!=null) ObfuscationReflectionHelper.setPrivateValue(MinecraftServer.class, server, false, "field_71316"+"_v", "u", "serverStopped");
// allow any pending exit to continue, clear exitLatch
CountDownLatch latch = exitLatch;
if (latch != null)
{
latch.countDown();
exitLatch = null;
}
}
public String getModName()
@@ -463,11 +514,6 @@ public class FMLCommonHandler
sidedDelegate.addModAsResource(container);
}
public void updateResourcePackList()
{
sidedDelegate.updateResourcePackList();
}
public String getCurrentLanguage()
{
@@ -482,4 +528,69 @@ public class FMLCommonHandler
{
return sidedDelegate.getClientToServerNetworkManager();
}
public void fireMouseInput()
{
bus().post(new InputEvent.MouseInputEvent());
}
public void fireKeyInput()
{
bus().post(new InputEvent.KeyInputEvent());
}
public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
{
bus().post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim));
}
public void firePlayerLoggedIn(EntityPlayer player)
{
bus().post(new PlayerEvent.PlayerLoggedInEvent(player));
}
public void firePlayerLoggedOut(EntityPlayer player)
{
bus().post(new PlayerEvent.PlayerLoggedOutEvent(player));
}
public void firePlayerRespawnEvent(EntityPlayer player)
{
bus().post(new PlayerEvent.PlayerRespawnEvent(player));
}
public void firePlayerItemPickupEvent(EntityPlayer player, EntityItem item)
{
bus().post(new PlayerEvent.ItemPickupEvent(player, item));
}
public void firePlayerCraftingEvent(EntityPlayer player, ItemStack crafted, IInventory craftMatrix)
{
bus().post(new PlayerEvent.ItemCraftedEvent(player, crafted, craftMatrix));
}
public void firePlayerSmeltedEvent(EntityPlayer player, ItemStack smelted)
{
bus().post(new PlayerEvent.ItemSmeltedEvent(player, smelted));
}
public INetHandler getClientPlayHandler()
{
return sidedDelegate.getClientPlayHandler();
}
public void waitForPlayClient()
{
sidedDelegate.waitForPlayClient();
}
public void fireNetRegistrationEvent(NetworkManager manager, Set<String> channelSet, String channel, Side side)
{
sidedDelegate.fireNetRegistrationEvent(bus(), manager, channelSet, channel, side);
}
public boolean shouldAllowPlayerLogins()
{
return sidedDelegate.shouldAllowPlayerLogins();
}
}
@@ -15,9 +15,12 @@ package cpw.mods.fml.common;
import java.io.File;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.Set;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
@@ -25,6 +28,8 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import org.apache.logging.log4j.Level;
import com.google.common.collect.Maps;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
@@ -53,7 +58,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
meta.name="Forge Mod Loader";
meta.version=Loader.instance().getFMLVersionString();
meta.credits="Made possible with help from many people";
meta.authorList=Arrays.asList("cpw, LexManos");
meta.authorList=Arrays.asList("cpw", "LexManos", "Player");
meta.description="The Forge Mod Loader provides the ability for systems to load mods " +
"from the file system. It also provides key capabilities for mods to be able " +
"to cooperate and provide a good modding environment. ";
@@ -90,39 +95,64 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
for (ModContainer mc : Loader.instance().getActiveModList())
{
NBTTagCompound mod = new NBTTagCompound();
mod.func_74778_a("ModId", mc.getModId());
mod.func_74778_a("ModVersion", mc.getVersion());
list.func_74742_a(mod);
mod.setString("ModId", mc.getModId());
mod.setString("ModVersion", mc.getVersion());
list.appendTag(mod);
}
fmlData.func_74782_a("ModList", list);
fmlData.setTag("ModList", list);
// name <-> id mappings
NBTTagList dataList = new NBTTagList();
FMLLog.fine("Gathering id map for writing to world save %s", info.getWorldName());
Map<String,Integer> itemList = GameData.buildItemDataList();
for (Entry<String, Integer> item : itemList.entrySet())
{
NBTTagCompound tag = new NBTTagCompound();
tag.func_74778_a("K",item.getKey());
tag.func_74768_a("V",item.getValue());
dataList.func_74742_a(tag);
tag.setString("K",item.getKey());
tag.setInteger("V",item.getValue());
dataList.appendTag(tag);
}
fmlData.func_74782_a("ItemData", dataList);
fmlData.setTag("ItemData", dataList);
// blocked ids
fmlData.setIntArray("BlockedItemIds", GameData.getBlockedIds());
// block aliases
NBTTagList blockAliasList = new NBTTagList();
for (Entry<String, String> entry : GameData.getBlockRegistry().getAliases().entrySet())
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("K", entry.getKey());
tag.setString("V", entry.getValue());
blockAliasList.appendTag(tag);
}
fmlData.setTag("BlockAliases", blockAliasList);
// item aliases
NBTTagList itemAliasList = new NBTTagList();
for (Entry<String, String> entry : GameData.getItemRegistry().getAliases().entrySet())
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("K", entry.getKey());
tag.setString("V", entry.getValue());
itemAliasList.appendTag(tag);
}
fmlData.setTag("ItemAliases", itemAliasList);
return fmlData;
}
@Override
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
{
if (tag.func_74764_b("ModList"))
if (tag.hasKey("ModList"))
{
NBTTagList modList = tag.func_150295_c("ModList", (byte)10);
for (int i = 0; i < modList.func_74745_c(); i++)
NBTTagList modList = tag.getTagList("ModList", (byte)10);
for (int i = 0; i < modList.tagCount(); i++)
{
NBTTagCompound mod = modList.func_150305_b(i);
String modId = mod.func_74779_i("ModId");
String modVersion = mod.func_74779_i("ModVersion");
NBTTagCompound mod = modList.getCompoundTagAt(i);
String modId = mod.getString("ModId");
String modVersion = mod.getString("ModVersion");
ModContainer container = Loader.instance().getIndexedModList().get(modId);
if (container == null)
{
FMLLog.log("fml.ModTracker", Level.SEVERE, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
FMLLog.log("fml.ModTracker", Level.ERROR, "This world was saved with mod %s which appears to be missing, things may not work well", modId);
continue;
}
if (!modVersion.equals(container.getVersion()))
@@ -131,22 +161,93 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
}
}
}
if (tag.func_74764_b("ModItemData"))
List<String> failedElements = null;
if (tag.hasKey("ModItemData"))
{
NBTTagList modList = tag.func_150295_c("ModItemData", (byte)10);
// Set<ItemData> worldSaveItems = GameData.buildWorldItemData(modList);
// GameData.validateWorldSave(worldSaveItems);
}
else if (tag.func_74764_b("ItemData"))
{
NBTTagList list = tag.func_150295_c("ItemData", (byte)10);
FMLLog.info("Attempting to convert old world data to new system. This may be trouble!");
NBTTagList modList = tag.getTagList("ModItemData", (byte)10);
Map<String,Integer> dataList = Maps.newLinkedHashMap();
for (int i = 0; i < list.func_74745_c(); i++)
for (int i = 0; i < modList.tagCount(); i++)
{
NBTTagCompound dataTag = list.func_150305_b(i);
dataList.put(dataTag.func_74779_i("K"), dataTag.func_74762_e("V"));
NBTTagCompound itemTag = modList.getCompoundTagAt(i);
String modId = itemTag.getString("ModId");
String itemType = itemTag.getString("ItemType");
int itemId = itemTag.getInteger("ItemId");
int ordinal = itemTag.getInteger("ordinal");
String forcedModId = itemTag.hasKey("ForcedModId") ? itemTag.getString("ForcedModId") : null;
String forcedName = itemTag.hasKey("ForcedName") ? itemTag.getString("ForcedName") : null;
if (forcedName == null)
{
FMLLog.warning("Found unlabelled item in world save, this may cause problems. The item type %s:%d will not be present", itemType, ordinal);
}
else
{
// all entries are Items, blocks were only saved through their ItemBlock
String itemLabel = String.format("%c%s:%s", '\u0002', forcedModId != null ? forcedModId : modId, forcedName);
dataList.put(itemLabel, itemId);
}
}
GameData.injectWorldIDMap(dataList);
failedElements = GameData.injectWorldIDMap(dataList, true, true);
}
else if (tag.hasKey("ItemData"))
{
// name <-> id mappings
NBTTagList list = tag.getTagList("ItemData", 10);
Map<String,Integer> dataList = Maps.newLinkedHashMap();
for (int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound dataTag = list.getCompoundTagAt(i);
dataList.put(dataTag.getString("K"), dataTag.getInteger("V"));
}
Set<Integer> blockedIds = new HashSet<Integer>();
if (!tag.hasKey("BlockedItemIds")) // no blocked id info -> old 1.7 save
{
// old early 1.7 save potentially affected by the registry mapping bug
// fix the ids the best we can...
GameData.fixBrokenIds(dataList, blockedIds);
}
// blocked ids
for (int id : tag.getIntArray("BlockedItemIds"))
{
blockedIds.add(id);
}
// block aliases
Map<String, String> blockAliases = new HashMap<String, String>();
list = tag.getTagList("BlockAliases", 10);
for (int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound dataTag = list.getCompoundTagAt(i);
blockAliases.put(dataTag.getString("K"), dataTag.getString("V"));
}
// item aliases
Map<String, String> itemAliases = new HashMap<String, String>();
list = tag.getTagList("ItemAliases", 10);
for (int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound dataTag = list.getCompoundTagAt(i);
itemAliases.put(dataTag.getString("K"), dataTag.getString("V"));
}
failedElements = GameData.injectWorldIDMap(dataList, blockedIds, blockAliases, itemAliases, true, true);
}
if (failedElements != null && !failedElements.isEmpty())
{
String text = "Forge Mod Loader could not load this save.\n\n" +
"There are "+failedElements.size()+" unassigned blocks and items in this save.\n" +
"You will not be able to load until they are present again.\n\n" +
"Missing Blocks/Items:\n";
for (String s : failedElements) text += s + "\n";
StartupQuery.notify(text);
StartupQuery.abort();
}
}
@@ -169,4 +270,16 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai
{
return getSource().isDirectory() ? FMLFolderResourcePack.class : FMLFileResourcePack.class;
}
@Override
public String getGuiClassName()
{
return "cpw.mods.fml.client.FMLConfigGuiFactory";
}
@Override
public Object getMod()
{
return this;
}
}
+22 -19
View File
@@ -12,17 +12,17 @@
package cpw.mods.fml.common;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
@SuppressWarnings("static-access")
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)
public static void log(String targetLog, Level level, String format, Object... data)
{
coreLog.log(logChannel, level, format, data);
coreLog.log(targetLog, level, format, data);
}
public static void log(Level level, String format, Object... data)
@@ -30,9 +30,9 @@ public class FMLLog
coreLog.log(level, format, data);
}
public static void log(String logChannel, Level level, Throwable ex, String format, Object... data)
public static void log(String targetLog, Level level, Throwable ex, String format, Object... data)
{
coreLog.log(logChannel, level, ex, format, data);
coreLog.log(targetLog, level, ex, format, data);
}
public static void log(Level level, Throwable ex, String format, Object... data)
@@ -42,12 +42,24 @@ public class FMLLog
public static void severe(String format, Object... data)
{
log(Level.SEVERE, format, data);
log(Level.ERROR, format, data);
}
public static void bigWarning(String format, Object... data)
{
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
log(Level.WARN, "****************************************");
log(Level.WARN, "* "+format, data);
for (int i = 2; i < 8 && i < trace.length; i++)
{
log(Level.WARN, "* at %s%s", trace[i].toString(), i == 7 ? "..." : "");
}
log(Level.WARN, "****************************************");
}
public static void warning(String format, Object... data)
{
log(Level.WARNING, format, data);
log(Level.WARN, format, data);
}
public static void info(String format, Object... data)
@@ -57,25 +69,16 @@ public class FMLLog
public static void fine(String format, Object... data)
{
log(Level.FINE, format, data);
log(Level.DEBUG, format, data);
}
public static void finer(String format, Object... data)
{
log(Level.FINER, format, data);
log(Level.TRACE, format, data);
}
public static void finest(String format, Object... data)
{
log(Level.FINEST, format, data);
}
public static Logger getLogger()
{
return coreLog.getLogger();
}
public static void makeLog(String logChannel)
{
coreLog.makeLog(logChannel);
}
}
@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -52,15 +52,6 @@ import cpw.mods.fml.common.discovery.ModCandidate;
import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.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.network.NetworkRegistry;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
@@ -80,7 +71,6 @@ public class FMLModContainer implements ModContainer
private EventBus eventBus;
private LoadController controller;
private DefaultArtifactVersion processedVersion;
private boolean isNetworkMod;
private String annotationDependencies;
private VersionRange minecraftAccepted;
@@ -89,21 +79,10 @@ public class FMLModContainer implements ModContainer
private Certificate certificate;
private String modLanguage;
private ILanguageAdapter languageAdapter;
private Disableable disableability;
private ListMultimap<Class<? extends FMLEvent>,Method> eventMethods;
private Map<String, String> customModProperties;
private ModCandidate candidate;
private static final Set<Class<? extends FMLEvent>> modEventTypes = ImmutableSet.<Class<? extends FMLEvent>>builder()
.add(FMLPreInitializationEvent.class)
.add(FMLInitializationEvent.class)
.add(FMLPostInitializationEvent.class)
.add(FMLServerAboutToStartEvent.class)
.add(FMLServerStartingEvent.class)
.add(FMLServerStartedEvent.class)
.add(FMLServerStoppingEvent.class)
.add(FMLServerStoppedEvent.class)
.add(IMCEvent.class)
.add(FMLFingerprintViolationEvent.class)
.build();
public FMLModContainer(String className, ModCandidate container, Map<String,Object> modDescriptor)
{
@@ -170,11 +149,11 @@ public class FMLModContainer implements ModContainer
modMetadata.requiredMods = requirements;
modMetadata.dependencies = dependencies;
modMetadata.dependants = dependants;
FMLLog.log(getModId(), Level.FINEST, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
FMLLog.log(getModId(), Level.TRACE, "Parsed dependency info : %s %s %s", requirements, dependencies, dependants);
}
else
{
FMLLog.log(getModId(), Level.FINEST, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
FMLLog.log(getModId(), Level.TRACE, "Using mcmod dependency info : %s %s %s", modMetadata.requiredMods, modMetadata.dependencies, modMetadata.dependants);
}
if (Strings.isNullOrEmpty(modMetadata.name))
{
@@ -188,18 +167,18 @@ public class FMLModContainer implements ModContainer
if (versionProps != null)
{
internalVersion = versionProps.getProperty(getModId()+".version");
FMLLog.log(getModId(), Level.FINE, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
FMLLog.log(getModId(), Level.DEBUG, "Found version %s for mod %s in version.properties, using", internalVersion, getModId());
}
}
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(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);
FMLLog.log(getModId(), Level.WARN, "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.log(getModId(), Level.WARNING, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
FMLLog.log(getModId(), Level.WARN, "Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
modMetadata.version = internalVersion = "1.0";
}
@@ -218,7 +197,7 @@ public class FMLModContainer implements ModContainer
{
try
{
FMLLog.log(getModId(), Level.FINE,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
FMLLog.log(getModId(), Level.DEBUG,"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())
{
@@ -247,7 +226,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.FINEST, "Failed to find a usable version.properties file");
FMLLog.log(getModId(), Level.TRACE, "Failed to find a usable version.properties file");
return null;
}
}
@@ -299,7 +278,7 @@ public class FMLModContainer implements ModContainer
{
if (this.enabled)
{
FMLLog.log(getModId(), Level.FINE, "Enabling mod %s", getModId());
FMLLog.log(getModId(), Level.DEBUG, "Enabling mod %s", getModId());
this.eventBus = bus;
this.controller = controller;
eventBus.register(this);
@@ -321,14 +300,14 @@ public class FMLModContainer implements ModContainer
{
if (a.annotationType().equals(Mod.EventHandler.class))
{
if (m.getParameterTypes().length == 1 && modEventTypes.contains(m.getParameterTypes()[0]))
if (m.getParameterTypes().length == 1 && FMLEvent.class.isAssignableFrom(m.getParameterTypes()[0]))
{
m.setAccessible(true);
eventMethods.put((Class<? extends FMLEvent>) m.getParameterTypes()[0],m);
}
else
{
FMLLog.log(getModId(), Level.SEVERE,"The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName());
FMLLog.log(getModId(), Level.ERROR,"The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName());
}
}
else if (a.annotationType().equals(Mod.InstanceFactory.class))
@@ -340,11 +319,11 @@ public class FMLModContainer implements ModContainer
}
else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0))
{
FMLLog.log(getModId(), Level.SEVERE, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes()));
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes()));
}
else if (factoryMethod != null)
{
FMLLog.log(getModId(), Level.SEVERE, "The InstanceFactory annotation can only be used once, the application to %s(%s) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only be used once, the application to %s(%s) will be ignored", m.getName(), Arrays.asList(m.getParameterTypes()));
}
}
}
@@ -358,6 +337,7 @@ public class FMLModContainer implements ModContainer
parseSimpleFieldAnnotation(annotations, Instance.class.getName(), new Function<ModContainer, Object>()
{
@Override
public Object apply(ModContainer mc)
{
return mc.getMod();
@@ -365,6 +345,7 @@ public class FMLModContainer implements ModContainer
});
parseSimpleFieldAnnotation(annotations, Metadata.class.getName(), new Function<ModContainer, Object>()
{
@Override
public Object apply(ModContainer mc)
{
return mc.getMetadata();
@@ -408,7 +389,7 @@ public class FMLModContainer implements ModContainer
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(getModId(), Level.WARNING, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
FMLLog.log(getModId(), Level.WARN, e, "Attempting to load @%s in class %s for %s and failing", annotationName, targets.getClassName(), mc.getModId());
}
}
if (f != null)
@@ -419,7 +400,7 @@ public class FMLModContainer implements ModContainer
target = modInstance;
if (!modInstance.getClass().equals(clz))
{
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());
FMLLog.log(getModId(), Level.WARN, "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;
}
}
@@ -461,10 +442,10 @@ public class FMLModContainer implements ModContainer
{
if (!sourceFingerprints.contains(expectedFingerprint))
{
Level warnLevel = Level.SEVERE;
Level warnLevel = Level.ERROR;
if (source.isDirectory())
{
warnLevel = Level.FINER;
warnLevel = Level.TRACE;
}
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());
}
@@ -491,7 +472,16 @@ public class FMLModContainer implements ModContainer
customModProperties = EMPTY_PROPERTIES;
}
Boolean hasDisableableFlag = (Boolean) descriptor.get("canBeDeactivated");
boolean hasReverseDepends = !event.getReverseDependencies().get(getModId()).isEmpty();
if (hasDisableableFlag != null && hasDisableableFlag)
{
disableability = hasReverseDepends ? Disableable.DEPENDENCIES : Disableable.YES;
}
else
{
disableability = hasReverseDepends ? Disableable.DEPENDENCIES : Disableable.RESTART;
}
Method factoryMethod = gatherAnnotations(clazz);
modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader, factoryMethod);
NetworkRegistry.INSTANCE.register(this, clazz, (String)(descriptor.containsKey("acceptableRemoteVersions") ? descriptor.get("acceptableRemoteVersions") : null), event.getASMHarvestedData());
@@ -544,12 +534,6 @@ public class FMLModContainer implements ModContainer
return false;
}
@Override
public boolean isNetworkMod()
{
return isNetworkMod;
}
@Override
public String getDisplayVersion()
{
@@ -605,4 +589,22 @@ public class FMLModContainer implements ModContainer
descriptor.put("description", modMetadata.description);
return descriptor;
}
@Override
public Disableable canBeDisabled()
{
return disableability;
}
@Override
public String getGuiClassName()
{
return (String) descriptor.get("guiFactory");
}
@Override
public List<String> getOwnedPackages()
{
return candidate.getContainedPackages();
}
}
@@ -1,22 +0,0 @@
/*
* 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;
/**
* @author cpw
*
*/
public interface IConsoleHandler
{
public boolean handleCommand(String command, Object... data);
}
Loaded 100 of 234 files, more files were not shown because too many files have changed in this diff. Show more