How To Use NMS with Spigot [Minecraft]
One of the most reliable and stable Minecraft servers available today is Spigot. Compatible with NMS, Spigot enables players to both create servers without a struggle and to modify the contents.
If you want to know how to use NMS in Spigot, you’re in the right place. In this article, you’ll learn all the NMS basics. Plus, we’ll also answer some of your burning questions on the topic.
Spigot: How to Use NMS
Before we get into the action, you may need a crash course on NMS.
What Does NMS Stand For?
NMS stands for “Net.Minecraft.Server”, a package containing the core Minecraft server code. You can consider it the DNA for Spigot and many other Minecraft servers like Bukkit and CraftBukkit. NMS allows the server to exist, and without it, you wouldn’t be able to create a server full of beautiful structures and objects.
Why Use NMS?
NMS, a highly optimized and powerful tool, is much faster than Bukkit or Spigot. Importing NMS into one of these servers will allow you to do more than before, and previous capabilities may be boosted due to the optimization.
Admittedly, NMS isn’t very easy to get into, as it requires some knowledge of coding. There are pages containing useful information to help you modify your server, however. These will make your foray into NMS much easier.
With NMS, you can save your code directly to sources without the need for schedulers.
Some of the things you can do with NMS are:
- Send packets to the server
- Modify the behavior of specific entities as you wish
- Navigating your server world
- Finding villages and other structures in your world
- Controlling the biomes
There are many other functions as well, but we won’t go into them too deeply here.
How to Use NMS
One of the best ways to use NMS is to create custom entity classes. Among many things, you can make custom mobs, such as Villagers that can’t die or Zombies that can’t move. These don’t have to replace the default mobs as long as you use the correct code.
With the right code, you can create a Villager that can’t move or be attacked. Of course, this is only an example of what you can do with custom entities. It works for many other mobs as long as you use the proper names and code.
With the help of modified entities, these special mobs and NPCs can exist alongside unaltered entities. You can have a static Zombie in the middle of your Village just for fun. Regular Zombies can still spawn in the overworld, provided you don’t replace the code.
GameProfiles are a set of values that determine players’ UUID, skins, login date, and their gamer-tag. You can modify a player’s skin by changing their GameProfile as well.
Modifying skins can be done after you retrieve a GameProfile and enter some code. Without the code, you won’t be able to modify it at all.
The name might not be very obvious, but DataWatchers are the code that records the states of entities. Each state has its own unique value, and any entity’s DataWatcher value will change if it gets inflicted by a status effect. If a Ghast gets set on fire or hit by a potion, for example, its DataWatcher values will change.
With this knowledge and the tools, you can change any entity’s state. You can combine it with creating custom entities and giving them states. There’s scope for flying Creepers and invisible Skeletons.
There are many possibilities out there waiting for you to play with. Here’s a page with all the values stored for every entity.
Should You Use NMS?
Generally, you wouldn’t use NMS to work on your server. NMS isn’t cross-version compatible, translating to you coding all over again just because your version of Minecraft is newer. Spigot, Bukkit, and CraftBukkit all make it much easier to work on your server, and you don’t even have to worry about compatibility.
While there are methods to counter this problem, such as Reflection and using NMS on an interface, compared to the three servers’ APIs, this is considered convoluted and unnecessary.
NMS should only be reserved for those who have above-average knowledge of coding with Bukkit or Spigot. If you’re a beginner, you should stick to the simpler software available.
NMS most certainly allows for optimization and speed, as well as greater freedom for experimentation. That’s why experts today are still familiar with NMS when they work on their servers. Sometimes, doing everything manually is the only way to go.
Is using NMS dangerous?
It can be dangerous in the wrong hands. As NMS has many more capabilities and works directly with the source code, an incorrect code can spell the end of your server or player data. You need to be very careful when using NMS to customize your server.
Since it’s non-cross-version compatible, it’s also not worthwhile, as you waste time coding everything from scratch. Workarounds exist, but they still take more time than other methods.
I Made an Immortal Creeper on Our Server
As information about NMS isn’t easy to find and only experts should use NMS, we recommend you study more before venturing into the software. Even so, anyone with some expertise can create some fun mobs in their Minecraft servers. Knowing how to use it can open up some possibilities other APIs don’t have.
Do you have your own Minecraft server? What’s your favorite server? Tell us in the comments section below.