MatterOverdrive icon indicating copy to clipboard operation
MatterOverdrive copied to clipboard

User friendly java version error

Open chylex opened this issue 10 years ago • 4 comments

Hey, so since you are one of the first mods to use Java 8, I saw a whole bunch of people reporting the usual unsupported class version error, which tells them nothing.

Now, I'm not 100% sure this will work, but it's worth a test anyways because I'm moving one of my mods to Java 8. I made a Java Checker coremod that prints a user friendly message as you can see on the screenshot. There are multiple versions for each new Java and Minecraft version.

The source is open and it's in public domain, so you can either ship Matter Overdrive in an archive with the coremod, or since CF requires jar files, you might be able to include it in the mod itself - I'm pretty sure you can put coremods and mods together. There might be an issue if someone installs the standalone mod manually, FML might freak out seeing two same coremods, so that should probably be checked too.

If you decide to try it, please let me know of the results. If it for some reason doesn't work, I'd gladly look into the issue since I will be facing the same one in a couple months.

chylex avatar Aug 12 '15 23:08 chylex

There shouldn't be a problem unless there are multiple instances of the same class with the same path. If we were to include your Java Checker in MO we would probably shade it into a package like matteroverdrive.repack.chylex.javacheck, so there shouldn't be a problem.

shadowfacts avatar Aug 12 '15 23:08 shadowfacts

Oh, I heard of shading but never thought to dig deeper into it, that resource could be quite useful, thanks. So yes, shading is definitely needed there. Calling the checker multiple times won't have any noticeable impact, just so you know for sure.

The other problem I was thinking of is if MO is a coremod itself, the reason I made it a coremod was to make it run before any other classes get loaded, because those would crash the game before the checker could display the message. But I couldn't find anything on first glance, so hopefully you're fine.

chylex avatar Aug 12 '15 23:08 chylex

There shouldn't be a problem.

shadowfacts avatar Aug 12 '15 23:08 shadowfacts

Okay, I did find a potential problem because the coremod returns class name as string, so the shading doesn't update them properly. It also then ignores the actual mod... I'll try to find a workaround and post an update if I find something.

EDIT: Okay, this is how to do the shading properly:

Put this into the libs folder: https://www.dropbox.com/s/gmd4xgr1iygpjxo/Java8Checker%20%20MC-1.7.10%20%20v1.1-shade.jar?dl=1

Copy all shading related stuff from my build.gradle: https://github.com/chylex/Hardcore-Ender-Expansion/blob/master/build.gradle (lines 1-4, 26-28, 39, 57-69, 65-66) and change 'chylex.shade' to something else to avoid collisions.

I haven't tested it on older java (because I don't have it), but it loaded the mod fine and acknowledged the coremod in it exists, so it should be fine; I'll put up an official guide on Java Checker's github page

chylex avatar Oct 07 '15 21:10 chylex