001 package org.bukkit;
002
003 import java.util.Map;
004
005 import com.google.common.collect.Maps;
006
007 /**
008 * A list of all Effects that can happen to entities.
009 */
010 public enum EntityEffect {
011
012 /**
013 * When mobs get hurt.
014 */
015 HURT(2),
016
017 /**
018 * When a mob dies.
019 * <p>
020 * <b>This will cause client-glitches!
021 */
022 DEATH(3),
023
024 /**
025 * The smoke when taming a wolf fails.
026 * <p>
027 * Without client-mods this will be ignored if the entity is not a wolf.
028 */
029 WOLF_SMOKE(6),
030
031 /**
032 * The hearts when taming a wolf succeeds.
033 * <p>
034 * Without client-mods this will be ignored if the entity is not a wolf.
035 */
036 WOLF_HEARTS(7),
037
038 /**
039 * When a wolf shakes (after being wet).
040 * <p>
041 * Without client-mods this will be ignored if the entity is not a wolf.
042 */
043 WOLF_SHAKE(8),
044
045 /**
046 * When a sheep eats a LONG_GRASS block.
047 */
048 SHEEP_EAT(10),
049
050 /**
051 * When an Iron Golem gives a rose.
052 * <p>
053 * This will not play an effect if the entity is not an iron golem.
054 */
055 IRON_GOLEM_ROSE(11),
056
057 /**
058 * Hearts from a villager.
059 * <p>
060 * This will not play an effect if the entity is not a villager.
061 */
062 VILLAGER_HEART(12),
063
064 /**
065 * When a villager is angry.
066 * <p>
067 * This will not play an effect if the entity is not a villager.
068 */
069 VILLAGER_ANGRY(13),
070
071 /**
072 * Happy particles from a villager.
073 * <p>
074 * This will not play an effect if the entity is not a villager.
075 */
076 VILLAGER_HAPPY(14),
077
078 /**
079 * Magic particles from a witch.
080 * <p>
081 * This will not play an effect if the entity is not a witch.
082 */
083 WITCH_MAGIC(15),
084
085 /**
086 * When a zombie transforms into a villager by shaking violently.
087 * <p>
088 * This will not play an effect if the entity is not a zombie.
089 */
090 ZOMBIE_TRANSFORM(16),
091
092 /**
093 * When a firework explodes.
094 * <p>
095 * This will not play an effect if the entity is not a firework.
096 */
097 FIREWORK_EXPLODE(17);
098
099 private final byte data;
100 private final static Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
101
102 EntityEffect(final int data) {
103 this.data = (byte) data;
104 }
105
106 /**
107 * Gets the data value of this EntityEffect
108 *
109 * @return The data value
110 * @deprecated Magic value
111 */
112 @Deprecated
113 public byte getData() {
114 return data;
115 }
116
117 /**
118 * Gets the EntityEffect with the given data value
119 *
120 * @param data Data value to fetch
121 * @return The {@link EntityEffect} representing the given value, or null
122 * if it doesn't exist
123 * @deprecated Magic value
124 */
125 @Deprecated
126 public static EntityEffect getByData(final byte data) {
127 return BY_DATA.get(data);
128 }
129
130
131 static {
132 for (EntityEffect entityEffect : values()) {
133 BY_DATA.put(entityEffect.data, entityEffect);
134 }
135 }
136 }