When it comes to video games, I don't think Minecraft has been surpassed. Like all the best games, it has a simple premise: mine blocks in an infinite world, and use them to craft other blocks. But from this simple fundement, a master piece arose.
Even after the purchase by Microsoft, the game is still available for Linux, as Mojang maintains a Java version of their game. Lately, I have been looking into running a server, and intend to write custom code, server-side, to see what can be done with that. Minecraft lets you modify the client code. But this post investigates the modification of the Minecraft server.
Minecraft modding has a long history. But it appears that my best entry point would be SpigotMC.
After executing BuildTools.jar, I ended up with a file called spigot-1.19.3.jar which I copied to my minecraft server root directory. Instead of running minecraft_server.1.19.3.jar I now run the spigot jar file instead.
To make sure newer minecraft clients can connect, you can put ViaVersion.jar in the plugins directory.
Next up, is finding out how to write custom server code. So far I have found Kody Simpson's Youtube series an excellent resource.
Bukkit is a Java Interface, and it is implemented by CraftBukkit.
CraftBukkit is implemented using net.minecraft.server code.
This means that the same object can be referenced and used at three different levels. For instance, the player exists as Bukkit's Player, as CraftBukkit's CraftPlayer and as Mojang's EntityPlayer.
Only the Bukkit interface remains stable between releases, and can be used on different minecraft server versions. Also, the NMS (net.minecraft.server from Mojang) code is decompiled, and obfuscated.
Does coding an NPC require NMS? Or can it be done in SpigotMC? If not, what about PaperMC?
To deal with the obfuscation of n.m.s. there are the so called Mojang mappings. Initially I was unable to use those with Java 19. But using a development version of SpecialSource I was able to use n.m.s. with Java 19.
When getting confused in API terminology, this is a good reminder.
I noticed that using the remapped API, really slowed down my iteration speed. Building my plugin went from a few seconds, to 1 minute, because the remapper is slow.
The first restults from my experiments: The Little Vex That Could. A construction-buddy that builds castles from IKEA flat-packs.