Skip to content
ricochet1k edited this page Feb 16, 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.

Elements are all the types exposed in the ModDamageElement tree, mostly used with the Type conditional.

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.

Events

Damage

Entities: attacker, target
Projectiles: projectile Elements: attacker, target, projectile, 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

Integers: experience (default)

This happens when a living entity is killed. It also has all the things from the Damage event that caused the death available, so you can still use attacker, target, damage, etc.

Heal

Entities: entity
Elements: entity
Integers: heal_amount (default)

Whenever an entity gains health, this is fired. If someone can think of a better name than heal_amount, please let me know.

ProjectileHit

Entities: shooter, target
Projectiles: projectile
Elements: shooter, projectile

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

Spawn

Entities: entity
Elements: 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
Elements: target, tamer

Whenever an entity is tamed, currently only Wolves, but more are being added soon to Minecraft.

Clone this wiki locally