2012-01-14 17:35:52 +00:00
|
|
|
package org.bukkit;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
2012-01-14 17:35:52 +00:00
|
|
|
/**
|
|
|
|
* A list of all Effects that can happen to entities.
|
|
|
|
*/
|
|
|
|
public enum EntityEffect {
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When mobs get hurt.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
HURT(2),
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When a mob dies.
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2014-11-30 21:09:01 +00:00
|
|
|
* <b>This will cause client-glitches!</b>
|
2012-01-15 14:37:30 +01:00
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
DEATH(3),
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The smoke when taming a wolf fails.
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2012-01-15 14:37:30 +01:00
|
|
|
* Without client-mods this will be ignored if the entity is not a wolf.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
WOLF_SMOKE(6),
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The hearts when taming a wolf succeeds.
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2012-01-15 14:37:30 +01:00
|
|
|
* Without client-mods this will be ignored if the entity is not a wolf.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
WOLF_HEARTS(7),
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When a wolf shakes (after being wet).
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2012-01-15 14:37:30 +01:00
|
|
|
* Without client-mods this will be ignored if the entity is not a wolf.
|
|
|
|
*/
|
2012-01-29 11:10:40 +01:00
|
|
|
WOLF_SHAKE(8),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a sheep eats a LONG_GRASS block.
|
|
|
|
*/
|
2014-04-11 16:22:37 -06:00
|
|
|
SHEEP_EAT(10),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When an Iron Golem gives a rose.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not an iron golem.
|
|
|
|
*/
|
|
|
|
IRON_GOLEM_ROSE(11),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hearts from a villager.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a villager.
|
|
|
|
*/
|
|
|
|
VILLAGER_HEART(12),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a villager is angry.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a villager.
|
|
|
|
*/
|
|
|
|
VILLAGER_ANGRY(13),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Happy particles from a villager.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a villager.
|
|
|
|
*/
|
|
|
|
VILLAGER_HAPPY(14),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Magic particles from a witch.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a witch.
|
|
|
|
*/
|
|
|
|
WITCH_MAGIC(15),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a zombie transforms into a villager by shaking violently.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a zombie.
|
|
|
|
*/
|
|
|
|
ZOMBIE_TRANSFORM(16),
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a firework explodes.
|
|
|
|
* <p>
|
|
|
|
* This will not play an effect if the entity is not a firework.
|
|
|
|
*/
|
|
|
|
FIREWORK_EXPLODE(17);
|
2012-01-15 14:37:30 +01:00
|
|
|
|
|
|
|
private final byte data;
|
2012-01-29 11:10:40 +01:00
|
|
|
private final static Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
|
2012-01-15 14:37:30 +01:00
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
EntityEffect(final int data) {
|
|
|
|
this.data = (byte) data;
|
2012-01-15 14:37:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-02-26 10:35:17 -05:00
|
|
|
* Gets the data value of this EntityEffect
|
2012-01-29 11:10:40 +01:00
|
|
|
*
|
2012-02-26 10:35:17 -05:00
|
|
|
* @return The data value
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-01-15 14:37:30 +01:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2012-01-15 14:37:30 +01:00
|
|
|
public byte getData() {
|
|
|
|
return data;
|
|
|
|
}
|
2012-01-29 11:10:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the EntityEffect with the given data value
|
|
|
|
*
|
|
|
|
* @param data Data value to fetch
|
2013-12-15 01:07:43 -05:00
|
|
|
* @return The {@link EntityEffect} representing the given value, or null
|
|
|
|
* if it doesn't exist
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-01-29 11:10:40 +01:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2012-01-29 11:10:40 +01:00
|
|
|
public static EntityEffect getByData(final byte data) {
|
|
|
|
return BY_DATA.get(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
for (EntityEffect entityEffect : values()) {
|
|
|
|
BY_DATA.put(entityEffect.data, entityEffect);
|
|
|
|
}
|
|
|
|
}
|
2012-01-14 17:35:52 +00:00
|
|
|
}
|