Jump to content

Recommended Posts

Posted

Say I am creating a mod that has a lot of content, and I want to separate the mod into different "modules" to allow for complexity to be added if you wanted, but allow the other mods to function correctly without one of the "modules"

 

For example:

  • Core - Base Mod
  • Power - Having the machinery run off of power
  • World-Gen - Having different blocks generate into the world

 

How would I go about connecting and detecting these mods or "modules" together? How would I make the "modules" to function differently depending on what "modules" are currently installed?

Posted

The first thing is to decide why you want to split it up. Is because some people only want part of the mod's functionality? If so, actually the easiest way is to have one mod with good configuration settings. You can let people select which parts they want and it doesn't add that much complication to your coding (usually).

 

If you do want to split it up, the next question is whether some of it can simply be a fully separate mod. Like have GammaS' Cool Mobs Mod and GammaS' Extra Potions Mod and so forth.

 

Now if you want big parts to be both optional but also when enabled you want them closely working together then you have to think more carefully. For example, is the "core mod" always required in which case it will be a dependency for the other mods (you can google how to work with mod dependencies). Furthermore to make a really good dependency you might want to formalize the API part of the core mod meaning coding some proper encapsulation (look it up) and maybe using things like the @API annotation.  

 

And maybe you want each of the add-ons to also work together -- like if you have one that adds entities and another that adds potions maybe you want to change the drops of the entities to include the new potions. In that case you might need to have APIs between them but since you won't be guaranteed they're there you might need to look into things like the @Optional annotation.

 

To be honest it can be hard to break up a mod that wasn't originally programmed with breaking it up in mind. It is much easier to organize if you start out that way -- making effective APIs and building on top of those.  Look at how other mods that are broken up do it -- many of them have open source code on github you can inspect.

 

If you already have a large complicated mod that you want users to be able to control which parts they use, I suggest it is probably easiest to add the configuration options I suggested at the beginning.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.