Usage of events

From MCreator Wiki
Jump to: navigation, search


Contents

Notice

We are currently in the process of revamping this page. That means it's a work in progress. Proceed at your own risk.

Events

Events are things that happen when something is done in game. For example when 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 coordiantes. Check this page: Mathematical operations with event parameters

Token system in events

You can also add tokens in event output (ex. chat). You can read more about tokens at this page: Tokens in events

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
  • Intiger 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 world and i, j, k. Other parameters wary on event type. You should check minecraft JavaDOC or its source code.

List of Events

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 gamemode: 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 the spawn entity below 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 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 a sound. Look at List of sound effects to see what sound you want to play
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 players inventory.
Consume 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 Minecrafts 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 Triggers

These are things that trigger events to occur

Block Triggers

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 on the world by player or by 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 powered and event will occur.

Item Triggers

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 a event will occur.
When item in inventory tick: Event happens each tick if item is located in players inventory.
When item in use tick: Event happens each tick when player holds item.
When item stopped using: When the item is not in use an event will occur.

Tools Triggers

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 Triggers

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 Triggers

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

Mob Triggers

Triggers Description
When it is struck with 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 Triggers

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 bullet is shot and is flying.
When gun used: When the gun is used an event will occur.

TX Block Triggers

Triggers Description
When block added: Event happens when block is placed on the world by player or by 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.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Google AdSense