Tips for Refactoring and Testing Your Minecraft Mods
You will be well on your way to Minecraft modding success if you make sure to do two things for all of your mods: refactor your mods and test, test, test!
Refactor your mods
A mod that starts to grow too big for you to remember it all can cause a lot of problems because if you try to make changes, you might make changes in the wrong function.
Always consider refactoring your mods when they become too large to understand easily.
An effective way to refactor your mod is to turn it into a library and then import it into a new mod, where you have more control.
Another form of refactoring occurs when you simply change how your functions interact, or even which functions you have.
Before starting to refactor, save a copy of your mod so that you can always return to a working version.
Sometimes, when you’re making simple refactoring changes, you can break your code. Be sure to continually test your code as you build it.
Test your code
Test, and test often. Avoid the situation where you spend hours writing code that doesn’t even work and then have to rewrite it. That’s when designing on paper and using a gameplay loop are helpful.
If you always have code that can be tested and you make only small changes between testing periods, you’re more likely to create correct, working code that you can be proud of.