Get net.minecraft for server

I try use mixing in vanilla server and get problem to use net.minecraft classes. I need to use net.minecraft.entity.player.EntityPlayer but gradle doesn’t see it. Which dependency should I add to use nms objects

So this isnt a straight forward answer.

Sponge Vanilla uses Mojang mappings, while Forge itself uses MVC mappings. While this shouldnt matter after its compiled, it does lead to different imports and may cause issues if your attempting to use forge specific or forge mods.

Lets start with the easy one.

P.S both these options officially require Java 8 - although i got the official way working on java 17 once a gradle build was ran once

Official way

This will give you the mojang mappings.

Open your file and add the plugin of

id("org.spongepowered.gradle.vanilla") version 0.2

Then provide the following properties

minecraft {
  runs {

And thats it, build it

Unofficial way

This is the MVC mapping way which means you wont be able to talk to spongeCommon code, but will be able to talk to forge and other mods that are mapped with mvc.

  • load the default for a forge mod
  • add the sponge api as a dependency

This will boot it as a forge mod, but will have access to sponge api. If you want it to also run on sponge vanilla and it gets treated as a plugin, then do the following extra

  • remove the forge mod loading file (cant remember what that file is) within the gradle build script
  • add the sponge_plugins.json using gradle