Interfacing With Forge Mods

One thing that I would REALLY want to see implemented is an API that allows you to interface with other mods. What I mean is, have a plugin with mod dependencies, and be able to do, like with interfacing with other plugins,

Mod mod = Game.getPluginManager().getMod() and be able to customize the modded entities, blocks, etc by having the mod in its build path.


This will make it easier for plugins that have been ported into Forge mods, such as WorldEdit, so WorldEdit will not have to be entirely rewritten to support Sponge, and plugins will be able to access WorldEdit’s Mod API if Sponge had a Forge Mod API.

That sounds like a good idea, it would have to be something that would be built at the sponge level though. The heirarchy is:

  1. MC Server
  2. Forge
  3. Sponge
  4. Plugin

Sponge could provide some sort of API to bridge the plugin and forge levels so the plugin could access the Forge libraries and methods to interact with other mods.

EDIT: This would also be a way for plugins to access nms classes through forge libraries.

I agree @RobodudeMC
Maybe like some of NMS or ForgeFactory?

Can’t you just add dependency mod to your IDE’s classpath and then set it requirement for your plugin? Then you can use mods functions as you would use them from other mod.

It would probably be like ForgeFactory, from my perspective (I have worked more with Bukkit than Forge) ForgeFactory worked better at “upper-level” accessibility than NMS did.

Hmm, that could be a problem because the API doesn’t rely on Forge (You could write your own server from scratch that implements the Sponge API, but has nothing to do with Forge).

So it has to be flexible. Maybe like this:

  • The official Sponge Mod is a Forge mod implementing the Sponge API. Sponge Mod contains a built-in plugin called “ForgeConnector” that links to Forge. So other plugins can just get this plugin from the PluginManager.

  • SpongeGlowstone could be a standalone server implementing the Sponge API. SpongeGlowstone does not contain the built-in plugin called “ForgeConnector”.

I would prefer this:

If you want to use the Forge API, make a Forge mod. You can still use Sponge methods if it is installed, because it is just another mod on the same application layer.

If you just want to make a protection plugin (protect blocks added by mods), you can do it with Sponge:

... if(block.getId() == "yourmod:oil") event.setCancelled(); ...