Missing type EntityLivingBase

Hello,

I am trying to create a plugin using sponge and the pixelmon api but I got an error:

I am trying to get the position of an npc so I can register it using the event BattleStartedEvent from pixelmon api. I came up with the idea of getting the participent entity and then try to figure out how to get the position of this entity.

But I got the proble when I wrote this simple code:

	for (BattleParticipant p : bc.participants)
	{
		p.getEntity();
	}

getEntity(); is underlined by red and when I hover it with my mouse it says:
The method getEntity() from the type BattleParticipant refers to the missing type EntityLivingBase

According to the forge api it says that the import for doing this is: net.minecraft.entity.EntityLivingBase

But when I write: import net.minecraft.entity.EntityLivingBase it says:
“The import net.minecraft.entity.EntityLivingBase cannot be resolved”

I know I have done something wrong with my project configuration but I don’t really know how to configure graddle and make it work with a mod api.

So I have done a little bit of prophanations which are:
I added spongeforge as an external jar and also pixelmonmod and the forge I use to run my server as an external jar.

This profanation worked fine to fire some events but when it comes to get some stuff from the “net.minecraft” it is not working :frowning:

I hope some people could help me with my problem or explain how to setup correctly this types of project or maybe find a solution to get the coordinates of an npc from pixelmon when this event is fired (or another thing which can differenciate this npc from the others).

Thanks for reading my post I hope some people can help me :slight_smile:

Simply adding SpongeForge to your workspace doesn’t let you work with net.minecraft code. You’ll need to set up your plugin as a Forge workspace in order to use that. Take a look at Implementation-dependent Plugins — Sponge 7.2.0 documentation.

Ok thanks for you’re answer ^^

I have checked it out and it is graddle again :frowning:

I am so scared of it, is there a way to make it work by importing MCP as a .jax (adding as external library) ?

No.

  • The Minecraft JAR can’t legally be downloaded from any place except Mojang’s website. Gradle gives you a modified version of Minecraft that’s suitable for development, and that version can’t be published.
  • Working with the Minecraft code also changes the publishing process. When you’re ready to publish your plugin, you need to use Gradle to build it so that it will work with the real Minecraft JAR.