[SOLVED] How do you setup your mod/plugin environment?

I just add Sponge on my classpath and build the artifact out of it in Intellij since I tried countless of times trying to use gradle and maven, it always shows this error:

com.google.inject.internal.MessageProcessor visit
INFO: An exception was caught and reported. Message: java.lang.ClassCastException: net.minecraftforge.fml.common.MinecraftDummyContainer cannot be cast to org.spongepowered.api.plugin.PluginContainer
java.lang.ClassCastException: net.minecraftforge.fml.common.MinecraftDummyContainer cannot be cast to org.spongepowered.api.plugin.PluginContainer

So yeah, now I am wondering how you guys set your environment up for plugin development.

I got this exact problem, when following the tutorial posted. My solution is posted to the official doc. Rather than adding Sponge to Plugin classpath, add the Plugin to the Sponge classpath.

This comes with the added benefit of being able to test more than a single plugin at a time.

1 Like

I am really glad someone else had the same problem and figured out now and thanks a lot for that doc. I will be sure to have a nice read because the testing is pretty time-consuming the way I am doing right now.

1 Like

Actually, it was a suggestion by @Zidane. :smile: I was clueless when it happened, as to what I could have been doing wrong.

1 Like

I use Eclipse and just adding the latest Sponge build from here to the build path.
I never used gradle before and dont really want to mess around with that.

You should NEVER EVER build against the implementation.
Take a look at the docs on how to setup your favourite IDE correctly:
https://docs.spongepowered.org/en/plugin/basics/workspace/eclipse.html

There’s currently a discussion going on wether sponge will support building without gradle/buildtools or not.

However its working in my case beautifuly

Yes it works somehow. Its just like ugly code: it works but it isn’t the way it should be done :wink:

Mmm? What do you mean?

afaik you should add the sponge-api.jar as dependency to your plugin and not the sponge-coremod.jar.

Or did i miss something here?

We’re talking about debugging/hotswapping, not dependencies.

You can find the link to the guide:

Rather than adding Sponge to the classpath of your Plugin, I’m recommending you add your Plugin to the classpath of Sponge.

Woops, must have slipped my mind.
It’s late over here :wink:

1 Like

There isnt something like bad code. It needs only to work as it is meant to be.

You must not have ever looked at the Minecraft source.

3 Likes

Yeah its not really bad coded. The main problem is that it has no own engine instead they used java which stands not for stability

I don’t want to continue this line of conversation for too much longer; we’ll derail the conversation.

But I will say that the Java VM has nothing to do with how Minecraft behaves.

Correction: They use LWJGL.

Technically LWJGL is a library not an engine.

1 Like

The only reason I add Sponge on the buildpath and use it as a library on my plugin is because I cannot get the way it’s setup on the doc because it’s incomplete. It doesn’t show how to clone the gradle and other things.

@TheAwesomeGem Cloning and building are all shown on the Sponge README.md.