Usage of Events

Works with

NOTE: Event system was replaced with procedures so look for procedure wiki pages instead for MCreator versions above 1.7.9

Events

Events are things that happen when something is done in the game. For example when a block is placed. A lot of people think that events are buggy. They are NOT! They are only hard to use and understand and that is why you see this article.

Conditions

If you are searching for usage of event conditions, you should check Event conditions page.

Coordinates in events

Coordinates marked as x, y and z have different names in MCreator. They are i, j and k. This is IJK coordinate system (see image below). 

You can do mathematical operations with these coordinates. Check this page: Mathematical operations with event parameters

Token system in events

You can also add tokens in event output (ex. chat).

Custom code

You can also apply custom code in events. In this case, you need to know this: Here are some typical naming guidelines for method parameters:

  • Integers i, j, k are coordinates
  • Integer l is metadata (if present)
  • Object world is World instance
  • Object entity is Entity instance
  • Object entityPlayer is Player instance

In all events, you have the world object and i, j, k coordinates. Other parameters vary on the event type. You should check Minecraft documentation or its source code if you want to find the exact parameters of the event.

List of event results

Event Description
Custom Code Well this is an area where if you know java, you can create your own event.
Open basic GUI This opens your basic GUI mod.
Remove block Removes the block.
Add block Will make a selected block (Chose the block in the silver button).
Remove block with drop This will remove the block and drop the block that it removes.
Place schematic This will place a schematic file (MCEdit File)
Change game mode This will change your game mode.
Shoot arrow This will shoot an arrow.
Explode Well.. it explodes. You can set the power of the explosion.
Strike Lightning Strikes Lightning on the place of the block. Could be combined with spawning an entity to make a charged creeper.
Spawn entity Spawns an entity (Such as mobs).
Print text Shows some text in the chat.
Deal damage Deals damage.
Execute command This will use a command from Minecraft.
Redstone power Lets you choose if redstone turns on/off.
Switch dimension for an entity This sends you to a different dimension.
Add potion effect This will add a potion effect to the player.
Resize Resizes the block. You can set the preferences.
Set light value Changes how much light it gives off.
Set resistance changes how resistant to explosives it is.
Play sound Plays selected sound effect.
Open browser Opens a website page.
Teleport This will teleport the player to a location.
Clear inventory This will remove and delete all items in the player's inventory.
Consume an item in inventory This will remove a specific item in the inventory.
Add item to inventory This will add a specific item to the inventory.
Set time Changes the time to a certain period.
Set spawn Sets the spawn point.
Toggle downfall This will toggle rain on and off.
Play music Plays one of Minecraft's songs.
Variable set Sets a variable.
Spawn gem Spawns a gem, chosen from the silver button.
Open crafting GUI Opens the crafting gui. (what you see when you right click a crafting table).
Open inventory GUI Opens the inventory gui. (like pressing E on the keyboard).
Achievement get Awards an achievement.
Print in server chat Like print text but it prints it globally on the server.
Spawn particle Spawns a particle of your choice.
Damage Item Lowers the durability.

Event list

Below is the list of all available events.

Block events

Triggers Description
On block right clicked If a player right clicks it an event will occur.
When block added Event happens when block is placed in the world by the player or by an external force.
When neighbor block changes When a neighbor block changes from your block an event will occur.
Update tick Event happens each tick or not if you set different tick rate.
Random update event Event happens on random time (1-5) ticks when on active chunk.
When block destroyed by player When a player destroys the block, an event occurs.
When block destroyed by explosion When a block is destroyed by an explosion an event occurs.
When start to destroy When a player begins breaking a block an event will occur. (like redstone ore glows and gives off particles).
When block placed When the block is placed an event will occur.
When mob/player collides block When a mob/player touches it an event will occur.
When block is placed by this block When a block is placed by your block an event will occur.
Redstone on When powered by redstone an event will occur.
Redstone off When it isn't being powered by redstone an event will occur.
When powering When block receives redstone power, the event occurs.

Item events

Triggers Description
When right clicked in air When right clicked in the air with item an event will occur.
When right clicked on block When right clicked on a block and event will occur.
On item creation When the item is created an event occurs.
When mob killed with item When you kill a mob with the item an event will occur.
When item in inventory tick Event happens each tick the item is located in the player's inventory.
When item in use tick Event happens each tick when the player holds the item.
When item stopped using When the item is not in use an event will occur.

Tools events

Triggers Description
When right clicked in air When right clicked in the air with item an event will occur.
When right clicked on block When right clicked on a block and event will occur.
On item creation When the item is created an event occurs.
When block destroyed with tool When your tool destroys a block an event will occur.

Food events

Triggers Description
When food eaten When a player eats the food an event will occur.
On item creation When the item is created an event occurs.

Armor events

Triggers Description
Helmet tick event Event happens each tick when wearing a helmet.
Body tick event Event happens each tick when wearing a chest plate.
Leggings tick event Event happens each tick when wearing leggings.
Boots tick event Event happens each tick when wearing boots.

Mob events

Triggers Description
When it is struck by lightning When a mob is struck by lightning an event will occur.
When mob falls When a mob falls an event will occur.
When killed When the mob is killed an event will occur.
When mob attacks When the mob attacks an event will occur.
When right clicked on mob When a player right clicks on your mob an event will occur.

Gun events

Triggers Description
When bullet hits block When the bullet hits a block an event will occur.
When bullet hits player When the bullet hits a player an event will occur.
When bullet flying tick Event happens each tick when the bullet is shot and is flying.
When gun used When the gun is used an event will occur.

TX block events

Note TX block is deprecated.

Triggers Description
When block added Event happens when the block is placed in the world by the player or by an external force.
When neighbor block changes When a neighbor block changes from your block an event will occur.
Update tick Event happens each tick or not if you set different tick rate.
Random update event Event happens on random time (1-5) ticks when on active chunk
When block destroyed by player When a player destroys the block, an event occurs.
When block destroyed by explosion When a block is destroyed by an explosion an event occurs.
When start to destroy When a player begins breaking a block an event will occur. (like redstone ore glows and gives off particles).
When block placed When the block is placed an event will occur.
When mob/player collides block When a mob/player touches it an event will occur.
When block is placed by this block When a block is placed by your block an event will occur.
On block right clicked If a player right clicks it an event will occur.