Moddius - A simple Modloader compatible with ANY Java game! (20+ Downloads!)

(I dont know if this is the correct forum section, so “bear” with me :persecutioncomplex: )
Now, let me introduce you to Moddius!
This a Reflection based, complexly made, simple to use ModLoader that is
compatible with almost any Java game!

Installation:
To install this modloader onto a game, you must open its main jar file and insert the files contained in the modloaders jar.

How to use this in your game:
WARNING: This tutorial uses ECLIPSE!
You must first associate your game with the library so right click on your project
then select “Java Build Path”, then you select the Libraries tab then click on
Add External JARs and select the library jar.
When you selected the jar click OK and you have associated the jar with this library!
Next import all Moddius classes using this import: “import org.moddius.*;”
Once imported create an annotation that the ModLoader will use to find mods.
The annotation can have any attributes you want the mod to specify.
[b][i]Warning: The annotation must be annotated with


@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)

or else the ModLoader will NOT find any mods and a bunch of exceptions will occur.[/i][/b]
Next use the following code to load mods:


ModLoader loader = new ModLoader(MyAnnotation.class);
Set<Class<?>> mods = loader.loadMods();

Replace MyAnnotation with your annotation!
Then modify your game to the way you want the mods to work and
YOU ARE COMPLETE!

How it finds mods:
The technique that this library uses is scanning ALL packages that is known to its classpath and search for any classes that use your annotation!

Upcoming features:

  • Searching by Superclass (v3)

Download:
Direct - V1: https://www.mediafire.com/?szoy6w6d2x43dqm
Support - V1: —
Direct - V2: http://www.mediafire.com/download/yg1kif42yd7uf8m/ModdiusModLoaderV2.jar
Support - V2: —

Umm… i got notin’ else to say…
Oh look a butterfly :point:! (Escapes)

I will take a look into it later, providing you with some more feedback than.

Are you aware of: https://code.google.com/p/reflections/ and
(a bit simpler) http://bill.burkecentral.com/2008/01/14/scanning-java-annotations-at-runtime/?

-ClaasJG
Gimme time,.

The topic says that this library is Reflection-based… :cranky:
Which means this library uses Reflections (the library).
But its bundled onto 1 jar, so you have the reflections library if you load this lib in.

Oh, as I said, in the moment I am not able to look into it, but I thought you ment the http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/package-summary.html package, not the https://code.google.com/p/reflections/ lib. I will edit this post in the evening with some feedback, so i dont have to double post all the time.

[EDIT]
Well, this would be my feedback too I guess.

ClaasJG

What I am missing is some hint how to use your library to make your game moddable. It looks like it’s just a wrapper for getting annotated classes. What does it provide on top of Reflections?

I would at least expect an api to manage mods inside a folder and to load, enable or disable them dynamically. Maybe also some Resource abstraction to help exchanging textures and sounds in a running game. Sources, javadocs and examples would be nice, too.

You did a fat jar with all dependencies. This might introduce conflicts with other versions of the included dependencies used by a game. Also I don’t know, if the license of Refllections (or some of the dependencies) allows rebundling like this…

All in all a good idea, but not ready for prime time. Keep it up nonetheless!

I am giving all credit to the Reflections library and all of its dependencies which includes:

  • Guava
  • Javassist
  • Log4J
  • SLF4J

None of the credit goes to me.
And your right, i like making libs that shorten code for people.
But you did give me an idea of making an external mod system and adding it here.
Thank you ;D

V2 Released.

  • External Mod Loading
  • JavaDoc
  • The method names have changed (lm_i is internal loading, lm_e is external loading)

Usage of lm_e:
The external loading method has 1 parameter, and thats the folder to scan.
This method does NOT use the reflections library but normal java reflection.

Warning: I do NOT know if lm_e works so please test if it works.

Download in main thread.

Also i forgot to say you must modify your game so that mods that modify it, for an example if you have an NPC with health, and its a private field, make it public and mods will be able to change it.
The way you load the mods is getting the classes, and have the classes have methods or runnables in your annotation that you will run from the main game.

Interesting idea. However, I have a hard time understanding how this will be useful. What does it do?

I mean, it’s not terribly hard to add a jar to a classpath:

java -cp game.jar;mods.jar ...

How does your mod loader help with this?

It only shortens about a 100 lines of code which includes loading the mods.
I will say it again and the last time:
The library loads modifications that people created externally and internally, but you must modify your game to build an API that the mods will use.

Nasty ad.fly links removed. :cranky:

Don’t try to squeeze a few bucks out of the exposure JGO provides you with, giving your potential users a horrible experience when clicking the link.

Meanwhile, it wouldn’t hurt to make an example game+mod, and opensource it, so people get an idea of what you’re actually sharing with the world. Right now it feels like somebody is plugging the [icode]misc.Thing[/icode] interface, pointing out how it makes life easy, integrates into everything, and scales from embedded systems to server clusters… leaving your target audience scratching their heads and moving on.

scratches head

maybe i’m missing the point but we have …

http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileVisitor.html

and reflections already. just stick these together and you have a plugin system. :clue:

Im telling you this USES THE REFLECTIONS LIBRARY ALREADY!
THIS ONLY SHORTENS CODE

That explains everything, thanks!

Does this library use the Reflections Library?
If it doesnt, it would be a great alternative to Java’s native reflection API.
Here is a link :
code.google.com/p/reflections

Did you not read my last post?

@lvivtotoro: I think most people on this thread sincerely try to understand what you are trying to do here, but fail to do so. Yelling at them will not improve their understanding.

Maybe you could post the source code to your library? That might help.

it’s clear now tho’. … i guess.

it uses https://code.google.com/p/reflections/ … not “just” the java reflections. ja ?

@lvivtotoro, you’re saying it uses reflections already while i’m wondering why it’s not just java.lang.reflect.

Ok ill post it, i need to get it first.

Oops, I must not have.
I just kinda filter out messages that are all capital letters.

I’m a little confused as to what the Library does, I understand generally that it SHORTENS CODE, but a demonstration of the library would really help me understand the code-shortening capabilities of Moddius.