Skip to content
ricochet1k edited this page Jun 7, 2012 · 31 revisions

An event is something that happens at some instant of time. In MD, event routines are executed when a specific event occurs.

Listed here underneath each event are the names of the different "things" available to the routines in that event. In the various routine pages, when you see placeholders in the code like {entity}, the things named in each event are the things you can pick from to fill the placeholders.

Entities are anything in Minecraft that moves. This includes, players, pigs, arrows, primed-and-flashing-TNT-about-to-explode-in-your-face, etc.

Projectiles are arrows, eggs, snowballs, etc. They are also entities, and can be used anywhere an entity reference is needed.

Item Stacks are a stack of items. They have a type, a data integer, a durability, and an amount.

Integers are integer variables that relate directly to the event. The one marked (default) is the one that will be altered by change value routines.

All Entities and Projectiles can be used with the Type conditional to check what type they are.

Events

Damage

Entities: attacker, target
Projectiles: projectile
Damage Type: damage
Integers: damage (default)

This is the event ModDamage was originally created for. It happens any time an entity takes damage, whether from an arrow, mob attacking, fire, cactus, starving, etc.

Death

Entities: attacker, target
Projectiles: projectile
Damage Type: damage
Integers: damage, experience (default)

This happens when a living entity is killed. All the things are from the Damage event that caused the death, except the experience Integer.

Heal

Entities: entity
Integers: heal_amount (default)

Whenever an entity gains health, this is fired.

ProjectileHit

Entities: shooter
Projectiles: projectile

This is fired when a projectile hits a block, NEVER when it hits an entity.

Spawn

Entities: entity
Integers: health (default)

This is fired whenever an entity spawns. Setting the health to 0 will cause the spawn to be canceled by Bukkit.

Tame

Entities: target, tamer

Whenever an entity is tamed, currently Wolves and Ocelots.

PickupExp

Entities: player
Integers: experience (default)

This is fired whenever a player picks up experience orbs.

PrepareEnchant

Entities: player
Item Stacks: item
Integers: bonus, level_1, level_2, level_3

This happens when a player places an item into the enchantment table. Bonus is the number of bookshelves nearby, and the levels are the numbers that will be displayed in each slot of the enchantment GUI. Please beware that this event is sent multiple times by Bukkit. It seems to be twice when the item is placed, and once when it is picked up, but be careful about relying on that behavior. Also note that MC will occasionally throw an exception if you set one of the levels above 50 and a player picks one of them.

Enchant

Entities: player
Item Stacks: item
Integers: level

This happens when the player chooses an enchantment from the enchantment table. Changing level will affect the number of levels subtracted from the player.

Interact

Entities: player
Item Stacks: item
Conditionals: interact_left, interact_right, interact_air, interact_block

This happens when a player left or right clicks and doesn't happen to hit an entity. If the player does hit an entity, then left clicks become the Damage event, and right clicks become the (not yet available) InteractEntity event.

ItemHeld

Entities: player
Integers: prevslot, newslot

This happens when a player switches which item slot in their inventory is active. prevslot is the number of the previous slot they had active, newslot is the new, current one.

Clone this wiki locally