Tutorial: Clean and Easy to Manage Block Coding

Started by 7axoL on

Topic category: User side tutorials

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Tutorial: Clean and Easy to Manage Block Coding
Wed, 01/07/2026 - 23:48 (edited)

This is a tutorial that teaches tricks on how to make your biggest procedures "cleaner", making them organized and much faster to read, analyze, manage and fix. It focuses more on the comfort of the developer during the coding process, reducing the amount of required brainpower, and not on making procedures more efficient or optimized, just making them look trivial/smaller.

Say you have a proper, really big procedure that has multiple tasks. Each of these tasks are accomplished by a group of many pieces of code. If there somehow is a bug in that big procedure and you need to fix it, finding where the bug may be extremely hard if the code is poorly organized. One situation in which this may occur is if you're coding a complicated custom entity, such as a boss fight or a even pretty smart mob. If you suffer with this kind of problem, using following tricks (which I've named myself) can be very important to mitigate it.

Or, if you want to learn the art of making beautiful code, here you go.

Note: Reading this tutorial is not necessary for new MCreator users since they are still learning about all basic available features for block coding. This is not a tutorial for "actual" coding, since I have zero experience on this. This is a tutorial based on personal experience.

Here's all the tricks I know:


SEPARATING

  • https://imgur.com/ulITzh0 (Image containing an example of separation of different tasks. The code is random and its size is much smaller for demonstration purposes. Each marker block has the role of "categorizing" each of those tasks.)

Separating uses visually or physically significant ways of distinguishing between each task in coding, making managing them individually quicker. I currently know these 2 effective methods:

 

MARKING

In MCreator, in the "Advanced" tab of procedures, there exists a code block called a "debug marker". Not only it stands out compared to other code blocks, you can change the text in it without affecting any procedures, allowing separating each task for easier readability. A very quick method.

DIVIDING

Dividing is the hardest method here, but still very effective. It involves coding a task in a different procedure and attaching it to the main one in a much more compact way with the "call procedure" block, also located in the "Advanced" tab. For this, you HAVE TO already have the understanding of dependencies as those are used for calling procedures. This method is extremely effective for organization if used correctly, making reading code much easier, and big procedures much smaller. I recommend using this technique for translating large tasks that appear in a big procedure into "Call procedure" blocks, which are more compact and accomplish the exact same thing.


COMPACTING

Compacting is making procedures look smaller by making them accomplish the exact same thing with way less necessary code. One way to do this is by replacing repeating tasks with local variables, very flexible resources. In the good example of Compacting, repeating tasks are turned into one with the usage of local variables, putting more than one possible outcome in a singular space.


COLLAPSING

Collapsing is the easiest technique here, using a vanilla MCreator feature that collapses block code. Allows compressing code that might be unnecessary to go through, mainly used on "If" conditions that are large and have a lot of code within. Using it incorrectly, however, will make reading code harder.

Edited by 7axoL on Wed, 01/07/2026 - 23:48