Add some testing

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot
2012-01-29 11:10:40 +01:00
parent ae0eb736d1
commit ac2271958e
34 changed files with 871 additions and 281 deletions

View File

@@ -1,5 +1,9 @@
package org.bukkit;
import java.util.Map;
import com.google.common.collect.Maps;
/**
* A list of all Effects that can happen to entities.
*/
@@ -8,46 +12,73 @@ public enum EntityEffect {
/**
* When mobs get hurt.
*/
HURT((byte) 2),
HURT(2),
/**
* When a mob dies.
* <p>
* <b>This will cause client-glitches!
*/
DEATH((byte) 3),
DEATH(3),
/**
* The smoke when taming a wolf fails.
* <p>
* Without client-mods this will be ignored if the entity is not a wolf.
*/
WOLF_SMOKE((byte) 6),
WOLF_SMOKE(6),
/**
* The hearts when taming a wolf succeeds.
* <p>
* Without client-mods this will be ignored if the entity is not a wolf.
*/
WOLF_HEARTS((byte) 7),
WOLF_HEARTS(7),
/**
* When a wolf shakes (after being wet).
* <p>
* Without client-mods this will be ignored if the entity is not a wolf.
*/
WOLF_SHAKE((byte) 8);
WOLF_SHAKE(8),
/**
* When a sheep eats a LONG_GRASS block.
*/
SHEEP_EAT(10);
private final byte data;
private final static Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
EntityEffect(byte data) {
this.data = data;
EntityEffect(final int data) {
this.data = (byte) data;
}
/**
* @return The data-value that is sent to the client to play this effect.
* Gets the EntityEffect with the given data value
*
* @param data Data value to fetch
* @return The {@link EntityEffect} representing the given value, or null if
* it doesn't exist
*/
public byte getData() {
return data;
}
/**
* Gets the EntityEffect with the given data value
*
* @param data Data value to fetch
* @return The {@link EntityEffect} representing the given value, or null if it doesn't exist
*/
public static EntityEffect getByData(final byte data) {
return BY_DATA.get(data);
}
static {
for (EntityEffect entityEffect : values()) {
BY_DATA.put(entityEffect.data, entityEffect);
}
}
}