NMS How to find the hidden NMS names by yourself! Decompiler/MCDEV

Discussion in 'Resources' started by ChipDev, Jan 18, 2015.

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


    Hey guys!
    I made this tutorial because the last hour, I've been overriding EntityIronGolems' aD() method. And since (Making this in 1.7.9) aD() in 1.7.9 is a boolean method, we must find a way to give the Golems' attributes!
    1) Check out @Jacek and @TeeePeee 's tutorials on Custom entities.

    1) Get Any java decompiler of your choice!. My recommendation is JD-GUI!
    2) You must have a craftbukkit jar! (NMS)

    MC-DEV STRATEGY (open)

    1) Get to this github repo.
    2) Find the custom entity/ class of your choice.
    3) If you aren't using 1.7.10, use 'History' or commits of the class!

    • What is NMS?
    A: Nms stands for net.minecraft.server which you have all the awesome stuff that the regular Bukkit.jar doesn't implement! *Even though it has a terrible rep. you can do so much more stuff with it. Except without the use of fields and reflection, you have to make a new version EVERY SINGLE UPDATE or else the plugin will throw errors 'not able to find R4_World' etc. because if it were to have a 1.8 / 1.7.9 "faucet" hack, and you r server was running 1.7.9--, You have to have R3_World in your plugin!
    Lets get started!
    Ok, I have
    Saying the return type of aD() is not a void, and a boolean, and it must return a boolean!
    (In 1.8, aD() is where you put all your attributes!)
    So, Lets go check the source out :cool:

    1) Open JD-GUI
    2) Drag craftbukkit.jar into the white space
    3) OPTIONAL AND RECCOMENDED: Make the screen bigger
    4) Go into net.minecraft
    5) Click the server package
    6) Find the Entity*YourChoice*.class class.
    •It is in alphabetical order!
    7) Click on it!
    Now that you have your entities source, we will look through it!
    *Close to the top.. we can see it! It has attribute modifiers, so lets check it out!

    Non-Decompiler Mc-dev way! (open)

    1) Do you see something like aC() ? If you don't see aD(), and you want to set attributes with aC(), you should change over to aC()!

    I guess that means that our aD() should mean aC()!
    Lets try it!

    Thats it guys, and one last thing, I bet some will ask 'Why not use Mc-dev'?
    Because, mc-dev is fitted to 1 version and maybe not yours! Thats why! :p
    Thanks for reading, Cya! *Hope the length didn't scare you off!
    Last edited: Jan 19, 2015
    MrAwellstein and GrandmaJam like this.
  2. Offline


    mc-dev or MCP used for this under normal condition.
    Also notepad++ or similar application required for filesystem wide search.
  3. Offline


    I don't have notepad++, what do you mean?
  4. Offline


    i mean "your suggestion is very ineffective" or "your suggestion inferior compared to other options"
  5. Offline


    I am very confused on what this is.... It looks like a tutorial on how to use jd-gui.
    teej107 likes this.
  6. I personally recommend Luyten. From what I've seen, it's better at decompiling than JD-GUI (as in, misses less stuff, less errors, etc.), it's written in a multi-OS language (Java - convenient, eh?) so no need to worry about finding the right version, and (in my opinion) it looks a lot nicer :)

    Don't forget that there are reason for that, and it's very important to know why and what you need to do about it.

    So change the version of it? Look at the commits, and look over the code from the protocol version you're working with. For example, here is the repository as it was on version 1.7.5.

    You see, this is the main problem with some who use NMS. You've found that it's fiddling with attributes, as the method you were looking for was, so you're assuming that it's the right one to use. But is it? Have you looked over the whole thing (including inherited members) and worked out what it's doing, and that the method you've found not only accomplishes what you're looking to do, but also doesn't interfere with anything else and wasn't expecting you to do anything that the other version didn't want you to do? Maybe you're right in this case, and maybe your not. Either way, this isn't a tutorial on how to update aD() to aC() (which would be a rather useless tutorial), so you need to make people aware of the whole procedure. Don't make assumptions where NMS is concerned, it's not an API and thus doesn't have a 'contract' with you - it's liable to change in any way it feels like and there's nothing you can do about that. You're much safer assuming that absolutely everything has changed and you have to relearn what you intend to use every single update.
    Last edited: Jan 19, 2015
    MisterErwin likes this.
  7. Offline


    *Looking at the commits is smart ;) I should add that to OP.
    •Yes, I do know what all the attributes mean, You can find them out here for 1.7.10. Or, Look at the commits to find the 1.7.2 version. As you can see, in 1.7.2 maxHealth was names 'GenericAttributes.a' and not 'GenericAttributes.maxHealth'
    Third: Yes, I am guilty! jd-Gui was the only decompiler I ever used, and, I bet it is a lot simpler to go into mc-dev's history. Edited OP.
    Yes, This was a tutorial on JD-GUI partly!
  8. Great! However, as I said, this isn't a tutorial on how to update aD() to aC() - you need to make it clear that they have to do the things I said to ensure they're using the right method - using your tutorial, they may be under the impression that the right method is simply one that 'looks' similar to what they expect, when this is clearly not right. :)

    You should try out more, like Luyten ;) I also don't think that this section would really warrant a tutorial on JD-GUI anyway.
    xTrollxDudex and ChipDev like this.
  9. Offline


    Seriously, just use the IntelliJ 14 decompiler ._.
    Funergy, Avygeil and teej107 like this.
Thread Status:
Not open for further replies.

Share This Page