Looking for an updated NMS tutorial

Discussion in 'Spigot Plugin Development' started by Jaume, Jan 12, 2018.

  1. Hello! I'd like to learn how to create custom NMS entities, but all the tutorials seem to be outdated (1.8, 1.9, etc). Could someone point me to the right direction? Thanks!
  2. ScarabCoder

    ScarabCoder Retired Resource Staff

    The existing ones, though outdated, should still work if you just modify a few of the names used. It won't work if all you're doing is copy and pasting.
    • Agree Agree x 2
  3. right.png
    ok so basically if you need a tutorial to learn nms you shouldnt be doing nms, then you should stay in bukkit, and when u can experiment you should go into nms, because nms stuff changes pretty much every version, so tutorials become obsolete very fast...
    • Funny Funny x 1
    • Winner Winner x 1
  4. ScarabCoder

    ScarabCoder Retired Resource Staff

    He's talking about custom entities. While you -could- use Bukkit's API to do that, it would be very difficult and a lot more messy. For custom entities and anything else that involves changing Minecraft mechanics, definitely use NMS. While it's true it will break every Minecraft update, it's still a lot better than modifying the server jar file.
  5. i meant before diving into nms you should do tasks which dont involve breaking the game in half by tutorials...... and you should learn a bit about java and learning without tutorials basically google and testing
    • Winner Winner x 1
  6. I've already learned how to use Bukkit. I'm making a plugin and I need to be able to spawn zombies that basically move on a straight line. I obviously don't want to copy/paste code, but the majority of the NMS code seems to be obfuscated and I cannot find the appropriate documentation; the old tutorials include objects even the constructor of which has changed, so I don't know where to start.

    Without NMS, I've tried to set the zombies velocity to the desired one every 4 ticks or so, but I cannot move them if their AI is set to false (if set to true, they don't move in a straight line). I could certainly do some math and keep them on a straight line by making them move right if they're too far left and vice versa, but that would be messy. It just looks way simpler to make them move by changing their goals.

    Thanks for taking the time to answer!

    EDIT: Just to clarify, I already know java and I'm not looking for a tutorial that teaches me how to make a zombie walk in a straight line; rather one that helps me understand the basics of NMS so I can apply the gained knowledge into developing my own plugins.
    #6 Jaume, Jan 12, 2018
    Last edited: Jan 12, 2018
    • Like Like x 1
  7. ScarabCoder

    ScarabCoder Retired Resource Staff

    Pretty much no matter what you’re doings, you need a starting point - that’s what he was asking for, not a tutorial to copy and paste to make a whole entity. All I needed when I started was how to register the custom entity class and an example of overwriting default functions, after that I was able to figure out everything I needed to know.
  8. If you want I can help you: search on YouTube the source code and there will be a tutorial in the Playlist Advanced Bukkit Coding which name is Custom Entity Witham PathGoalFinder: again as the others said I do not raccomand you to do this thing because he follows a quite difficult method and you should first learn Java and again DO Not copy and paste(in the description you can find his code on github) You may need to change 1 or 2 imports. He does not covers all the aspects of a custom entity so you may need to think a lot using some logic for armors and other stuff.
  9. Optic_Fusion1

    Resource Staff

    NMS code will probably NEVER have ANY documentation, unless you make your own...and that documentation will probably become useless the next MC version anyways
    • Agree Agree x 1
  10. Choco


    The only way you're going to be able to use NMS is by toying around with it. There is a utility class that makes things slightly easier for you, but there's a chance that it may become outdated in Minecraft 1.13 due to massive internal refactoring, thus resulting in many obfuscation changes. That being said, it's available for use if you'd like, but I highly recommend just delving in and playing around with methods. Decompile the server jar and look at the entity you want to override (in this case, EntityZombie). You'll also have to open other classes it extends (i.e. EntityLiving, Entity, etc.). Look at its methods and try to reverse engineer it in order to figure out what each one does. If you don't like that behaviour, override it.

    Beyond playing around with NMS and seeing what it does, the only way you're going to get experience with it is just using it and finding out what it does for yourself. Minecraft's obfuscation changes on a per-version basis which is the reason for the Bukkit API in the first place. It abstractifies NMS methods and fields so you can interact with them without having to worry about your code breaking between versions. When you're dealing directly with the server, you can't have that level of certainty and your code will change and break between versions.
    • Winner Winner x 3
    • Informative Informative x 1
  11. That's exactly what I'm asking for!

    Thanks, I'll definitely play around with NMS and see if I can gain a better understanding of it all. I don't think I want to rely on a utiliy class that may easily become outdated, though. I'll just stay with vanilla NMS!
    • Like Like x 1
  12. Choco


    The link I provided does give a bit of an explanation as to how to create custom entities. Just very basic, but it's something to start with. I recommend looking at how that utility class works and adapting it to your own.