How to Use Conditions

Principles of Conditions

Conditions allow you to add a requirement in order for an event to be triggered.

"Return" Procedure Blocks

First create a procedure element. You can add a conditon through various "return" procedure blocks in the flow control tab; they will return values which determine if the conditions is met.

Using Conditions

Creating a condition

The following in an example for a correctly executed condition statement. It will return true if the item(s) in the off-hand of Event/Target Entity is Diamond, thus meeting the condition. Vice versa. Note that it has no default return value.

 

On the other hand, the below statement is also a viable statement; however, this one has a default return value of false.

Proc2

 

Note that the following condition statement is not correct and will not be executed correctly.

 

 

Example condition usage

Now let's test this out with a dimension portal as an example. Start creating your dimension, follow the How to Make a Dimension wiki page if you come across a problem. Now in the portal section of the dimension creation page, you will see two available condition slots at the bottom of the page like these.

One for making the portal and another for traveling through the portal. Let's link our condition procedure to portal creation. Now try building the portal frame and igniting it, you'll see that you can't do it without a diamond in your off-hand slot.

 

Video tutorial

If you prefer watching a video, you can find a video tutorial about using conditions below:

Entity AI conditions



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.