-
Notifications
You must be signed in to change notification settings - Fork 52
New version update process
This page describes the steps I follow when updating to a new minecraft version in case anyone other than me tries to do it for future (or previous) versions.
This is quite simple, in the main CMakeLists.txt file, the GameVersionValues and ProtocolVersionValues both need to be extended with the new version and the matching protocol (/!\ even if the protocol version hasn't changed, both lists need to have the same number of elements).
./Assets/version/custom folder needs to be filled with the updated files.
-
Biomes.jsonis a list of existing biomes for this version. In addition to id and name, there are three other fields (rainfall, temperature and biomeType) used only for the internal renderer (grass/leaves/water tint) -
Items.jsonhas the same format than the one exported by the data generator, with some additional fields added for max stack size (when not 64) and durability (for tools/armor) -
Blocks.jsonis the mapping extracted by the data generator -
Blocks_info.jsonis a custom file with additional infos for each type of block (hardness, mining tools, colliders etc...). Best way to update is to copy the one of the previous version and add/remove entries based on theBlocks.jsonfile for both versions. It is very uncommon that older entries need to be updated. -
blockstatesandmodelsfolders contain model files for blocks that are not present in the minecraft assets files (mostly entity blocks like chests or banners). It is pretty uncommon to have to add something in here, but if it's the case, you can check the format on the corresponding wiki pages.
Note that if a file hasn't changed since a previous version, you can simply add it to the previous_custom_files.txt file so the repo only contains one instance of each unique file instead of one copy per minecraft version.
The next step is to update protocolCraft with all changes on packets and their associated types. Don't forget to use proper PROTOCOL_VERSION #if preprocessor conditions to make sure new code is included in the correct versions.
Adding/removing a packet for a given version is quite similar. Here are the steps to follow.
- add a hpp file in
protocolCraft/include/protocolCraft/Packets/XXX/XXXbound(only to add a new packet, don't remove files when a packet needs to be removed, use #if preprocessor conditions instead) - include this file in either
protocolCraft/include/protocolCraft/AllClientboundPackets.hpporprotocolCraft/include/protocolCraft/AllServerboundPackets.hpp - add the packet class in one of the AllXXXboundXXXPackets tuple below. /!\ The order of the packet in the tuple must match its minecraft protocol ID (i.e. first packet is ID 0, then ID 1 etc...).
- in
protocolCraft/src/BasePacket.cppadd aDEFINE_PACKET_CLASSline with the new class. This will allow you to use theSERIALIZED_FIELDin the class.
For subtypes, the process is similar but simpler, as there is no tuple or ID for them. Usually protocolCraft/src/NetworkType.cpp is the place to add a type with a DEFINE_NETWORK_TYPE call. If the type is a data subtype of a another type (like for particles, recipes, components etc...) then it's often better to keep the DEFINE_NETWORK_TYPE in the corresponding cpp file.
Updating botcraft is way less straightforward and can vary quite a lot based on what new features there are in the minecraft update. Most of the time, entities need to be updated (creating the hpp and cpp file, adding the type to the enum in botcraft/include/botcraft/Game/Entities/entity/Entity.hpp, adding it to the factory in botcraft/src/Game/Entities/entity/Entity.cpp and make sure all attributes are correct). Also it can be a good idea to check the Enums in botcraft/include/botcraft/Game/Enums.hpp.
For the other features I'm usually following an iterative process running the online/physics tests and checking what's broken before fixing them.
Tests and examples may also have to be updated in order to compile after some changes to protocolCraft/botcraft. For the tests that run a server (online/physics) it may also be necessary to update some server side stuff (commands syntax, regex output etc...).
Once a new version is supported, there are a few extra things to change: the readme should be updated with the new version, as well as the list of versions that can be requested in .github/ISSUE_TEMPLATE/version-request.yml.