Solved [1.11.2] Can't access NMS

Discussion in 'Spigot Plugin Development' started by WAS, Apr 19, 2017.

Thread Status:
Not open for further replies.
  1. WAS


    Can't seem to access NMS. net.minecraft.server cannot be resolved from Spigot jar? First attempt so may be doing it all wrong but from the two tutorials I read you just import. And yes this is a existing project with Spigot API (Shaded) having already been implemented.

    #1 WAS, Apr 19, 2017
    Last edited: Apr 20, 2017
  2. First off: You don't want to shade the spigot api into your project .... you just need that during your build.

    Additionally: If you want to work with NMS you need more than just the Spigot API. You need to build against spigot itself. Which build system are you using? Maven? Eclipse export?
  3. The entire point of NMS is that it's not in org.bukkit...
  4. Mas


    Do you even know what NMS is... It stands for net.minecraft.server and is the mojang code for interacting with a server and players at packet level.

    EDIT: Sniped
  5. WAS


    Say what? I am not shading anything. I am using the shaded jar for the API, clearly. I've been asked if I was using Server Jar before is why I mentioned.

    Pretty sure that's not NMS

    JAR is only 6 versions behind

    Code (Text):
    [00:43:03 INFO]: This server is running CraftBukkit version git-Spigot-d276ab1-d219213 (MC: 1.11.2) (Implementing API version 1.11.2-R0.1-SNAPSHOT)
    [00:43:03 INFO]: Checking version, please wait...
    [00:43:05 INFO]: You are 6 version(s) behind
  6. Have you added only the Spigot jar? I think you also need to add the Bukkit jar, as it does contain NMS I believe, just not under org.bukkit. Correct me if I'm wrong though.
    • Like Like x 1
  7. WAS


    Giving that a shot, thanks.
  8. I think you mean craftbukkit jar, that contains most of the version dependent data
    • Informative Informative x 1
  9. WAS


    Thank the lords! There it is! Thanks a bunch Z3tr0nix. I love how the "basic" and "ultimate" NMS tutorials all leave out that little bit of information. Forgot Spigot/Bukkit is more of a extension of a API.
    • Like Like x 1
  10. The API is a load of abstract classes / interfaces. The server jar are actual implementations of the API. That's why if your using maven you MUST use reflection or tamper with your local repository...
  11. WAS


    ? The server jar would be the application. Craftbukkit is the API to the application which allows manipulation. Least how I see it.

    Also. how does one refer to current build source files? do you have to decompile the minecraft_server.jar? Is there a website? I seem to only be able to find 1.8-- versions of BlockTNT.
  12. You can decompile the actual jar with MCP and the craftbukkit implementations with spigot's Stash. Remember, all of the minecraft server classes are put into net.minecraft.server.<version> in the actual spigot / bukkit jar. But the naming conventions with MCP are pretty straightforward. (Like player would be net.minecraft.server.entity.player.EntityPlayer)
  13. WAS


    What is MCP? Could you explain or point the methods used? I found Spigot MCP; "A mcp-mapped version of spigot applied on top of Minecraft Forge "
  14. MCP is Mod Coder Pack which nearly all version of forge/modded minecraft versions/hacked client/custom server API stuff is build is on.
  15. WAS


    I like how I have used "MCP" a few times. The abbreviation "MCP" has starred me in the face on that page, yet all I took away from it was Mod Coder Pack with no correlation. Lol

    I'll have to look into that. May not need it if I can just figure out what Explosion#c() exactly is. It's missing in the latest build. Update: Which appears it may be #getSource()

    This is my new primed tnt spawn event (so far, just to check names).
    Code (Java):
      public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
      if ( ! ( world.isClientSide ) ) {
      EntityTNTPrimed tnt = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.c());

      int ofuse = tnt.getFuseTicks();
      // TODO : Get Effect Info
    Code (Java):

    public EntityLiving c() {
    return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : null));

    Update: supervisor found me and threw me out for the night after a 15 hour shift lol ill try it all tomorrow but fairly confident im close
    #15 WAS, Apr 19, 2017
    Last edited: Apr 19, 2017
  16. If your just using eclipse, select your project and press ALT + Enter. Jo to Java Build Path and then Libraries. Press add external JAR and add your actual server jar. Then your set. But if you NMS, every new version will give you an error with doing like classdefnotfoundexception or somthing of that name
  17. WAS


    I already have NMS working. What is "actual server jar" though? And yeah Im aware of the version naming. Unfortunately its the only method i have found in almost 2 weeks without rebuilding all of redstone mechanics in a event listener which i dont see as very "lean"
  18. That's not at all true, you are supposed to make a POM project with one module per NMS version. You don't need to tamper with your local repository and you do not need reflection. And I don't see how you conclude this from the fact that the server jar contains implementations.
  19. MiniDigger


    nms names are not stable, they change frequently. its not a api, its the implementation. mojang changes it all the time. if you tamper with nms, you are expected to be able to update your code yourself, eg. browser minecrafts code (MCP mappings are extremely helpful, take a look at mcp mappings viewer) and figure out wtf mojang did now to break your code.
    thats why you are supposed to use the api wherever possible.
  20. WAS


    Why do people keep just going around in a circle? All pretty self explanatory from just one import lol, and explaines here already. And known before hand. All about why i couldnt import.
Thread Status:
Not open for further replies.