NMS development help

Discussion in 'Spigot Plugin Development' started by JJCDeveloper, May 3, 2017.

  1. Yo guys,i am a bukkit/spigot plugin developer.
    Is there a way to learn nms or like see the source code and know everything without watching the code?
    I tried to look through the code in nms in 1.11.2 through eclipse,
    But it said that there isnt a source attached to it and some errors popped up.
    Can i learn nms in some way without looking for other developers' examples/tutorials?
    Please guide me to the correct way of learning nms.
    Thankyou so much.
  2. gzx


    The source code is at https://github.com/Bukkit/mc-dev/tree/master/net/minecraft/server. This is for 1.7.10, though, so if you want 1.11.2 you'll have to use BuildTools and find the spigot folder, which contains the source.

    It's slightly hard to read because of the obfuscation but you should be able to figure it out. Use the search tool to help you out; the 1000+ classes are all in one package.
  3. How to build it out
  4. There's no such thing as "learning NMS". NMS stands for net.minecraft.server which is the package containing Mojang's Minecraft server code.

    To use it, you must add craftbukkit as a dependency to your project. Then from there you can use it like any other Java "library" (its not really a library though and therefore you're going to have to use a ton of reflection to do a lot of things).

    To understand it, you're going to want to create a new project in your IDE and add the files from BuildToolsDir/work/decompile/net/minecraft/server to the newly created project. Then you can view the code
  5. gzx


    The same way you did for the Spigot API. There is a guide at https://www.spigotmc.org/wiki/buildtools/ in case you don't know how to run it.

    Find the CraftBukkit directory in the same place you put BuildTools and go to src/main/java/net/minecraft/server and you will find all the source files for NMS.
    • Agree Agree x 1
  6. Thx for you guys' help i am ide noob
  7. NMS decompiled classes are all in the BuildTools directory, the originals under /work and the patched ones used in spigot in the /spigot folder
  8. I would recommend using MCP to deobfuscate whatever it can of the server jar and compare it to the spigot jar for nms. This will help understand some stuff in it, by at least giving readable names so you can understand what's going on a little better, and it will look the same in the spigot jar except the names will be random.