Procedure system

Creating new procedure

To create and define a new procedure, create a new mod element and give it a name. For the element type, select procedure. After you click OK, procedure editor will open. Here you can define your procedure. Start block is placed on the panel by default. You need to attach all other blocks to this blocks to define a procedure. The procedure will "flow" from the top to the bottom unless you use loop blocks.

Procedure block flow can be activated using external triggers and/or with global events. You can define the global trigger in the start block selector.

Triggering procedures

To trigger procedure from the external event, create a new mod element (for instance a block) and attach the procedure to the trigger (for instance on block right-clicked). Each procedure has its set of dependencies that are shown in the procedure creator window. Only procedures that require dependencies provided by the trigger are shown in the drop-down procedure selector.

If your procedure does world modifications and depends on the world reference, it can not be called from the trigger that does not hold the Minecraft world reference.

Selection of procedure

On the animation above, you can see the procedure selection in action. Used dependencies are shown as highlighted colors. In this case, the procedure named "Procedure" was selected to be triggered (executed) when the player right clicks in the air with the provided item.

Basic procedure examples

Below, you can find some basic examples of how to use procedure system that should help you get started with your custom procedures. Note that the following demonstrations were recorded in earlier versions of MCreator, thus resulting in the different layout.

Random possibility

In this example, we show how to create an if the condition that triggers in 70% of the cases. In case it is triggered, the block at x, y, z (these coordinates depend on the trigger that provides actual coordinate values) is removed.

Random possibility of event in the procedure editor

Check for a block below

This example checks for the block that is 1 block under the provided location. The check ignores metadata as a = operator is used. In case of strict metadata check use == block compare block.

Check if there is a block of certain type below

Dig down 5 blocks including itself

In this example, we create a global variable called level. It is increased 5 times, starting from 0. This procedure removes the block at given x,y,z coordinates and then removes 4 blocks below it in proper order.

Dig down 5 blocks using block diagram

Send message when a certain amount of items in slot

In this example, we see how to check for the number of items that a block at x,y,z contains in its inventory. If there is a block without inventory or no block at all at this location, zero number is returned. If the block contains a number divisible by 5 of blocks, a message is sent to all players when the trigger triggers this procedure.

Send message when the number of items in a slot is dividable by 5

Emit redstone power when the block sees the sky

In this example, we show how to make the provided block emit the redstone power if the block at the given coordinates can see the sky (no blocks obstruct the view to the sky).

Emit redstone power when the block can see the sky above

 

Procedure conditions (if block)

Random chance procedures

How to use variables

How to use logic blocks (logic gates)

How to make a global timer

Procedure use example: custom TNT block



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.