How does nms listen and read data from Minecraft server? (Just wondering) Both Minecraft pe and pc are not open source, but why fans can build a server that listens to Minecraft pe client, but cannot build a server that listens to a Minecraft pc client? Thanks.
@RcExtract Although I do not know how PE works, for the PC, it is because only a limited amount of data is sent by the client. What exactly are PE servers able to listen to?
There is an official Minecraft pc server client, and it is not open source, so we cannot exactly know how the server receive data from the unopen source Minecraft pc client. But Minecraft pe client is unopen source too, then how programmers build their unofficial pe server client and receive data? Therefore, I believe either mojang has posted something related, or the resources is leaked.
@RcExtract For the PC java edition, it's pretty easy. Modders just use a decompiler to see the source code (this is actually what BuildTools does to patch the NMS code). There's even a nearly complete protocol documentation, so if you're making a server or client, you might not even need to look at the decompiled code. Pocket Edition is a bit harder. I'm not too familiar with how reverse-engineering app code works. But I'd assume they use the android edition (since that is written in Java?). They also have a PE protocol documentation, but it's not as nice as the PC one.
After decompiling the nms jar the classes are named aaa, aab, aac, etc. and I have no idea what they are. Also the methods and fields are all named with two alphabets and I don't know their meaning. But thanks for the documentation. So the data are stored into a packet and the packet is sent to the client right?
Who says that it is being serialized to a string? Why wouldn't the client be able to send the packet?
@RcExtract Mojang's sources are obfuscated. They are half-heartedly trying to prevent people from doing this. Spigot has a set of mappings that they use to rename the classes and some of the methods to more meaningful names. The packets aren't serialized to Strings, they're just sent as bytes over the network. Mojang use the netty framework for this, but it isn't really needed (at least if you're writing a client, I'm not sure what the standard nio api for servers looks like).