MCreator is a code generator and generates code for you. Sometimes, one needs to manually change the code of elements. This is when a code lock is used. There are some caveats when doing this that need to be understood.
How locked files are handled
When MCreator version changes, the file scheme can be changed. To properly update code, MCreator removed all files in the generator Java package (this is the package specified in workspace settings). This is needed so the old files are removed before new ones are added so the update can be successful. MCreator can lose track of some of the files. Locked files are generally preserved, but in cases where the track of them is lost (major updates), these files can still be removed (in cases when the file structure changes, 2020.2 for example).
Therefore, we recommend backing up custom code changes in locked elements when updating the MCreator version.
You can, however, make any custom code outside the generator package and these files will always be preserved. If your mod package is my.example.mod, the following packages will be handled and cleaned up by generator:
- my.example.mod
- my.example.mod.supackage1
- ...
And these will be not (you can use them freely):
- my.example
- another.package
- ...
Updating MCreator version
When you update the MCreator version, in most cases, changes to locked files will need to be done. One has two options:
- Keep the files locked and manually apply needed changes
- Unlock the files so MCreator can update them for you, but this will overwrite all your changes in these files, so you need to lock them back after updating and re-apply the changes
Changing generator
When a generator or Minecraft version is changed, similar two options are available for updating the code:
- Keep the files locked and manually apply needed changes
- Unlock the files so MCreator can update them for you, but this will overwrite all your changes in these files, so you need to lock them back after updating and re-apply the changes
Warning
Use code lock feature only if you know at least some Java and Forge basics. Without this knowledge, changing code will likely result in build errors you will not be able to understand without this knowledge.
You can find support for custom code on our or other modding forums.