Closed codingwatching closed 3 years ago
The server we are currently using is the server1.8.jar from Mojangs site, yes.
For learning to work with the Minecraft protocol, I can definitely recommend wiki.vg - It's a full protocol documentation and really good resource (direct link to 1.8, chunk formats).
Sometimes it can also be helpful to look at the original Minecraft source code, for that I can recommend you the Mod Coder Pack, as it will not only decompile but also deobfuscate the sources.
If you'd like to see a working and a simple implementation you can also check out the McClient class in NextCraft.
And for the last point: Yes, they made lots of optimizations on 1.16+ versions, which makes it harder to implement. Version 1.8 is definitely more straightforward, especially if you are just starting out.
Hope this helps :)
Hi @Twometer It is over expected for me, thank you for the detailed explanation is network TCP or UDP when we connect to the server?
Minecraft Java Edition uses a TCP Connection, normally on port 25565
Hi @Twometer Thank you, I will follow your link and read the protocol Could you please take a note of what is packets exchange between Server and Client after login? And for "Smooth chunk loading" feature of NextCraft, how to implement that? Thank you so much!
The basic login packet sequence for an unencrypted connection is as follows:
C->S
Handshake - Notify server about protocol version etc. Switches server into the "Login" stateC->S
Login - Send your username to the serverS->C
Login success (Or Disconnect if the name is invalid) - Switches into "Play" state, player is now logged in.S->C
Set compression - Notify the client about the compression threshold (packets larger than the threshold are compressed using zlib). Packets after that also use a different header, as described hereS->C
Join game - Notify the client about the gamemode (creative/survival) and its player entityIdThis is described in more detail at wiki.vg here (however note that their login example is for an encrypted connection, which involves more steps.)
After that, the server sends the world data using the Map Chunk Bulk
(ID 0x26) packets. A client is also required to respond to KeepAlive packets, or you will be disconnected from the server. You can update your position and rotation using the Player Position And Look
packets (ID 0x03 through 0x06 IIRC). There are packets for block updates, for entity spawning, etc etc.
The "Smooth chunk loading" feature basically does two things
@Twometer Thank you so much!
Hi @Twometer I want to learn the way network protocol between NextCraft and Server. What is the current Server that we are using? Is this server1.8.jar from the Minecraft site? How to debug or get the protocol data of the 1.8 version Thank you so much! I like and very enjoy when learn to build a client for Minecraft. I think 1.8 is a good start too, it quite simple and have fewer blocks and items than other versions (Hopefully) Thank you!