Weird Plugin Error

So I’m trying to make my first Sponge plugin, I have a decent amount of experience with bukkit plugins. I use the following code in the main class of my plugin:

import org.spongepowered.api.Game;
import org.spongepowered.api.event.Subscribe;
import org.spongepowered.api.event.state.ServerStartingEvent;
import org.spongepowered.api.plugin.Plugin;
import com.google.inject.Inject;
import org.slf4j.Logger;

@Plugin(id = "SpongePlugin", name = "SpongePlugin", version = "1.0", dependencies = "")
public class Main {
	
	@Inject
	Game game;

       @Inject
	Logger logger;
	
	@Subscribe
	public void onServerStarting(ServerStartingEvent event) {
		logger.info("WOOOO");
	}
}

As you can tell, I would be really excited if I could get it to work. However, when I try to run it in my test server with Sponge, I get the error “FML has found a non-mod file SpongePlugin.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.” Any thoughts on what I’m doing wrong? Thank you so much! (Please don’t be too harsh)…

You don’t want FML to load your plugin. Only Sponge should be doing that. It’s not an error at all. :smile:

Oh okay, thank makes sense! How should I fix this?

Hang on a sec, I’m stupid and not running the server right I don’t think…

Did you put the sponge.jar into the mods folder?

I wasn’t before, but now that I do I’m getting the following error when running the server:

Instancing error handler class org.spongepowered.mod.mixin.handler.MixinErrorHandler
[17:53:02] [main/INFO] [Sponge]: //
[17:53:02] [main/INFO] [Sponge]: /* /
[17:53:02] [main/INFO] [Sponge]: /
Oh dear. Something went wrong and the server had to shut down! /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
------------------------------------------------------------------------------------------------------/
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
A critical error was encountered while blending Sponge with Forge! /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
Possible causes are: /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
* An incompatible Forge “core mod” is present. Try removing other mods to see if the problem /
[17:53:02] [main/INFO] [Sponge]: /
goes away. /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
* You are using the wrong version of Minecraft Forge. You must use the correct version of Forge /
[17:53:02] [main/INFO] [Sponge]: /
when running Sponge, this is usually specified in the sponge mod’s jar filename. /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
* An error exists in Sponge itself. Ensure you are running the latest version of Sponge. /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
* Gremlins are invading your computer. Did you feed a Mogwai after midnight? /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
------------------------------------------------------------------------------------------------------/
[17:53:02] [main/INFO] [Sponge]: /
Technical details: /
[17:53:02] [main/INFO] [Sponge]: /
/
[17:53:02] [main/INFO] [Sponge]: /
Failed on class : net.minecraft.tileentity.TileEntity /
[17:53:02] [main/INFO] [Sponge]: /
During phase : DEFAULT /
[17:53:02] [main/INFO] [Sponge]: /
Mixin : block.data.MixinTileEntity /
[17:53:02] [main/INFO] [Sponge]: /
Config : mixins.forge.core.json /
[17:53:02] [main/INFO] [Sponge]: /
Error Type : org.spongepowered.asm.mixin.transformer.InvalidMixinException /
[17:53:02] [main/INFO] [Sponge]: /
Message : Shadow method getTileData was not located in the target class /
[17:53:02] [main/INFO] [Sponge]: /
*/
[17:53:02] [main/INFO] [Sponge]: /
/

1 Like

Could somebody direct me to the sponge jar I should be using? Apparently I found an invalid one?

I have the same error whilst following this tutorial series.

Click me

@soccer66 @TheAwesomeGem It’s not the Sponge jar that’s the issue. Each Sponge build is not necessarily compatible with each Forge version. I believe there is a PR, that may or may not have been pulled already, which adds a functionality where running the Sponge jar directly will pull up a GUI which explains, among other things, which Forge version that particular jar requires.

Oh, that makes sense. In the mean time do you know of any combination of forge and sponge versions that do work for testing our plugins? Links maybe?

I basically pulled the files given from the repo and followed that tutorial. Shouldn’t I have the same Forge version as the one declared on the dependency of the Sponge? Sorry, I am pretty confused.

To be fair, whichever dependency that that Sponge version is using should be compatible. All I can really say is the standard “Sponge isn’t a finished product. Expect errors”.

@TheAwesomeGem I meant for that message to be @FerusGrim. And @FerusGrim do you have any combinations currently working?

Take a look at the most recent build:
1.8-1371-2.1DEV-437
The 1371 indicates which Forge build you should be using.

On the Sponge Maven, the builds are named according to
{MCVersion}-{ForgeVersion}-{SpongeAPIVersion}-{SpongeVersion}

So the most recent one, labeled “1.8-1371-2.1DEV-437” uses Forge version 1371 to run Sponge version 437. If you match up the numbers, you should be fine.

@FerusGrim Son of a ninja… :stuck_out_tongue:

3 Likes

You explained it much better, though. :smile:

Though, to be a bit more accurate, it’s:
{MCVersion}-{ForgeBuild}-{APIVersion}{SpongeBuild}
Notice the lack of ‘-’ between APIVersion and SpongeBuild. The build is actually: DEV-437, whereas the APIVersion is 2.1.

Hmm, guess that tripped me up, although it would look cleaner my way. Thanks for pointing it out!

Woooo! It worked! :smile: Thanks for the help guys!