This wiki page explains some of the low-hanging fruit on how to make Minecraft mods with the MCreator mod maker that are high-performance and don't consume too many resources.
Tick procedure triggers
This is the absolutely most important thing in order to keep your mod easy on the computer resources.
Unless absolutely needed, avoid calling procedures on tick triggers as they run every tick. If you need to use the tick procedure, make sure it is as lightweight as possible. Things to avoid doing in tick triggers:
- Placing huge amounts of blocks at once
- Spawning many entities
- Calling commands
- Setting too many variables
- Changing too many slots in the inventory
Keep in mind that certain procedure blocks, such as setting global variables, send a network packet. If you set a value every tick, your mod will emit a network packet or more of them every tick, which will slow down the gameplay for all clients and increase network utilization.
Avoid using commands
Avoid calling commands from procedures for things that can be implemented with native procedure blocks. Commands need to be parsed and provided with context on every execution, which adds overhead and causes performance degradation.
Avoid complex models
Avoid complex JSON, OBJ, and JAVA models. If your model has too many parts and cubes, it will significantly slow down rendering, especially if many of the elements (blocks, items, entities) consisting of complex models are rendered at once.
Avoid long-running tasks
Avoid running procedures that use nested loops, for example, to scan a large area of blocks. Until your scan runs, the game can not perform any other action. The game's logic is single-threaded, meaning tasks run one after another. If your procedure takes a long time to execute, the game will freeze for said long time, causing it to lag.
Group similar procedures together
Starting with MCreator 2025.3, the code generator tries to optimize things such as network synchronization to only send one network packet when needed. In order for the utilization to work, group similar procedure blocks one after another. If you need to collect values first, store them in a local variable and then, e.g., set slots or global variables using procedure blocks grouped one after another.
Running the same procedure multiple times
If you use high-performance impact procedures such as "get the nearest entity of type", store the return value of such a procedure in a local variable, and use this local variable instead of calling the nearest entity procedure block every time you need the entity, the procedure will run much faster. This way, the slow and complex procedure block only runs once.
Example of a non-optimal approach (in this case, the entity lookup will be done four times, which is very non-optimal):
Example of a correct high-performance approach:
This second approach is not only much more performant, but also yields much cleaner generated code.
Worldgen performance
If your mod places too many worldgen features and structures, the new chunk generation will be very slow. Avoid having too many features with placement conditions that result in a lot of features generating in the same chunk. Also, avoid features and structures that span across many chunks, as this can cause cascaded chunk loading, which also negatively impacts Minecraft worldgen performance.